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

Fix Node.JS test failures #442

Merged
merged 3 commits into from
Aug 3, 2018
Merged

Fix Node.JS test failures #442

merged 3 commits into from
Aug 3, 2018

Conversation

squaremo
Copy link
Collaborator

@squaremo squaremo commented Jul 16, 2018

The behaviour of the 'readable' event changed, or was tightened up,
in

https://github.com/nodejs/node/pull/17979

such that it is always called on the next tick. This change appears
first in Node.JS v10.0).

Since we rely on `'readable' in the multiplexing, it means that we
have to be more careful about when we wait for the next event loop to
come around in tests.

The tests tend to be much more brittle than live code with respect to
the order things happen, since they attempt to nail down precise
states or orderings (e.g., "the unpipe happened exactly between
these writes").

It also means we have to be more careful when cleaning up channels --
one test fails in NodeJS v10 because the cleanup unpipes it before the
last frame can be read.

The behaviour of the `'readable'` event changed, or was tightened up,
in

    nodejs/node#17979

such that it is _always_ called on the next tick. This change appears
first in Node.JS v10.0).

Since we rely on `'readable' in the multiplexing, it means that we
have to be more careful about when we wait for the next event loop to
come around in tests.

The tests tend to be much more brittle than live code with respect to
the order things happen, since they attempt to nail down precise
states or orderings (e.g., "the `unpipe` happened exactly between
these writes").
When a channel is closed, its buffer is unpiped from the connection
muxer as part of cleaning up. In NodeJS v10, this happens before any
frames that have just been written to the channel are picked up by the
muxer -- e.g., the CloseOK response.

Instead of directly unpiping, end() the channel buffer, and let it be
unpiped once all its frames are read. So far as I can think it
through, this is correct behaviour anyway, and it only worked before
by coincidence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant