calzoneman / sync

Node.JS Server and JavaScript/HTML Client for synchronizing online media
Other
1.47k stars 232 forks source link

Content not displayed on Safari #437

Closed frenchja closed 9 years ago

frenchja commented 9 years ago

Content for videoplayer and MOTD render on Firefox 35 and Chrome 41, but not in Safari. Occurs with latest origin/3.0, not noticed in previous commits. Reading the FAQ, it does appear to be a websocket issue why could it be specific to one browser? I also checked the sys.log and the server appears to be accepting socket connections fine.

OS: Mavericks 10.9.5 Safari: 7.1.3 Flash enabled. Javascript enabled. Extensions disabled.

calzoneman commented 9 years ago

What are the contents of the MOTD and what is the video being played?

calzoneman commented 9 years ago

Also, I could use some clarification: it is only the MOTD and the video that don't display? On Safari, you can connect and see the user list, playlist, chat, etc.?

frenchja commented 9 years ago

Text and an linked imgur image in the MOTD. The video is an RTMP stream. No, you cannot see the user list and playlist. You can see the chat window and Guest Login prompt but you can't login.

calzoneman commented 9 years ago

Ok, well then the MOTD and the video are irrelevant, because you're not even connected.

You can try clearing your cache (not sure how to do this on Safari, it's Ctrl+F5 on Firefox).

frenchja commented 9 years ago

It does seem that I'm logged in, and displays a connect alter in green. I'm going to try to directly connect rather than piping it through Varnish. Perhaps I didn't setup websocket correctly and Firefox is simply more tolerant?

calzoneman commented 9 years ago

The "logged in as foo" message is rendered by the webserver, so that would be there regardless of whether the socket is connected.

The connect event triggers the green connected message to appear, but it's possible some other error is occurring after that which breaks it. Try opening the javascript console and checking for any error messages. You can also edit www/js/callbacks.js and set SOCKET_DEBUG = true to log any CyTube messages sent to the socket in the console.

calzoneman commented 9 years ago

Also, I'm confused why you're even using varnish to begin with

Unless you've forked CyTube into some kind of distributed service with multiple thousands of users, I don't think the performance of the webserver is going to be an issue. Even then, based on my analysis most of the load from high user volume comes from chat filters and logging I/O, not the webserver. The only time CyTube's webserver has gotten so overloaded that it crashed was when I got an inbound DDoS of several thousand POST requests per second, exploiting a 0 day in the qs moule.

frenchja commented 9 years ago

I use Varnish to cache other sites that don't minify and set browser caches. It's just easier since port 80 already serves other virtual hosts using Varnish.

calzoneman commented 9 years ago

Can you take a look at /sioconfig and see what the IO_URL is? I'm assuming you're not running socket.io through varnish.

Do you have both an A (IPv4) and AAAA (IPv6) record for your subdomain?

calzoneman commented 9 years ago

@frenchja If it only recently started happening, it could be because of a socket.io update (assuming you ran npm update). If it's a fresh install then I would need to check your config, but otherwise it would be helpful to see error console output in Safari

frenchja commented 9 years ago

Just an IPv4 record.

var IO_URLS={"ipv4-nossl":"http://subdomain.domain.club:1337","ipv4-ssl":"","ipv6-nossl":"","ipv6-ssl":""},IO_URL="http://subdomain.domain.club:1337",IO_V6=!1;

Is there a way to test that port 1337 is correctly being passed? My firewall and nmap both report the port is open.

sys.log reports a connection using Safari:

[Tue Feb 10 2015 21:11:00] Accepted socket from 165.*.*.*
[Tue Feb 10 2015 21:11:00] 165.*.*.* logged in as *
[Tue Feb 10 2015 21:11:09] Unloading channels
calzoneman commented 9 years ago

IO_URLS looks right, and based on the connection being logged, the socket is connecting. My guess would be that something is causing an exception in the clientside javascript, causing it to bail out of handling events correctly.

Can you please open the browser's JS console and screenshot it? If there's nothing interesting being logged, change SOCKET_DEBUG = false to SOCKET_DEBUG = true in www/js/callbacks.js and try again. You can also join IRC if you have time so we can work through this issue a little quicker.

calzoneman commented 9 years ago

As discussed in IRC, this appears to be an issue specific to the varnish configuration, not with CyTube itself. If there is some problem with CyTube related to the safari problem, I will reopen this.

calzoneman commented 9 years ago

Adding a note here for reference: The underlying issue is actually https://github.com/Automattic/socket.io/issues/2000