This repository was archived by the owner on Nov 29, 2018. It is now read-only.
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
Thread safety issue when exception occurs during RemoteWebDriver quit within Selenium Grid #8441
Open
Description
Originally reported on Google Code with ID 8441
Apologies for not being able to create a reproducible example but this is happening
a few times a week and the scenario is always the same;
Selenium Grid version 2.43 (but seen in earlier versions too)
Bindings; Ruby using Persistent Connections
Test Framework; RSpec2
Executor; parallel_test (20 threads)
Scenario;
Quit is called on Session A but socket timeout exception occurs during the request
(see session A test.log)
This can be seen on the Selenium Hub but actually appears twice 60 seconds apart (see
hub.log)
Meanwhile, a test running Session B in a separate thread, stops running with an SO_TIMEOUT
error (see Session B test.log)
Note that the hub.log has no reference to any socket timeout for session B
The client.log taken from the selenium node which is running session B shows that no
error has been recorded on the node (see session B test client.log) NB. There are
concurrent chrome sessions open on this node BUT NOT the session which had the original
timeout.
This error in which an unrelated session is terminated happens a few times a week but
is a small percentage of the overall tests executed.
Although I have been unable to create a test to replicate, my feeling is that when
a request to stop a session results in an exception, the registry.terminate is called
twice in two asynchronous threads (see current request handler file), and that this
may be a scenario which the threading approach does not account for?
We could make a change to the request handler but am not sure of the implications of
this (see proposed request handler file).
It would mean that if an exception occurred during 'Quit' the session would not be
marked as Stop_Session but continue to be SO_TIMEOUT instead, and I suppose this could
be a problem
Reported by wareham.robbie
on 2015-01-30 12:15:09
- _Attachment: [hub.log](https://storage.googleapis.com/google-code-attachments/selenium/issue-8441/comment-0/hub.log)_ - _Attachment: [Session B test.log](https://storage.googleapis.com/google-code-attachments/selenium/issue-8441/comment-0/Session B test.log)_ - _Attachment: [current request handler](https://storage.googleapis.com/google-code-attachments/selenium/issue-8441/comment-0/current request handler)_ - _Attachment: [proposed request handler.txt](https://storage.googleapis.com/google-code-attachments/selenium/issue-8441/comment-0/proposed request handler.txt)_