Uh oh!
There was an error while loading. Please reload this page.
stream: the position of _read() is wrong - #38292
Conversation
VoltrexKeyva
commented
Apr 19, 2021
Hi @helloyou2012, could you remove the merge commit from your branch? Merge commits tend to break the tooling, you can use node/doc/guides/contributing/pull-requests.md Lines 215 to 217 in 54322b8 |
benjamingr
commented
Apr 19, 2021
@nodejs/streams |
mcollina
left a comment
There was a problem hiding this comment.
Why is wrong? Can you please expand?
Can you please add a unit test?
ronag
left a comment
There was a problem hiding this comment.
Needs test and also a little unsure what exactly we are solving here. If I would guess:
- Currently
this.poscould actually be larger than the file size, which is a little weird. - Currently
this.posis what we have requested, but necessarily what we have read.
helloyou2012
commented
Apr 19, 2021
@mcollina see this issue: #33940, this node/lib/internal/streams/readable.js Line 487 in d4f33f1 _read(n) multiple times with n= highWaterMark, but the bytesRead may be not equal to n, then the data will loss. Example: |
The problem arised because current implementation assumed next position to start reading is node/lib/internal/fs/streams.js Lines 275 to 277 in d4f33f1 But in reality, it does not necessarily read node/lib/internal/fs/streams.js Line 246 in d4f33f1 As a result, some bytes in file may be skipped. The "assumed" reading is longer than the "actual". About the test, the issue occurred because |
ronag
left a comment
There was a problem hiding this comment.
I think this change could make sense. But we need a test.
benjamingr
commented
Apr 19, 2021
Good question. I'm not sure I don't think I ever wrote such a test in Node - A good way to try is to take the test case from #33940 and to try to make a smaller isolated case from it (shorter interval and smaller watermark) @nodejs/fs |
helloyou2012
commented
Apr 20, 2021
I added test case. @ronag@benjamingr |
nodejs-github-bot
commented
Apr 20, 2021
There was a problem hiding this comment.
Any reason this is a mustCAllAtLeast and not a mustCall?
There was a problem hiding this comment.
mustCall is exact times, but this place will call at least 1 time not exact 1 time.
Uh oh!
There was an error while loading. Please reload this page.
benjamingr
left a comment
There was a problem hiding this comment.
LGTM if the test passes after this and fails in master
benjamingr
commented
Apr 20, 2021
Also thank you for the meaningful contribution and working with us 🙏 |
mcollina
left a comment
There was a problem hiding this comment.
lgtm, hopefully the setInterval test would not fail in CI.
ronag
left a comment
There was a problem hiding this comment.
LGTM. Was wondering why this hasn't landed yet. Turns out it's my fault.
nodejs-github-bot
commented
Apr 25, 2021
nodejs-github-bot
commented
Apr 26, 2021
nodejs-github-bot
commented
Apr 26, 2021
ronag
commented
Apr 26, 2021
I think there is a problem on arm with the new test. @helloyou2012 |
helloyou2012
commented
Apr 27, 2021
Yes, the test timed out. I think it is better to set a time after which to exit safely. I will fix later. |
jasnell
commented
Apr 28, 2021
Removing the author ready label as there's still work to be done here. |
nodejs-github-bot
commented
May 1, 2021
nodejs-github-bot
commented
May 2, 2021
ronag
commented
May 2, 2021
@helloyou2012 this still seems to have problems passing. Could you try and look at the CI failures? I started another CI just in case. |
nodejs-github-bot
commented
May 2, 2021
helloyou2012
commented
May 2, 2021
It failed cause of |
helloyou2012
commented
May 2, 2021
This CI all passed. |
mcollina
commented
May 3, 2021
Landed in d826f6b |
Fixes: #33940