Infinite loop in stream_read() for invalid/corrupt chunks#34489
Conversation
|
This is just an idea on how to resolve this issue, it appears to work as expected (throws an exception which is then reported to the user in a friendly way). |
Codecov Report
@@ Coverage Diff @@
## master #34489 +/- ##
============================================
- Coverage 65.1% 65.1% -0.01%
- Complexity 18338 18342 +4
============================================
Files 1199 1199
Lines 69629 69638 +9
Branches 1283 1283
============================================
+ Hits 45335 45339 +4
- Misses 23920 23925 +5
Partials 374 374
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #34489 +/- ##
============================================
- Coverage 65.11% 65.1% -0.01%
- Complexity 18338 18341 +3
============================================
Files 1199 1199
Lines 69629 69635 +6
Branches 1283 1283
============================================
+ Hits 45336 45339 +3
- Misses 23919 23922 +3
Partials 374 374
Continue to review full report at Codecov.
|
…multiple times Removed extra log information, doesn't work as expected Fix comments Add missing declaration for use Sabre\DAV\Exception\BadRequest;
|
@labkode FYI as you've observed something similar recently |
|
stable10: #34558 |
Description
We've experienced an edge case where stream_read() will enter an infinite loop when one of the chunks of a web upload is invalid/corrupt as it never reads any more data, so stays in the same position for reading indefinitely.
Related Issue
Motivation and Context
Infinite loops are bad and it is holding files open.
How Has This Been Tested?
This has been tested in our test environment which is a replica of our production environment (see original issue).
The process I used for testing this was:
sudo -u www-data sh -c 'cd web-file-upload-* && truncate -s 0 $(ls -1 | tail -n1)'rewinddir()errors (not sure if this is just a symptom of our storage, so alternatively - find the pid of the php process for the upload and runstrace -s 1024 -p <pid>and you'll see it constantly trying to open the same file over and over.Types of changes
Checklist: