102

I've got a browser game and I have recently started adding audio to the game.

Chrome does not load the whole page and gets stuck at "91 requests | 8.1 MB transferred" and does not load any more content; and it even breaks the website in all other tabs, saying Waiting for available socket.

After 5 mins (exactly) the data are loaded.

enter image description here

enter image description here

This does not happen on any other browser.

Removing one MP3 file (the latest added one) fixed the problem, so is it perhaps a data limit problem?

Community
  • 1
  • 1
Foxhoundn
  • 1,717
  • 2
  • 13
  • 17
  • 1
    Did you file or find a bugreport for this? We are seeing exactly same behavior (need to check if the # of requests or transfered bytes matched but otherwise the behavior and error matches exactly) – Jan Jun 19 '14 at 07:13
  • 1
    This looks like a known issue - see https://code.google.com/p/chromium/issues/detail?id=324653 Have a look into https://code.google.com/p/chromium/issues/detail?id=324653 what's exactly happening. But if you are hitting a limit of opened sockets then actually even other browsers have limit on number of connections to a single domain. You have two options - either make sure that you have just few simultaneous requests active (serialize them; do not paralelize); or split your server to subdomains and issue requests to different subdomains. – Jan Jun 20 '14 at 06:31
  • 5
    Niche case, but if you've recently restarted Chrome and have multiple tabs open to a server that requires basic HTTP authentication, you may get these errors because one of your background tabs has popped an authentication dialog. Check all other open tabs for the site in question, login as necessary, and see if the problem is resolved. – Nathaniel Heinrichs Mar 23 '16 at 04:50
  • Anyone know what extension this is to track this data he provided in the screenshot? – AlexioVay Feb 02 '17 at 06:17
  • @Vay that's the built-in console of Chrome. – Foxhoundn Feb 03 '17 at 07:44
  • 2
    @NathanielHeinrichs +1 for the "niche case" which has been bugging me for the last 2 weeks. It's exactly what's been happening to me, and now I know why! Thanks. – Marcus Mar 27 '17 at 11:16

6 Answers6

150

Explanation:

This problem occurs because Chrome allows up to 6 open connections by default. So if you're streaming multiple media files simultaneously from 6 <video> or <audio> tags, the 7th connection (for example, an image) will just hang, until one of the sockets opens up. Usually, an open connection will close after 5 minutes of inactivity, and that's why you're seeing your .pngs finally loading at that point.

Solution 1:

You can avoid this by minimizing the number of media tags that keep an open connection. And if you need to have more than 6, make sure that you load them last, or that they don't have attributes like preload="auto".

Solution 2:

If you're trying to use multiple sound effects for a web game, you could use the Web Audio API. Or to simplify things, just use a library like SoundJS, which is a great tool for playing a large amount of sound effects / music tracks simultaneously.

Solution 3: Force-open Sockets (Not recommended)

If you must, you can force-open the sockets in your browser (In Chrome only):

  1. Go to the address bar and type chrome://net-internals.
  2. Select Sockets from the menu.
  3. Click on the Flush socket pools button.

This solution is not recommended because you shouldn't expect your visitors to follow these instructions to be able to view your site.

Marquizzo
  • 17,230
  • 9
  • 36
  • 59
  • 13
    While the accepted answer gave generally good information, this is the best answer. – taco Jul 24 '15 at 04:29
  • 1
    Just installed Neo4J 3.0.4 and on opening http://localhost:7474/ it says waiting for available sockets, tried flush still not working and in pool list says 6 active and 2 pending for this site – Adeem Aug 26 '16 at 09:13
  • Flushing socket pools isn't working for me either (I am playing small pieces of several HTML5 ` – Sridhar Sarnobat Nov 06 '16 at 02:19
  • In my case there were many tabs open and polling to server, closed all tabs and now it is good. – igauravsehrawat Aug 22 '17 at 07:06
  • Our legacy application had been requesting images (zoom in/out.png etc) from a public server (which must have stopped being supported- leading to lots of error reports). All requests to that server were stuck as "Pending" in Chrome and it would only send back a HTTP status code 502 after about two minutes. This left the application hanging and unable to request images from our own server as it was clogged up requesting these images. Great answer - helped me track this down! – Francis Dean Mar 12 '19 at 17:10
  • Solution #3 is no longer possible as described (using Chrome v89). I get the message `"The net-internals events viewer and related functionality has been removed. Please use chrome://net-export to save netlogs and the external netlog_viewer to view them."` – kmote Mar 20 '21 at 21:21
68

Looks like you are hitting the limit on connections per server. I see you are loading a lot of static files and my advice is to separate them on subdomains and serve them directly with Nginx for example.

  • Create a subdomain called img.yoursite.com and load all your images from there.

  • Create a subdomain called scripts.yourdomain.com and load all your JS and CSS files from there.

  • Create a subdomain called sounds.yoursite.com and load all your MP3s from there... etc..

Nginx has great options for directly serving static files and managing the static files caching.

Community
  • 1
  • 1
Predte4a
  • 896
  • 7
  • 6
  • 11
    This does not change anything. Just put some fake domains in your hosts file and use them instead of localhost. – Predte4a Jul 01 '14 at 13:36
  • Not an option for me. I'm trying to serve videos from my home server over the web (when I'm at work). – Sridhar Sarnobat Nov 06 '16 at 02:11
  • 4
    In case when httpd (i.e. apache) can handle hundreds of sim. connections and just Crome is limiting them, this is not a solution. In my case it is 6 sockets per profile, so I can open 6 more in anonymous profile, etc. This is a solution http://stackoverflow.com/a/29639535/904846 which may to be accepted as a best answer. – dmnc Jan 11 '17 at 10:01
