Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

6.4.0 Version crashes with error Cannot read property 'subscriptions' of undefined #633

Closed
olaf89 opened this issue Mar 1, 2019 · 6 comments · Fixed by trufflesuite/ganache#385

Comments

@olaf89
Copy link

olaf89 commented Mar 1, 2019

Current Behavior

After updating ganache from 6.2.5 to 6.4.0 while running tests its crashing with error "Cannot read property 'subscriptions' of undefined".

TypeError: Cannot read property 'subscriptions' of undefined
node_modules/ganache-cli/build/ganache-core.node.cli.js:130:151516

looking at code its
https://github.com/trufflesuite/ganache-core/blob/e17046e16d41e8a758cbebb13d8a98fb0c7795d3/lib/webSocketServer.js#L102

I think its the similar to trufflesuite/ganache#213

@davidmurdoch
Copy link
Member

@olaf89 Thanks for letting us know. I'll do another release later today to fix this!

@olaf89
Copy link
Author

olaf89 commented Mar 2, 2019

Thanks for such a fast fix, i tested new version and previous issue is gone but its still sometimes fails in another place.

Here is a line which fails:
https://github.com/trufflesuite/ganache-core/blob/5877f32e212a6408afc47cc7ac89d92802b1f0f0/lib/webSocketServer.js#L87

@davidmurdoch
Copy link
Member

Thanks @olaf89 for testing so quickly! I've got a new branch of ganache-core that refactors our webSocketServer here that should gaurd against all of these kinds of failures: https://github.com/trufflesuite/ganache-core/tree/websocket-refector (please excuse the "refector" typo... it was as late night :-D )

I'm curious what you testing code looks like. Are you using Truffle? This bug is triggered if something closes the webSocketServer connection while simultaneously calling eth_subscribe and/or eth_unsubscribe.

@olaf89
Copy link
Author

olaf89 commented Mar 2, 2019

I am running e2e tests where dev server and ui are using ganache-cli over websockets. I am not using truffle. I do snapshot revert and reset connection in between tests so probably thats the reason. If you would like me test for any version let me know.

@olaf89
Copy link
Author

olaf89 commented Mar 18, 2019

I created a pr to fix this issue. If you could please take a look and let me know if that is ok or how it should behave in this scenario. I think maybe it would be better when the server would return some kind of error.

@olaf89
Copy link
Author

olaf89 commented Mar 27, 2019

Could someone give me feedback about my pr? trufflesuite/ganache#385 I tested it on my app and it solved the problem. At the moment i have to use forked cli so it would be awsome if this issue could be solved.

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

Successfully merging a pull request may close this issue.

2 participants