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

AssertionError [ERR_ASSERTION]: false == true #47

Closed
misterfresh opened this issue Jun 25, 2017 · 37 comments
Closed

AssertionError [ERR_ASSERTION]: false == true #47

misterfresh opened this issue Jun 25, 2017 · 37 comments

Comments

@misterfresh
Copy link

I get the error
assert.js:60
throw new errors.AssertionError({
at PriorityNode.removeChild (node_modules\spdy-transport\lib\spdy-transport\priority.js:74:3)
at PriorityNode.remove ( node_modules\spdy-transport\lib\spdy-transport\priority.js:62:15)
at PriorityTree.add ( node_modules\spdy-transport\lib\spdy-transport\priority.js:163:23)
at Stream._initPriority ( node_modules\spdy-transport\lib\spdy-transport\stream.js:101:25)
at new Stream ( node_modules\spdy-transport\lib\spdy-transport\stream.js:76:8)
at Connection._createStream ( node_modules\spdy-transport\lib\spdy-transport\connection.js:388:16)
at Connection._handleHeaders ( node_modules\spdy-transport\lib\spdy-transport\connection.js:436:21)
at Connection._handleFrame ( node_modules\spdy-transport\lib\spdy-transport\connection.js:319:10)
at Parser. ( node_modules\spdy-transport\lib\spdy-transport\connection.js:156:10)
at emitOne (events.js:115:13)
at Parser.emit (events.js:210:7)
at addChunk ( node_modules\readable-stream\lib_stream_readable.js:283:12)
at readableAddChunk ( node_modules\readable-stream\lib_stream_readable.js:270:11)
at Parser.Readable.push ( node_modules\readable-stream\lib_stream_readable.js:237:10)
at Parser.Transform.push ( node_modules\readable-stream\lib_stream_transform.js:146:32)
at next ( node_modules\spdy-transport\lib\spdy-transport\protocol\base\parser.js:53:12)

This happens on http2 push from server

@misterfresh
Copy link
Author

I commented the line 74 "assert(index !== -1)" in spdy-transport\lib\spdy-transport\priority.js:74:3
and now the server is not crashing any more...

To give context, I am pushing a lot of files with http2 push, and for every file that is not actually requested by the client, I get the error
link /js/vendors/aphrodite push error Error: Got RST: REFUSED_STREAM
at Stream._handleRST ( node_modules\spdy-transport\lib\spdy-transport\stream.js:281:24)
at Stream._handleFrame ( node_modules\spdy-transport\lib\spdy-transport\stream.js:126:10)
at Connection._handleFrame ( node_modules\spdy-transport\lib\spdy-transport\connection.js:324:12)
at Parser. ( node_modules\spdy-transport\lib\spdy-transport\connection.js:156:10)
at emitOne (events.js:115:13)
at Parser.emit (events.js:210:7)
at addChunk ( node_modules\readable-stream\lib_stream_readable.js:283:12)
at readableAddChunk ( node_modules\readable-stream\lib_stream_readable.js:270:11)
at Parser.Readable.push ( node_modules\readable-stream\lib_stream_readable.js:237:10)
at Parser.Transform.push ( node_modules\readable-stream\lib_stream_transform.js:146:32)
at next ( node_modules\spdy-transport\lib\spdy-transport\protocol\base\parser.js:53:12)
at node_modules\spdy-transport\lib\spdy-transport\protocol\http2\parser.js:72:5
at Parser.onRSTFrame (node_modules\spdy-transport\lib\spdy-transport\protocol\http2\parser.js:368:3)
at Parser.onFrameBody ( node_modules\spdy-transport\lib\spdy-transport\protocol\http2\parser.js:144:10)
at Parser.execute ( node_modules\spdy-transport\lib\spdy-transport\protocol\http2\parser.js:64:8)
at Parser._consume ( node_modules\spdy-transport\lib\spdy-transport\protocol\base\parser.js:95:8)

@matthewp
Copy link

I submitted #48 which should fix your issue here.

matthewp added a commit to donejs/spdy-transport that referenced this issue Jun 26, 2017
When a node is removed it gets removed from the tree's `map` but not the
tree's `list`, so this memory is leaked.

This also fixes the assertion errors seen in spdy-http2#47 and
spdy-http2/node-spdy#318 and elsewhere.
@misterfresh
Copy link
Author

With your fix, I'm getting a slightly different error, but the server still crashes when a resource pushed by http2 server push is not requested by the client.

assert.js:60
throw new errors.AssertionError({
^

AssertionError [ERR_ASSERTION]: false == true
at PriorityNode.removeChild ( node_modules\spdy-transport\lib\spdy-transport\priority.js:74:3)
at PriorityNode.remove ( node_modules\spdy-transport\lib\spdy-transport\priority.js:62:15)
at Stream._handlePriority ( node_modules\spdy-transport\lib\spdy-transport\stream.js:305:18)
at Stream._handleFrame ( node_modules\spdy-transport\lib\spdy-transport\stream.js:128:10)
at Connection._handleFrame ( node_modules\spdy-transport\lib\spdy-transport\connection.js:324:12)
at Parser. ( node_modules\spdy-transport\lib\spdy-transport\connection.js:156:10)
at emitOne (events.js:115:13)
at Parser.emit (events.js:210:7)
at addChunk ( node_modules\readable-stream\lib_stream_readable.js:283:12)
at readableAddChunk ( node_modules\readable-stream\lib_stream_readable.js:270:11)
at Parser.Readable.push ( node_modules\readable-stream\lib_stream_readable.js:237:10)
at Parser.Transform.push ( node_modules\readable-stream\lib_stream_transform.js:146:32)
at next ( node_modules\spdy-transport\lib\spdy-transport\protocol\base\parser.js:53:12)
at node_modules\spdy-transport\lib\spdy-transport\protocol\http2\parser.js:72:5
at Parser.onPriorityFrame ( node_modules\spdy-transport\lib\spdy-transport\protocol\http2\parser.js:539:3)
at Parser.onFrameBody ( node_modules\spdy-transport\lib\spdy-transport\protocol\http2\parser.js:154:10)

@matthewp
Copy link

@misterfresh I have noticed that as well. My fix fixes some of the issues but the error can still happen if there is a PRIORITY frame and the node has already been removed. So it needs to check in that spot as well if the node is part of the tree.

@Jaeiya
Copy link

Jaeiya commented Feb 27, 2018

Is there a workaround for this?
I just loaded up my webapp in firefox and got this error. For some reason I do not get this error when opening in Chrome.

@misterfresh
Copy link
Author

Here's a temporary fix : in your project's main package.json add:

"scripts": {
    "postinstall": "node ./conf/quickfix.js"
}

and in the quickfix.js file :

let fs = require('fs')
let path = require('path')
let file = path.join(
    process.cwd(),
    'node_modules/spdy-transport/lib/spdy-transport/priority.js'
)

let data = fs
    .readFileSync(file)
    .toString()
    .split('\n')
if (data.length < 190) {
    data.splice(73, 0, '/*')
    data.splice(75, 0, '*/')
    data.splice(
        187,
        0,
        `
	var index = utils.binarySearch(this.list, node, compareChildren);
 	this.list.splice(index, 1);
`
    )
    let text = data.join('\n')

    fs.writeFile(file, text, function(err) {
        if (err) return console.log(err)
    })
}

now everytime you install spdy it will be patched if needed.

also node-http2 native is available, just not yet compatible with express

@Jaeiya
Copy link

Jaeiya commented Feb 27, 2018

Thanks for this.
Do you know when the native will be compatible with express?

@misterfresh
Copy link
Author

no... there is an issue on it but I dont think they have a date yet

@th3nate
Copy link

th3nate commented Apr 18, 2018

hello,
im experiencing the same issue,
although using node-spdy im getting the same error about the transport module with version 2.0.20
was this issue fixed in the newest version?

AssertionError [ERR_ASSERTION]: false == true
at PriorityNode.removeChild (/app/node_modules/spdy-transport/lib/spdy-transport/priority.js:74:3)
at PriorityNode.remove (/app/node_modules/spdy-transport/lib/spdy-transport/priority.js:62:15)
at Stream._handlePriority (/app/node_modules/spdy-transport/lib/spdy-transport/stream.js:305:18)
at Stream._handleFrame (/app/node_modules/spdy-transport/lib/spdy-transport/stream.js:128:10)
at Connection._handleFrame (/app/node_modules/spdy-transport/lib/spdy-transport/connection.js:324:12)
at Parser. (/app/node_modules/spdy-transport/lib/spdy-transport/connection.js:156:10)
at emitOne (events.js:116:13)
at Parser.emit (events.js:211:7)
at addChunk (/app/node_modules/readable-stream/lib/_stream_readable.js:284:12)
at readableAddChunk (/app/node_modules/readable-stream/lib/_stream_readable.js:271:11)
at Parser.Readable.push (/app/node_modules/readable-stream/lib/_stream_readable.js:238:10)
at Parser.Transform.push (/app/node_modules/readable-stream/lib/_stream_transform.js:146:32)
at next (/app/node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js:53:12)
at /app/node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js:72:5

UPDATE:
updated the pkg to 2.1.0 but still the issue exists.
so now I've reverted back to 2.0.20 and used the patch from the previous comment, ill share if it solved the issue.

if anyone has a better idea i'd greatly appreciate it,
thanks!

@wmertens
Copy link

How about just replacing the assert(index !== -1) with if (index === -1) return? Seems unsafe to let the function remove the last child from the list…

@vytautas-pranskunas-
Copy link

vytautas-pranskunas- commented Jul 18, 2018

Any progress on this one? Or SPDY package with 100k weekly downloads has ment to be used with hacks and memory leaks?

@mrbinky3000
Copy link

mrbinky3000 commented Sep 6, 2018

I suddenly started experiencing this issue with webpack and webpack-dev-server.

AssertionError [ERR_ASSERTION]: false == true
    at PriorityNode.removeChild (/Users/me/myproject/node_modules/spdy-transport/lib/spdy-transport/priority.js:74:3)
    at PriorityNode.remove (/Users/me/myproject/node_modules/spdy-transport/lib/spdy-transport/priority.js:62:15)
    at PriorityTree.add (/Users/me/myproject/node_modules/spdy-transport/lib/spdy-transport/priority.js:163:23)
    at Stream._initPriority (/Users/me/myproject/node_modules/spdy-transport/lib/spdy-transport/stream.js:101:25)
    at new Stream (/Users/me/myproject/node_modules/spdy-transport/lib/spdy-transport/stream.js:76:8)
    at Connection._createStream (/Users/me/myproject/node_modules/spdy-transport/lib/spdy-transport/connection.js:388:16)
    at Connection._handleHeaders (/Users/me/myproject/node_modules/spdy-transport/lib/spdy-transport/connection.js:436:21)
    at Connection._handleFrame (/Users/me/myproject/node_modules/spdy-transport/lib/spdy-transport/connection.js:319:10)
    at Parser.<anonymous> (/Users/me/myproject/node_modules/spdy-transport/lib/spdy-transport/connection.js:156:10)
    at emitOne (events.js:116:13)
    at Parser.emit (events.js:211:7)
    at addChunk (/Users/me/myproject/node_modules/readable-stream/lib/_stream_readable.js:291:12)
    at readableAddChunk (/Users/me/myproject/node_modules/readable-stream/lib/_stream_readable.js:278:11)
    at Parser.Readable.push (/Users/me/myproject/node_modules/readable-stream/lib/_stream_readable.js:245:10)
    at Parser.Transform.push (/Users/me/myproject/node_modules/readable-stream/lib/_stream_transform.js:148:32)
    at next (/Users/me/myproject/node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js:53:12)

Relevant dev dependencies

    "webpack": "^4.16.0",
    "webpack-bundle-analyzer": "^2.9.1",
    "webpack-cli": "^3.0.8",
    "webpack-combine-loaders": "^2.0.3",
    "webpack-dev-middleware": "^3.1.3",
    "webpack-dev-server": "^3.1.7",
    "webpack-merge": "^4.1.1",

Started happening after I updated to Google Chrome 69.0.3497.81. Trying Firefox as a work around, but would really like to be able to use Chrome.

@jordibartolome
Copy link

jordibartolome commented Sep 7, 2018

Same problem here when updating to Chrome 69

assert.js:85
  throw new assert.AssertionError({
  ^
AssertionError: false == true
    at PriorityNode.removeChild (/Users/jordi/Work/webapp/client/node_modules/spdy-transport/lib/spdy-transport/priority.js:74:3)
    at PriorityNode.remove (/Users/jordi/Work/webapp/client/node_modules/spdy-transport/lib/spdy-transport/priority.js:62:15)
    at PriorityTree.add (/Users/jordi/Work/webapp/client/node_modules/spdy-transport/lib/spdy-transport/priority.js:163:23)
    at Stream._initPriority (/Users/jordi/Work/webapp/client/node_modules/spdy-transport/lib/spdy-transport/stream.js:101:25)
    at new Stream (/Users/jordi/Work/webapp/client/node_modules/spdy-transport/lib/spdy-transport/stream.js:76:8)
    at Connection._createStream (/Users/jordi/Work/webapp/client/node_modules/spdy-transport/lib/spdy-transport/connection.js:388:16)
    at Connection._handleHeaders (/Users/jordi/Work/webapp/client/node_modules/spdy-transport/lib/spdy-transport/connection.js:436:21)
    at Connection._handleFrame (/Users/jordi/Work/webapp/client/node_modules/spdy-transport/lib/spdy-transport/connection.js:319:10)
    at Parser.<anonymous> (/Users/jordi/Work/webapp/client/node_modules/spdy-transport/lib/spdy-transport/connection.js:156:10)
    at emitOne (events.js:96:13)
    at Parser.emit (events.js:188:7)
    at addChunk (/Users/jordi/Work/webapp/client/node_modules/readable-stream/lib/_stream_readable.js:284:12)
    at readableAddChunk (/Users/jordi/Work/webapp/client/node_modules/readable-stream/lib/_stream_readable.js:271:11)
    at Parser.Readable.push (/Users/jordi/Work/webapp/client/node_modules/readable-stream/lib/_stream_readable.js:238:10)
    at Parser.Transform.push (/Users/jordi/Work/webapp/client/node_modules/readable-stream/lib/_stream_transform.js:146:32)
    at next (/Users/jordi/Work/webapp/client/node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js:53:12)

@jordibartolome
Copy link

jordibartolome commented Sep 7, 2018

The solution that @misterfresh posted on Feb 27th seems to fix it!

@limbosounds
Copy link

limbosounds commented Sep 10, 2018

Due to this issue WDS is falling every 10-20 minutes. Madness.
Confirming that this appeared after I upgraded my Chrome to 69.

@eyz
Copy link

eyz commented Sep 10, 2018

I only started seeing this after upgrading to Chrome 69 as well; same NPMs, same NodeJS version as before it was happening

@rathpc
Copy link

rathpc commented Sep 11, 2018

I also experienced this issue with the following config:

Operating System: macOS Sierra (10.12.6)
Node Version: 8.11.2
NPM Version: 6.1.0
webpack Version: 2.7.0
webpack-dev-server Version: 2.11.2

I am using the patch fix mentioned by @misterfresh with some additional logic until an official fix is released.

@wmertens
Copy link

is there anybody maintaining a forked npm package with the fix applied?

@eyz
Copy link

eyz commented Sep 12, 2018

The #47 (comment) fix is working well for me; no crashes from Chrome 69 clients after applying that. It would be nice to see this reviewed by the spdy-http2 folks and given priority as soon as possible. Does anyone have this fix as a PR to this project already?

@misterfresh have you submitted this fix already as a PR to this project? Is there anything blocking you from doing so, if not already submitted?

@johntran
Copy link

@diasdavid is looking for maintainers for this repo and the org in general: spdy-http2/node-spdy#339

@eyz
Copy link

eyz commented Sep 13, 2018

Sorry to be slightly off-topic, but I just got this stack trace today, and thus I am no longer using the spdy NPM due to the error from the OP as well as this new one today. Should I create a new issue for this one? Is this related to the Chrome 69 compatibility we've been discussing, or something else?

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: Stream write aborted
    at /opt/cde/node_modules/spdy-transport/lib/spdy-transport/stream.js:141:16
    at process._tickCallback (internal/process/next_tick.js:61:11)
Emitted 'error' event at:
    at Stream.onStreamError (/opt/cde/node_modules/spdy/lib/spdy/handle.js:110:18)
    at Stream.emit (events.js:182:13)
    at Stream.EventEmitter.emit (domain.js:442:20)
    at onwriteError (/opt/cde/node_modules/readable-stream/lib/_stream_writable.js:449:12)
    at onwrite (/opt/cde/node_modules/readable-stream/lib/_stream_writable.js:470:11)
    at WritableState.onwrite (/opt/cde/node_modules/readable-stream/lib/_stream_writable.js:180:5)
    at /opt/cde/node_modules/spdy-transport/lib/spdy-transport/stream.js:239:23
    at /opt/cde/node_modules/spdy-transport/lib/spdy-transport/stream.js:141:7
    at process._tickCallback (internal/process/next_tick.js:61:11)

@thisVioletHydra
Copy link

  • v10.11.0:
  • MSYS_NT-10.0 macOS 2.10.0(0.325/5/3) 2018-06-13 23:34 x86_64 Msys (it`s WINDOWS x64):
  • Subsystem:
[04:04:30] AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert(index !== -1)

    at PriorityNode.removeChild (D:\FRONTEND\www\company-m4leads-com\node_modules\spdy-transport\lib\spdy-transport\priority.js:74:3)
    at PriorityNode.remove (D:\FRONTEND\www\company-m4leads-com\node_modules\spdy-transport\lib\spdy-transport\priority.js:62:15)
    at PriorityTree.add (D:\FRONTEND\www\company-m4leads-com\node_modules\spdy-transport\lib\spdy-transport\priority.js:163:23)
    at Stream._initPriority (D:\FRONTEND\www\company-m4leads-com\node_modules\spdy-transport\lib\spdy-transport\stream.js:101:25)
    at new Stream (D:\FRONTEND\www\company-m4leads-com\node_modules\spdy-transport\lib\spdy-transport\stream.js:76:8)
    at Connection._createStream (D:\FRONTEND\www\company-m4leads-com\node_modules\spdy-transport\lib\spdy-transport\connection.js:388:16)
    at Connection._handleHeaders (D:\FRONTEND\www\company-m4leads-com\node_modules\spdy-transport\lib\spdy-transport\connection.js:436:21)
    at Connection._handleFrame (D:\FRONTEND\www\company-m4leads-com\node_modules\spdy-transport\lib\spdy-transport\connection.js:319:10)
    at Parser.<anonymous> (D:\FRONTEND\www\company-m4leads-com\node_modules\spdy-transport\lib\spdy-transport\connection.js:156:10)
    at Parser.emit (events.js:182:13)
    at Parser.EventEmitter.emit (domain.js:460:23)
    at addChunk (D:\FRONTEND\www\company-m4leads-com\node_modules\readable-stream\lib\_stream_readable.js:291:12)
    at readableAddChunk (D:\FRONTEND\www\company-m4leads-com\node_modules\readable-stream\lib\_stream_readable.js:278:11)
    at Parser.Readable.push (D:\FRONTEND\www\company-m4leads-com\node_modules\readable-stream\lib\_stream_readable.js:245:10)
    at Parser.Transform.push (D:\FRONTEND\www\company-m4leads-com\node_modules\readable-stream\lib\_stream_transform.js:148:32)
    at next (D:\FRONTEND\www\company-m4leads-com\node_modules\spdy-transport\lib\spdy-transport\protocol\base\parser.js:53:12)

hello, i coding new site, after update or update same modules, i not understand, my watch started to break and throw an error.
a week ago this was not, I use for http2 spdy, gulp, webpack.
If you need any further information I can provide.

What causes the error? After every 10-15 minutes coding site there is such a bug, without a clue how this happens.

@pcnate
Copy link

pcnate commented Oct 2, 2018

Same issue on Debian Linux. Same version of spdy-http2. I am using socket.io/socket.io-client with redbird proxy.

@ivnmaksimovic
Copy link

Do not use Chrome Canary or new Chrome. I downgraded to Chrome 67 and I can develop without the watcher breaking all the time.

@jordibartolome
Copy link

jordibartolome commented Oct 4, 2018

Do not use Chrome Canary or new Chrome. I downgraded to Chrome 67 and I can develop without the watcher breaking all the time.

This is probably the worst reply I've read in time 😂
This is not "a bug" in chrome fixed in a specific version, this has been like this for the last 2 stable versions, so you cannot hold the old Chrome version forever.

@ivnmaksimovic
Copy link

@jordibartolome I am just referring to those having issue with webpack watch, that constantly breaks with "assert(index !== -1)" in spdy-transport\lib\spdy-transport\priority.js:74:3". I am not trying to contribute in fixing this issue. It's just a workaround for me, to be able to keep working on a project without having to rebuild every few minutes. It might help someone.

@pcnate
Copy link

pcnate commented Oct 4, 2018

@ivnmaksimovic a work around was posted above using a post install script
#47 (comment)

@nihlton
Copy link

nihlton commented Oct 8, 2018

i've got the work around working - and thats great.

any word on this being fixed properly?

@pcnate
Copy link

pcnate commented Oct 9, 2018

@nihlton #57 looks to fix the issue. Hopefully someone can get this confirmed and merged soon

@mlncstr
Copy link

mlncstr commented Oct 12, 2018

Could this also potentially affect pre-flight OPTIONS requests?

Getting this on a client's site when attempting an API call to Azure:
ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY

jianjunz pushed a commit to open-webrtc-toolkit/owt-client-javascript that referenced this issue Oct 15, 2018
…pdy-http2/spdy-transport#47

Change-Id: Ib5f495ecf82f5b7c667c08e699b2c4ca2aab721b
Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/190589
Tested-by: webrtctest <webrtctest@intel.com>
Reviewed-by: Zhu, Jianjun <jianjun.zhu@intel.com>
@intafon
Copy link

intafon commented Oct 15, 2018

Also using Chrome 69 -- ran @misterfresh 's patch, but still keeps crashing. . . anyone have any luck with any other fix patch?

EDIT: not sure what changed from my original attempt, but I have noticed that with this patch the crashing occurs much less often (maybe once a day as opposed to on nearly every edit before, so disregard my original comment. ;-)

jianjunz pushed a commit to open-webrtc-toolkit/owt-client-javascript that referenced this issue Oct 19, 2018
…pdy-http2/spdy-transport#47

Change-Id: Ib5f495ecf82f5b7c667c08e699b2c4ca2aab721b
Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/190589
Tested-by: webrtctest <webrtctest@intel.com>
Reviewed-by: Zhu, Jianjun <jianjun.zhu@intel.com>
@preeti-tm
Copy link

I got the same error.

image

@Grantlyk
Copy link

Grantlyk commented Nov 2, 2018

Hey i've now started getting this error randomly today in my project, has anyone merged in a PR or got a release that fixes this issue?

@preeti-tm
Copy link

This solution #57 is working in my case

@jacobheun
Copy link
Contributor

New versions of spdy (4.0.0) and spdy-transport (3.0.0) include this fix.

@odinho
Copy link

odinho commented Nov 8, 2018

Awesome, opened a pull request for webpack-dev-server: webpack/webpack-dev-server#1563

@benlind
Copy link

benlind commented Nov 30, 2018

If you are using yarn and want this fix for webpack-dev-server, add this to your package.json:

"resolutions": {
  "webpack-dev-server/**/spdy-transport": "^3.0.0"
}

Then run yarn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests