Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HttpKernel] Skip corrupted CSV data in FileProfilerStorage #50947

Merged
merged 1 commit into from Jul 13, 2023

Conversation

radar3301
Copy link
Contributor

Q A
Branch? 6.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets Partially fixes #50942, improves/fixes on PR #50913, partially fixes #50816
License MIT

Technically, part of this fix could go all the way back to 2.1, but since we're not sure why/how exactly the index.csv file is being corrupted in the first place, this PR should just serve as a stop-gap measure until the root cause can be identified.

A corrupted index.csv file is especially noticeable since 6.3, when the "Remove Expired Profiles" feature was added by #47352 .

RE: improves/fixes on PR #50913:
Warnings are (usually?) only escalated to errors in debug mode, so having a try/catch is a bit more overhead than I think is actually needed, and I believe just checking that the line read from the csv is not corrupted is the better/faster option. Granted, the profiler should really only be active in debug/non-production modes anyway, but "should" and reality usually don't align...

@alamirault @MatTheCat @benjaminfunk @Pelagoss @derrabus

@carsonbot carsonbot added this to the 6.3 milestone Jul 12, 2023
@radar3301 radar3301 changed the title Update FileProfilerStorage.php [HttpKernel] Update FileProfilerStorage.php Jul 12, 2023
@derrabus
Copy link
Member

Thank you. Please pick a more meaningful PR title and add a test.

@radar3301 radar3301 changed the title [HttpKernel] Update FileProfilerStorage.php [HttpKernel] Ignore corrupted CSV data in FileProfilerStorage Jul 12, 2023
@radar3301
Copy link
Contributor Author

radar3301 commented Jul 12, 2023

Thank you. Please pick a more meaningful PR title

Done. No idea how I didn't see that.

and add a test.

Sorry, but I'm not going to write 50+ lines of code of unit test for such a trivial 2 LoC sanity check...

@radar3301 radar3301 changed the title [HttpKernel] Ignore corrupted CSV data in FileProfilerStorage [HttpKernel] Skip corrupted CSV data in FileProfilerStorage Jul 12, 2023
fix "Undefined array key" by skipping invalid/corrupted lines
@nicolas-grekas
Copy link
Member

Thank you @radar3301.

@nicolas-grekas nicolas-grekas merged commit 201ad71 into symfony:6.3 Jul 13, 2023
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants