Error: invalid data
-
So I'm reading threads on an iPad. I see a post I like, hit like and boom, get that toasty sucker in the corner.
Fine, I reload the page, hit like.
Now if this were occasional I could chalk it up to shitty session handling, but this has now happened three times in the last hour, and I've been logged in the whole time.
Safari, iOS 9.3.2, iPad Air 2.
-
Seems to be related to the WebSockets shitting themselves if I switch tabs, switch apps, or do crazy things like let my internet connection drop due to, say, the questionable connectivity courtesy of Southern Fucking Railway, whose management can FOADIAF, or if I just breathe.
If only there were a way to make Asynchronous connections in JavaScript and get an out of band response in something like XML (but does not have to explicitly be XML, this is just an example)
-
@Arantor any idea of why they use this websckets crap?
-
@fbmac in theory it's less work on the server than polling every few seconds. In practice it would be if the connection were stable. Except it really isn't that stable, even on wifi.
-
@Arantor doesn't push, aka long polling solve that?
-
@fbmac Long polling is a hack to simulates push and is expensive for the browser. Web sockets need to keep the connection open between the server and the browser, it is expensive for the server rather than the browser.
-
@lucas1 last time I checked long polling and push were the same.
it's expensive for the server because it keeps an open connection
-
@fbmac not on Node, it can idle the connection, cheaply. If it can keep it open, then push to it, job done.
-
@fbmac said in Error: invalid data:
it's expensive for the server because it keeps an open connection
Yeah, so expensive to keep those few bytes of memory in memory. Much less expensive if you create a new connection once a second to download nothing.
-
@ben_lubar it cost something in routers to keep hundreds of connections open.
I don't know the limits routers use, but one isp used to have a maximum of 30 in the contract
-
@fbmac said in Error: invalid data:
hundreds of connections open
Oh wow, hundreds of connections. I can't imagine how a web server could possibly spare hundreds of hundreds of bytes for serving users on a website. There's no way there's 10kb of memory free on the server.
-
@fbmac No long polling is not push, because the browser is making the request aka it is pulling still from the server. It is good enough to simulate push and is a good hack, however websockets are push.
-
@ben_lubar There are only so many connections a server can keep open, it isn't about memory consumption.
-
@lucas1 said in Error: invalid data:
There are only so many connections a server can keep open
And what part of the server's hardware does a connection use up if it's not memory?
-
@ben_lubar If you have too many, you need to get a machine with a bigger case.
Duh.
-
@ben_lubar I was talking about routers, not servers.
-
@ben_lubar It ultimately depends on the server side stack being used but you can run out of threads on IIS. I assume this is similar for other frameworks and server side technologies.
If lots of clients use HTTP keepalives and the web server has a concurrency limit or scalability problem, then performance plummets once that limit is reached.
Basically you have to have the right server side infrastructure in place to scale, so while you won't have problems on small forums with light traffic, if you have millions of users (yes I have worked at places that have millions of users) you have to make sure your infrastructure can deal with it.
We had to use long polling because the technology we were using didn't support websockets without a major overhaul and it really wasn't worth upgrading.
-
@fbmac said in Error: invalid data:
last time I checked long polling and push were the same.
Nope.
Long polling is a really, really, really long timeout request which is essentially susceptible to the the same concerns as websockets. If the connection dies, long polling falls over too. It also uses more battery power and network connectivity. Long polling is real-time though.
Push (at least the common implementation without websockets) is more along the lines of "Client pings the server every {x} {timePeriod} and gets new data". Which is not real-time, but is much lighter load.
Websockets are (ideally) much better, since they allow the server to ping the client instead of vice-versa. So you theoretically get the benefits of both.
Why NodeBB doesn't gracefully handle disconnects? No idea...
-
@arantor does this happen on a laptop too? I'd be curious where exactly it's falling over (and where it's lacking some kind of protection from this exact issue, I'm fairly sure that's why socket.io exists after all.......)
-
@sloosecannon said in Error: invalid data:
Why NodeBB doesn't gracefully handle disconnects? No idea...
if you delete a nodebb instance you keep getting socket.io requests from bots months after the fact.
the same happens with discourse anyway
-
@fbmac said in Error: invalid data:
@sloosecannon said in Error: invalid data:
Why NodeBB doesn't gracefully handle disconnects? No idea...
if you delete a nodebb instance you keep getting socket.io requests from bots months after the fact.
the same happens with discourse anyway
Which has nothing to do with the discussion at hand? Stupid bots are stupid :)
-
@Arantor said in Error: invalid data:
or do crazy things like let my internet connection drop
I had a tweet once along the lines of "Things a Single Page App can't do: work if your wifi drops for even a moment". But I can't find it, because Twitter search sux.
But I did find these:
-
@Lorne-Kates said in Error: invalid data:
I had a tweet once along the lines of "Things a Single Page App can't do: work if your wifi drops for even a moment". But I can't find it, because Twitter search sux.
Things @Lorne-Kates can't do:
- read@Lorne-Kates said in Error: invalid data:
-
@anotherusername said in Error: invalid data:
@Lorne-Kates said in Error: invalid data:
I had a tweet once along the lines of "Things a Single Page App can't do: work if your wifi drops for even a moment". But I can't find it, because Twitter search sux.
Things @Lorne-Kates can't do:
- read@Lorne-Kates said in Error: invalid data:
Huh. Thought I made a dedicated tweet for that.
.... i mean it was a TEST to see if YOU CAN READ. Congratulations, you pass.
-
@sloosecannon yes this was happening on my laptop, even on wifi.
-
@sloosecannon said in Error: invalid data:
Why NodeBB doesn't gracefully handle disconnects? No idea...
Presumably because there's nothing to detect that the socket has gone. When a socket ceases to work because the network infrastructure as vanished (at any point between the client and the terminating server process) you won't get a notification or event at all. Neither the server nor the client can possibly know that things between have decided to pine for the fjords. Typically, you only get that sort of thing if traffic actually fails to get through; the usual case is a failure to connect (which is what the OSes optimise for doing well at telling you about) but if enough untransferred packets build up, you'll get told about that too.
The “right” fix is to send some sort of ping regularly (though not a real ping; it has to be an application-level request as it needs to be routed through the whole layered network stacks to detect problems right) and to kill the (web)socket if that message doesn't get back to you in a reasonable amount of time. Of course, there's a down side too. It's expensive in terms of network activity, and so will drain mobile device batteries quickly.
Did you know, if the network comes back up and you get the same IP address (very unlikely with public wifi, especially if there's a captive portal in use) then there's a reasonable chance that the network connection will just resume working. It's the way that the internet is supposed to work. It's just that things mostly don't happen that way so much now…
-
@dkf said in Error: invalid data:
The “right” fix is to send some sort of ping regularly
Like maybe just every time the user performs an "upvote" command?
kill the (web)socket if that message doesn't get back to you in a reasonable amount of time
Instead of error messaging the user about it crashing and burning, you mean?
Crazy talk.
-
@dkf said in Error: invalid data:
Presumably because there's nothing to detect that the socket has gone. When a socket ceases to work because the network infrastructure as vanished (at any point between the client and the terminating server process) you won't get a notification or event at all.
tcp will inform you of a disconnection. what is this thing using? udp?
-
@fbmac said in Error: invalid data:
@dkf said in Error: invalid data:
Presumably because there's nothing to detect that the socket has gone. When a socket ceases to work because the network infrastructure as vanished (at any point between the client and the terminating server process) you won't get a notification or event at all.
tcp will inform you of a disconnection. what is this thing using? udp?
TCP only notifies you of a disconnection if you have a way to get that information when it disconnects. Putting your computer into sleep mode while still connected doesn't do that.
-
@ben_lubar when you try to read or write the connection it will fail
-
@dkf said in Error: invalid data:
Did you know, if the network comes back up and you get the same IP address (very unlikely with public wifi, especially if there's a captive portal in use) then there's a reasonable chance that the network connection will just resume working. It's the way that the internet is supposed to work. It's just that things mostly don't happen that way so much now…
Yup, most noticeable when re-patching your local network. Though note if you unplug the network cable from a windows computer it will immediately terminate all network connections on that interface.
-
@PleegWat now I'm not sure if it's normally possible to not a read in a lost tcp connection keep going if you lost all packets that closed it
-
@fbmac Well a normal close is two FIN/FINACK pairs, so you can't miss it since you sent two of the four packets. A reset you could miss though, or the connection could just vanish (because the other peer crashed, or something happened in the network in between). In those cases a time-out applies, which is usually a few minutes.
-
@PleegWat I wanted so much to set my timeout defaults to much lower values in my machine's network stack
-
@fbmac If you like horrible experiences on all kinds of chats, VPNs, etc, don't let me stop you.
-
@PleegWat mostly the connection timeout, not so much on resets
when you try to connect to the wrong thing and the software pauses for a long long time, I hate that
-
@dkf said in Error: invalid data:
there's a reasonable chance that the network connection will just resume working.
Which is really handy if your dumbass laptop manufacturer put AIRPLANE MODE on your F12 unless you hold down "function".
-
-
@dkf said in Error: invalid data:
The “right” fix is to send some sort of ping regularly (though not a real ping; it has to be an application-level request as it needs to be routed through the whole layered network stacks to detect problems right) and to kill the (web)socket if that message doesn't get back to you in a reasonable amount of time. Of course, there's a down side too. It's expensive in terms of network activity, and so will drain mobile device batteries quickly.
Okay, let me see if I follow here.
Pull notifications are bad. We don't want them.
Push notifications are good (unspoken: because Apple). We want them.
So we'll open a buggy, network-error prone connection based on an unfinished RFC. I can't be arsed to hunt down if Web Sockets sends "Keep Alives" or anything similar, but I assume there has to be some "keep alive" communication going on. (If no, wow what a piece of shit).
But since this fang-spanking networking protocol is so super awesome that it doesn't have a protocol for when the network vanishes-- we should manually send "keep alive" pings across the network at regular intervals to check for connectivity.
So we just inner-platformed pull requests on a not-quite-push-request protocol that was only invented to eliminate pull requests (but did it so poorly that it needs this hack).
-
@Lorne-Kates said in Error: invalid data:
Push notifications are good (unspoken: because Apple).
Does that come from Apple? I remember when the first iPhone came out one of the criticisms was that it polled for new emails but existing smartphone OSes like WinMo had push for them. Another case of Apple RDF?
-
@Lorne-Kates you forgot that this is 2016, high speed, high availability networks are ubiquitous and this isn't a problem.
It's our fault for having shitty networks and aren't tied to desks with long cables that never break the connection.
I didn't think I'd get through that with a straight face.
-
@Lorne-Kates said in Error: invalid data:
Pull notifications are bad. We don't want them.
Push notifications are good (unspoken: because Apple). We want them.Reality: both suck, and will continue to do so because reality has real suckage in this area.
So we just inner-platformed pull requests on a not-quite-push-request protocol that was only invented to eliminate pull requests (but did it so poorly that it needs this hack).
Yep. It has to go inside the outer platform or you can miss things. And it's totally about reinventing the wheel, but this time with 4 sides! (I'm looking forward to when someone routes WebSockets over BLOAT…)
-
Just got that bug.
On a PC that is connected via Ethernet.
-
@aliceif Well yeah. The nodeBB server end is a pile of poo that keeps dropping, and the client end makes no attempt to handle things gracefully. People say “oh, there's a library for this” but either it's not being used or it is being used wrong.
-
@Arantor said in Error: invalid data:
@Lorne-Kates you forgot that this is 2016, high speed, high availability networks are ubiquitous and this isn't a problem.
It's our fault for having shitty networks and aren't tied to desks with long cables that never break the connection.
I didn't think I'd get through that with a straight face.
:oscar:
-
@Lorne-Kates said in Error: invalid data:
@Arantor said in Error: invalid data:
@Lorne-Kates you forgot that this is 2016, high speed, high availability networks are ubiquitous and this isn't a problem.
It's our fault for having shitty networks and aren't tied to desks with long cables that never break the connection.
I didn't think I'd get through that with a straight face.
:oscar:
:oscar: or :oscar:?
-
@ben_lubar There's a difference?
-
@coderpatsy :oscar: wins :Emmys:.
-
@ben_lubar said in Error: invalid data:
TCP only notifies you of a disconnection if you have a way to get that information when it disconnects. Putting your computer into sleep mode while still connected doesn't do that.
Unless
-
@fbmac said in Error: invalid data:
@ben_lubar when you try to read or write the connection it will fail
Which is exactly what's happening here?