-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
test: add tests for clearBuffer state machine #9922
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Someone from @nodejs/streams should do the final sign-off but LGTM insofar I'm able to judge that.
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nit: no blank line here.
121b512
to
6c33afe
Compare
@bnoordhuis: Good catch on the blank line! Updated the code! |
}; | ||
|
||
writable._writableState.corked = 1; | ||
writable._writableState.bufferedRequestCount = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please trigger the corked
and bufferedRequestCount
things using the normal API?
@mcollina: Thanks for the comment! I've tried to address your review. I set
I'm trying to trace what's going on but before I invest too much time I figured I might ask you and see if I am missing an obvious way to do this. |
@captainsafia you need to have an async |
@mcollina: Thanks for the guidance! I'll try pursuing it on my own for a bit next week and get in touch with you on IRC if I'm not getting anywhere. |
Bump! @captainsafia Are you still working on this? |
Yep! I did some tinkering with it yesterday but I don't think I have anything commit worthy. I'll see if I can get something tomorrow or Monday. Sorry for leaving this hanging! |
@mcollina: Couldn't catch you on IRC so here goes.
I've got a barebones
I'm using |
|
||
const writable = new stream.Writable(); | ||
|
||
writable._write = (chunk, encoding, cb) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider using a regular function here, as we make no guarentees that apply()
or call()
may not be called on this internally in the future.
(Assigning arrow functions as prototype functions is generally bad practice because those do not work.)
Lines 310 to 318 in f3cf8e9
You should issue multiple writes synchronously after Note that Line 409 in f3cf8e9
_write , and one with a stream with _writev .
|
Ping @captainsafia! Still working on this? (No rush; I'm just making sure it's not stalled.) |
Sorry for staying delayed on this. I'd love to see this own through but I think it is a tad bit above my pay grade at the moment so I'll close it and give someone else the opportunity to tackle it with some of the insights provided above. |
@captainsafia may I build upon your commit? |
@mcollina: Sure! I've added you as a collaborator on my fork. |
59f370f
to
9d1d739
Compare
@captainsafia I force pushed this. Let me know if you are ok with the content. |
9d1d739
to
53cf711
Compare
53cf711
to
d1709c3
Compare
This checks to see that clearBuffer appropriately decrements the correct values in _writableState when clearBuffer is invoked in end. Fixes: nodejs#8687 PR-URL: nodejs#9922 Reviewed-By: Matteo Collina <[email protected]>
d1709c3
to
b0be2ac
Compare
@italoacasas should be addressed. |
CI failures on AIX and FreeBSD seem unrelated. I just terminated some stalled tests on those machines--probably a previous test run had a bug that caused cluster tests to hang and not free ports, causing subsequent runs like this one to also fail. Re-running CI: https://ci.nodejs.org/job/node-test-pull-request/5665/ |
Landed 275362a |
Thanks for getting this through the finish line, everyone! ❤️ |
This checks to see that clearBuffer appropriately decrements the correct values in _writableState when clearBuffer is invoked in end. Fixes: #8687 PR-URL: #9922 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
This checks to see that clearBuffer appropriately decrements the correct values in _writableState when clearBuffer is invoked in end. Fixes: #8687 PR-URL: #9922 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
This checks to see that clearBuffer appropriately decrements the correct values in _writableState when clearBuffer is invoked in end. Fixes: #8687 PR-URL: #9922 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
This checks to see that clearBuffer appropriately decrements the correct values in _writableState when clearBuffer is invoked in end. Fixes: #8687 PR-URL: #9922 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
This checks to see that clearBuffer appropriately decrements the correct values in _writableState when clearBuffer is invoked in end. Fixes: #8687 PR-URL: #9922 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
This checks to see that clearBuffer appropriately decrements the correct values in _writableState when clearBuffer is invoked in end. Fixes: #8687 PR-URL: #9922 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
This checks to see that clearBuffer appropriately decrements the correct values in _writableState when clearBuffer is invoked in end. Fixes: #8687 PR-URL: #9922 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
This checks to see that clearBuffer appropriately decrements the correct values in _writableState when clearBuffer is invoked in end. Fixes: #8687 PR-URL: #9922 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
stream, test
Description of change
This checks to see that clearBuffer appropriately decrements the
correct values in _writableState when clearBuffer is invoked in
end.
Closes #8687.