-
-
Notifications
You must be signed in to change notification settings - Fork 308
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
Connection object is null #121
Comments
The log message for "null" is always preceded by something that looks like
|
"unfinished" means that websockets are actually working (the http connection under websockets is actually "unfinished"). anything else for that url is a wrong answer. Are you sure your load balancer can do websockets? |
I also have that issue but in a very rare cases (2 times on my mind, running server 6-12mo)
Error:
System: |
Hi, there was no load balancer involved, and most of the time the websocket will connect properly and my app will work. But we still get these 'null' connection objects pretty frequently (much more than Eugeny's sample above... this is a very simple chat app, just a few lines of code). |
We also do not have load balancer yet. |
+1 |
Looking at the code, it is not obvious how this could happen. I need help with reproduction steps in order to fix this bug. |
Closing due to inactivity. |
doesn't sound very inactive, i would assume the error was still happening but now i'm using Go and websockets or something |
@domino14 Inactive in the sense that I asked for help reproducing almost 4 years ago and no one responded. If someone can provide a reproduction case, or even debug logs of this happening, it would be incredibly helpful. Issues where the reporter and/or community are not actively working with me to get them fixed will be closed. I prefer to work with folks willing to put in some effort to get their issues fixed. This library and my time is provided for free. You cannot just file an issue, disappear, and expect it to get fixed. |
This appears to currently be happening with Meteor in production settings. I sadly don't have a reproduction, but it now seems somewhat more urgent, and a reproduction is more in reach. See this issue: meteor/meteor#10468 |
I have also experienced it in production. It manifested for us when we went from node version 10.15.0 to 12.15.0. Sadly I don't know how to reproduce it. I'll use a work-around similar to what Meteor is doing. |
While I realize this bug is closed, I do want to let you know this issue does happen to us. We are unable to replicate as it happens completely randomly. We also notice it only happens when running on AWS EC2 servers using Node 12.16.2. It's likely doing it on other versions of Node, as noted in the above cases, however, we wanted to make that distinction. We have several other servers on REHL 6 where this issue doesn't happen. For now we're just going to use the below code:
|
- This appears to fix a hard to figure out bug. - Sometimes the `sockjs` 'connection' event would be called with `null` argument, which would crash `gridsome develop`. - I have not been able to debug it any further, or come up with a test which proves that the issue is now fixed. - There is a related bug from Sockjs-node: sockjs/sockjs-node#121 - The error that used to appear always appeared like the following: ``` Site running at: - Local: http://localhost:8080/ - Network: http://192.168.1.134:8080/ Explore GraphQL data at: http://localhost:8080/___explore /Users/myuser/work/playground/mysite/gridsome-site/node_modules/gridsome/lib/server/Server.js:110 this._app.clients[connection.id] = connection ^ TypeError: Cannot read property 'id' of null at Server.<anonymous> (/Users/myuser/work/playground/mysite/gridsome-site/node_modules/gridsome/lib/server/Server.js:110:38) at Server.emit (events.js:210:5) at App.emit (/Users/myuser/work/playground/mysite/gridsome-site/node_modules/sockjs/lib/sockjs.js:196:29) at /Users/myuser/work/playground/mysite/gridsome-site/node_modules/sockjs/lib/transport.js:111:25 at processTicksAndRejections (internal/process/task_queues.js:75:11) ``` I have a Gridsome installation with tons of markdown files. It will happen approx 50% of the times I run `gridsome develop`. I am happy if this PR is just closed as I realise this isn't a great PR, there are no tests and no way to prove that this actually fixed anything. But since I have had this change in place, `gridsome develop` doesn't crash and I can use it without errors. If anything I hope that this will appear on Google and it might lead others to a nicer solution.
Apparently there is an unidentified bug in SocketJS whereby the connection object received in the 'connection' event handler is sometimes null. This has started to happen to us when we upgraded to Node v14 (from v10) and it has happened in production a few times already causing the entire server to collapse. Please see sockjs/sockjs-node#121 and also webpack/webpack-dev-server@7964997 where webpack-dev-server implements a similar fix.
Apparently there is an unidentified bug in SockJS whereby the connection object received in the 'connection' event handler is sometimes null. Refs: sockjs/sockjs-node#121 Refs: webpack/webpack-dev-server@79649971c2
I see this many times a day in the logs. The relevant snippet of my code looks like this:
The text was updated successfully, but these errors were encountered: