title: Grid Hub http client timeout if waiting for a slot to be free
body: <h2>Is there a way to query my grid hub (2.6.0) to see if there are slots free for a particular desired capability?</h2>
  
  <h3>Example:</h3>
  
  Grid Hub web page at
  
  <p><a href="http://localhost:4444/grid/console" rel="nofollow">http://localhost:4444/grid/console</a></p>
  
  <p>Shows properly that 1 request should wait for a slot to be free so that test can continue after current one finishes:</p>
  
  <p><hr></p>
  
  <h2><em>Grid Hub 2.6.0</em></h2>
  
  WebDriverRemoteProxy listening on <a href="http://192.168.3.15:5523/wd/hub" rel="nofollow">http://192.168.3.15:5523/wd/hub</a><br>
  
  <p>test session time out after 300 sec.</p>
  
  <p>Supports up to <b>1</b> concurrent tests</p>
  
  <p><strong>1 requests waiting for a slot to be free.</strong></p>
  
  <ul>
  <li>{platform=ANY, javascriptEnabled=true, cssSelectorsEnabled=true, browserName=firefox, nativeEvents=false, rotatable=false, takesScreenshot=true, version=}</li>
  </ul>
  
  <p>view config</p>
  
  <hr>
  
  <p>But the hub instead of returning some kind of json notification that it should hold on and wait it retuns nothing and client connection may simply timeout (depending on the http client library you are using).</p>
  
  <p>I'm using ruby bindings but i can reproduce the error with plain curl, following in these steps:</p>
  
  <h3>Step 1. Server hub and node setup:</h3>
  
  <p>My Hub setup (on ubuntu server)</p>
  
  <pre><code>java -jar selenium-server-standalone.jar -role hub
  </code></pre>
  
  <p>My Node setup (on windows xp machine):</p>
  
  <pre><code>java -jar selenium-server-standalone.jar -role webdriver -hub $HUBURL -port 5522 -maxSession 1 -browser "maxInstances=1,browserName=firefox"
  </code></pre>
  
  <p>Note maxSession and maxInstances are intentionally put at 1 to easily reproduce the issue.</p>
  
  <h3>Step 2. Run some long duration test to occupy the first and only available slot</h3>
  
  <p>(for the sake of the example)</p>
  
  <h3>Step 3. Emulate the running of another test with this curl request:</h3>
  
  <pre><code>curl -L --max-redirs 20 -v -i -H "Accept: application/json" -X POST http://localhost:4444/wd/hub/session -d '{"desiredCapabilities":{"javascriptEnabled":false,"version":"","rotatable":false,"takesScreenshot":true,"cssSelectorsEnabled":true,"browserName":"firefox","nativeEvents":false,"platform":"ANY"}}'
  </code></pre>
  
  <h3>Result:</h3>
  
  <p>Connection is left on hold, no server message indicating what's going on, a json message telling that you are waiting for a slot to be free should do it.
  On some http libraries this will simply timeout as it currently does on ruby <strong>gem 'selenium-webdriver' &lt;= 2.6.0</strong></p>
  
  <p>So i need a way to query if there are slots free (for a particular desiredcapability) in order to avoid a client timeout error.</p>
  
  <p>I checked JsonWireProtocol but couldn't find a path to request that info.
  <a href="https://code.google.com/p/selenium/wiki/JsonWireProtocol" rel="nofollow">JsonWireProtocol</a></p>