14

The message:

Waiting for available socket...

is shown, because you've reached a limit on the ssl_socket_pool either per Host, Proxy or Group.

Here are the maximum number of HTTP connections which you can make with a Chrome browser:

  • The maximum number of connections per proxy is 32 connections. This can be changed in Policy List.
  • Maximum per Host: 6 connections.

    This is likely hardcoded in the source code of the web browser, so you can't change it.

  • Total 256 HTTP connections pooled per browser.

Source: Enterprise networking for Chrome devices

The above limits can be checked or flushed at chrome://net-internals/#sockets (or in real-time at chrome://net-internals/#events&q=type:SOCKET%20is:active).


Your issue with audio can be related to Chrome bug 162627 where HTML5 audio fails to load and it hits max simultaneous connections per server:proxy. This is still active issue at the time of writing (2016).

Much older issue related to HTML5 video request stay pending, then it's probably related to Issue #234779 which has been fixed 2014. And related to SPDY which can be found in Issue 324653: SPDY issue: waiting for available sockets, but this was already fixed in 2014, so probably it's not related.

Other related issue now marked as duplicate can be found in Issue 401845: Failure to preload audio metadata. Loaded only 6 of 10+ which was related to the problem with the media player code leaving a bunch of paused requests hanging around.


This also may be related to some Chrome adware or antivirus extensions using your sockets in the backgrounds (like Sophos or Kaspersky), so check for Network activity in DevTools.

kenorb
  • 118,428
  • 63
  • 588
  • 624
  • 1
    How can i change 6 per server to 8 per server as it seems some software i am using needs 8 resulting 2 stays in pending and site is never loaded – Adeem Aug 26 '16 at 09:16
  • @Adeem I don't think you can change that, I believe it's hardcoded in the source code. You can [report that issue](https://bugs.chromium.org/p/chromium/issues/list) describing your specific scenario. – kenorb Aug 26 '16 at 10:42
  • 1
    chrome://net-internals/#events&q=type:SOCKET%20is:active link is not up-to-date in latest Chrome – pyrytakala Jun 01 '20 at 10:30
6

simple and correct solution is put off preload your audio and video file from setting and recheck your page your problem of waiting for available socket will resolved ...

if you use jplayer then replace preload:"metadata" to preload:"none" from jplayer JS file ...

preload:"metadata" is the default value which play your audio/video file on page load thats why google chrome showing "waiting for available socket" error

0

Our first thought is that the site is down or the like, but the truth is that this is not the problem or disability. Nor is it a problem because a simple connection when tested under Firefox, Opera or services Explorer open as normal.

The error in Chrome displays a sign that says "This site is not available" and clarification with the legend "Error 15 (net :: ERR_SOCKET_NOT_CONNECTED): Unknown error". The error is quite usual in Google Chrome, more precisely in its updates, and its workaround is to restart the computer.

As partial solutions are not much we offer a tutorial for you solve the fault in less than a minute. To avoid this problem and ensure that services are normally open in Google Chrome should insert the following into the address bar: chrome: // net-internals (then give "Enter"). They then have to go to the "Socket" in the left menu and choose "Flush Socket Pools" (look at the following screenshots to guide http://www.fixotip.com/how-to-fix-error-waiting-for-available-sockets-in-google-chrome/) This has the problem solved and no longer will experience problems accessing Gmail, Google or any of the services of the Mountain View giant. I hope you found it useful and share the tutorial with whom they need or social networks: Facebook, Twitter or Google+.

John
  • 1
  • 1
0

Chrome is a Chromium-based browser and Chromium-based browsers only allow maximum 6 open socket connections at a time, when the 7th connection starts up it will just sit idle and wait for one of the 6 which are running to stop and then it will start running. Hence the error code ‘waiting for available sockets’, the 7th one will wait for one of those 6 sockets to become available and then it will start running.

You can either

Yash
  • 1