Repository navigation
Upgrade karma to 6.4.4 to pull in engine.io 6.6.11 - #2
Open
cursor[bot] wants to merge 2 commits into
Open
cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
socket.io 4.4.1 (pulled in by karma 6.3.16) pins engine.io ~6.1.0, whose polling transport never ends the HTTP response for binary POSTs on protocol v4, letting clients pile up open connections on the karma server. karma 6.4.4 depends on socket.io ^4.7.2, which resolves engine.io 6.6.11 (fixed in 6.6.7).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
package-lock.jsonlocked engine.io 6.1.3 (through karma 6.3.16 → socket.io 4.4.1). Engine.IO versions from 4.1.0 up to, but not including, 6.6.7 have a bug in the protocol v4 polling transport. When a client sends a POST withContent-Type: application/octet-stream, the server callsonError("invalid content")and returns without ever ending the HTTP response (build/transports/polling.js,onDataRequest). Each such request leaves a connection and socket open on the server. The karma test server (tests/karma.config.js,tests/karma.config.dev.js, port 9876, default transports including polling, listening on all interfaces) exposes this endpoint. In the dev config the server keeps running because it usesautoWatchwithoutsingleRun.Fix
karmaindevDependenciesfrom^6.3.16to^6.4.4, and let npm rewrite the lockfile. karma 6.4.4 depends onsocket.io ^4.7.2. That resolves socket.io 4.8.4, which pulls in engine.io 6.6.11 (~6.6.0; the fix shipped in 6.6.7). In 6.6.11, the invalid-binary branch now doesres.writeHead(400).end().mime-types/mime-db,cookie,corsandwsthey need. There is only one copy of engine.io in the tree.tests/karma-polling.test.jsand include it innpm test. The test starts karma's real server fromtests/karma.config.dev.jswith no browsers, opens an Engine.IO v4 polling session, and sends a binary POST. It fails if the server doesn't answer within 3 s. It loads only thekarma-mochaandkarma-sinon-expectplugins, so it doesn't need a PhantomJS binary.Options considered
overridesentry forcingengine.io >=6.6.7would also work. But socket.io 4.4.1 declaresengine.io ~6.1.0, so the override would run it against a version it doesn't support. This repo also doesn't useoverridestoday. Upgrading karma, the direct dependency, keeps everything inside declared ranges.Tests
node tests/karma-polling.test.jskarma start tests/karma.config.js(PhantomJS, run withOPENSSL_CONF=/dev/nullon this machine)node tests/po2json.test.jsI also repeated the attack against the fix: 200 concurrent polling sessions, each sending a 64 KiB binary POST to karma's server from
tests/karma.config.js. All 200 were answered.Left to CI / notes for reviewers
npm test. Its script already referencedtests/plural.test.js, which doesn't exist in the repo, so it fails at that step onmastertoo..travis.ymltargets Node 9. The existing lockfile already needed Node ≥ 10 (karma 6.3.16, engine.io 6.1.3). After this change the floor is Node ≥ 10.2.0 (engine.io 6.6.11), so the CI config was already out of date before this change.