SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

hang on findElement, getScreenshotAs. #7090

Open lukeis opened 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 7090

Hello!

After update to new Selenium and FF version I have the following problems:

1. hang on findElement
2. hang on getScreenshotAs

Selenium version: 2.40.0
OS: Linux
Browser: FF
Browser version: 27.0.1

Callstack for the first problem:

Thread 3902: (state = IN_NATIVE)
 - java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int,
int) @bci=0 (Interpreted frame)
 - java.net.SocketInputStream.read(byte[], int, int, int) @bci=79, line=150 (Interpreted
frame)
 - java.net.SocketInputStream.read(byte[], int, int) @bci=11, line=121 (Interpreted
frame)
 - org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer() @bci=71, line=160
(Interpreted frame)
 - org.apache.http.impl.io.SocketInputBuffer.fillBuffer() @bci=1, line=84 (Interpreted
frame)
 - org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(org.apache.http.util.CharArrayBuffer)
@bci=130, line=273 (Interpreted frame)
 - org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(org.apache.http.io.SessionInputBuffer)
@bci=16, line=140 (Interpreted frame)
 - org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(org.apache.http.io.SessionInputBuffer)
@bci=2, line=57 (Interpreted frame)
 - org.apache.http.impl.io.AbstractMessageParser.parse() @bci=38, line=260 (Interpreted
frame)
 - org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader() @bci=8,
line=283 (Interpreted frame)
 - org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader() @bci=1,
line=251 (Interpreted frame)
 - org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader() @bci=15,
line=223 (Interpreted frame)
 - org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(org.apache.http.HttpRequest,
org.apache.http.HttpClientConnection, org.apache.http.protocol.HttpContext) @bci=41,
line=271 (Interpreted frame)
 - org.apache.http.protocol.HttpRequestExecutor.execute(org.apache.http.HttpRequest,
org.apache.http.HttpClientConnection, org.apache.http.protocol.HttpContext) @bci=39,
line=123 (Interpreted frame)
 - org.apache.http.impl.client.DefaultRequestDirector.tryExecute(org.apache.http.impl.client.RoutedRequest,
org.apache.http.protocol.HttpContext) @bci=198, line=682 (Interpreted frame)
 - org.apache.http.impl.client.DefaultRequestDirector.execute(org.apache.http.HttpHost,
org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) @bci=578, line=486
(Interpreted frame)
 - org.apache.http.impl.client.AbstractHttpClient.doExecute(org.apache.http.HttpHost,
org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) @bci=362, line=863
(Interpreted frame)
 - org.apache.http.impl.client.CloseableHttpClient.execute(org.apache.http.HttpHost,
org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) @bci=4, line=72
(Interpreted frame)
 - org.apache.http.impl.client.CloseableHttpClient.execute(org.apache.http.HttpHost,
org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) @bci=4, line=57
(Interpreted frame)
 - org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(org.apache.http.protocol.HttpContext,
org.apache.http.client.methods.HttpUriRequest) @bci=10, line=319 (Interpreted frame)
 - org.openqa.selenium.remote.HttpCommandExecutor.execute(org.openqa.selenium.remote.Command)
@bci=205, line=298 (Interpreted frame)
 - org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(org.openqa.selenium.remote.Command)
@bci=5, line=165 (Interpreted frame)
 - org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(org.openqa.selenium.remote.Command)
@bci=42, line=363 (Interpreted frame)
 - org.openqa.selenium.remote.RemoteWebDriver.execute(java.lang.String, java.util.Map)
@bci=74, line=546 (Interpreted frame)
 - org.openqa.selenium.remote.RemoteWebDriver.findElement(java.lang.String, java.lang.String)
@bci=26, line=326 (Interpreted frame)
 - org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(java.lang.String)
@bci=4, line=423 (Interpreted frame)
 - org.openqa.selenium.By$ByXPath.findElement(org.openqa.selenium.SearchContext) @bci=8,
line=357 (Interpreted frame)
 - org.openqa.selenium.remote.RemoteWebDriver.findElement(org.openqa.selenium.By) @bci=2,
line=318 (Interpreted frame)
 - com.manager.editor.EditM.edit(java.util.Map, java.util.Map, java.lang.String, java.util.Map,
java.util.Map) @bci=669, line=113 (Interpreted frame)
 - com.manager.editor.Editor.run() @bci=712, line=136 (Interpreted frame)
 - ru.manager.seleniumrunner.Main.main(java.lang.String[]) @bci=184, line=95 (Interpreted
frame)

For the second:
 - java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int,
int) @bci=0 (Interpreted frame)
 - java.net.SocketInputStream.read(byte[], int, int, int) @bci=79, line=150 (Interpreted
frame)
 - java.net.SocketInputStream.read(byte[], int, int) @bci=11, line=121 (Interpreted
frame)
 - org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer() @bci=71, line=160
(Interpreted frame)
 - org.apache.http.impl.io.SocketInputBuffer.fillBuffer() @bci=1, line=84 (Interpreted
frame)
 - org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(org.apache.http.util.CharArrayBuffer)
@bci=130, line=273 (Interpreted frame)
 - org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(org.apache.http.io.SessionInputBuffer)
@bci=16, line=140 (Interpreted frame)
 - org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(org.apache.http.io.SessionInputBuffer)
@bci=2, line=57 (Interpreted frame)
 - org.apache.http.impl.io.AbstractMessageParser.parse() @bci=38, line=260 (Interpreted
frame)
 - org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader() @bci=8,
line=283 (Interpreted frame)
 - org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader() @bci=1,
line=251 (Interpreted frame)
 - org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader() @bci=15,
line=223 (Interpreted frame)
 - org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(org.apache.http.HttpRequest,
org.apache.http.HttpClientConnection, org.apache.http.protocol.HttpContext) @bci=41,
line=271 (Interpreted frame)
 - org.apache.http.protocol.HttpRequestExecutor.execute(org.apache.http.HttpRequest,
org.apache.http.HttpClientConnection, org.apache.http.protocol.HttpContext) @bci=39,
line=123 (Interpreted frame)
 - org.apache.http.impl.client.DefaultRequestDirector.tryExecute(org.apache.http.impl.client.RoutedRequest,
org.apache.http.protocol.HttpContext) @bci=198, line=682 (Interpreted frame)
 - org.apache.http.impl.client.DefaultRequestDirector.execute(org.apache.http.HttpHost,
org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) @bci=578, line=486
(Interpreted frame)
 - org.apache.http.impl.client.AbstractHttpClient.doExecute(org.apache.http.HttpHost,
org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) @bci=362, line=863
(Interpreted frame)
 - org.apache.http.impl.client.CloseableHttpClient.execute(org.apache.http.HttpHost,
org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) @bci=4, line=72
(Interpreted frame)
 - org.apache.http.impl.client.CloseableHttpClient.execute(org.apache.http.HttpHost,
org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) @bci=4, line=57
(Interpreted frame)
 - org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(org.apache.http.protocol.HttpContext,
org.apache.http.client.methods.HttpUriRequest) @bci=10, line=319 (Interpreted frame)
 - org.openqa.selenium.remote.HttpCommandExecutor.execute(org.openqa.selenium.remote.Command)
@bci=205, line=298 (Interpreted frame)
 - org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(org.openqa.selenium.remote.Command)
@bci=5, line=165 (Interpreted frame)
 - org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(org.openqa.selenium.remote.Command)
@bci=42, line=363 (Interpreted frame)
 - org.openqa.selenium.remote.RemoteWebDriver.execute(java.lang.String, java.util.Map)
@bci=74, line=546 (Interpreted frame)
 - org.openqa.selenium.remote.RemoteWebDriver.execute(java.lang.String) @bci=5, line=588
(Interpreted frame)
 - org.openqa.selenium.firefox.FirefoxDriver.getScreenshotAs(org.openqa.selenium.OutputType)
@bci=3, line=324 (Interpreted frame)
 - ru.manager.common.FailReport.SendPerort(java.lang.String, java.lang.Boolean) @bci=192,
line=63 (Interpreted frame)
 - com.manager.editor.Editor.sendReport(java.lang.Exception) @bci=83, line=302 (Interpreted
frame)
 - com.manager.editor.Editor.run() @bci=1034, line=193 (Interpreted frame)
 - ru.manager.seleniumrunner.Main.main(java.lang.String[]) @bci=184, line=95 (Interpreted
frame)

Reported by bushevuv on 2014-03-13 12:26:58

lukeis commented 8 years ago
Please provide a complete executable scenario and a complete sample page to reproduce
the issue 

Reported by barancev on 2014-03-13 19:36:12

lukeis commented 8 years ago
Hi Alex!

The source code for the first problem:
WebElement price_w = driver.findElement(By.xpath("//input[contains(@id, '_price')]"));

Relevant web element on HTML page:
<input maxlength="6" name="SaleBusiness[price]" id="SaleBusiness_price" class="input-mini"
type="text" value="8500">

Problem number two happens after a 'TimeoutException'.

Both 2 problems happens only once, and hand reproducible. Please, ask if some additional
info is needed.

Reported by bushevuv on 2014-03-13 20:16:17

lukeis commented 8 years ago
Another issue that is directly or indirectly related to the upgrade.

Unable to start WebDriver. org.openqa.selenium.WebDriverException: Unable to bind to
locking port 7054 within 10000 ms
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ubuntu', ip: '91.105.232.144', os.name: 'Linux', os.arch: 'amd64',
os.version: '3.5.0-23-generic', java.version: '1.7.0_25'
Driver info: driver.version: RmDriver
    at org.openqa.selenium.internal.SocketLock.lock(SocketLock.java:98)
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:84)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:247)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:112)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:192)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:187)
    at ru.manager.common.RmDriver.FFDriver(RmDriver.java:255)
    at ru.manager.common.RmDriver.<init>(RmDriver.java:41)
    at ru.manager.common.RmDriver.getInstance(RmDriver.java:293)
    at ru.manager.common.CheckIP.checkByWhatisMyIpaddress(CheckIP.java:99)
    at ru.manager.common.CheckIP.run(CheckIP.java:37)
    at com.manager.editor.Editor.run(Editor.java:105)
    at ru.manager.seleniumrunner.Main.main(Main.java:95)

Code part:

for (int i = 0; i < 50; i++) {
  try {
    driver = new FirefoxDriver(firefox, profile, cap);
    driverIsStarted = true;
    break;
  } catch (WebDriverException ex) {
    ex.printStackTrace(new PrintWriter(errors));
    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
      break;
     }
  }
}

I want to note that before this update about a month this part of the code is always
beat stable.

Reported by bushevuv on 2014-03-14 09:51:03

lukeis commented 8 years ago
About the last comment: no it is not related to the upgrade. When you start a new FirefoxDriver
it sets a socket lock until the browser is fully up and running. If it can't set the
lock because another driver is starting and the socket is already locked it waits but
not too long. If you try to start many instances at once they fire browsers one by
one, while others are waiting. And as soon as one of them hits the timeout it thows
an exception "unable to bind to the locking port". See [1] for more detaled explanation.

[1] https://code.google.com/p/selenium/wiki/FirefoxDriverInternals#Flow_of_Control:_Starting_Firefox

Reported by barancev on 2014-03-14 18:51:46

lukeis commented 8 years ago
Hi,

yes, I know that. I used for loop with sleeping for the synchronization porpose, it's
works fine for me.

Reported by bushevuv on 2014-03-14 18:54:31

lukeis commented 8 years ago
So I suppose the reason to fail is increased startup time of a new Firefox version.

Unfortunately there is not enough information to understand what caused the browser
to hang. And the issue can't be reproduced deterministically.

Next time you see it hanging please open the browser error console (Ctrl-Shift-J) and
watch for error messages. This could help us much more than the client side stack trace
(that only can tell what operation hangs).

Reported by barancev on 2014-03-14 18:56:20

lukeis commented 8 years ago
Hi,

ok. I will try to collcet requested information! Thank you/

Reported by bushevuv on 2014-03-14 19:05:21

lukeis commented 8 years ago
Hi, please find a requested info in attachments.

Reported by bushevuv on 2014-04-11 11:46:22


lukeis commented 8 years ago
The attached log is totally unrelated to "Unable to bind to locking port 7054", this
error means that selenium can't establish connection to the browser, and as a result
it can't send any command, contrary to what I can see in the log.

Reported by barancev on 2014-04-11 12:53:28

lukeis commented 8 years ago
Yes, this problem is related to "hang on getScreenshotAs". (callstack number 2 in initial
problem description)

Reported by bushevuv on 2014-04-11 13:06:55

lukeis commented 8 years ago
Ah, I see, reopening. Seems to be an attempt to take a shot when an alert is open.

Reported by barancev on 2014-04-11 13:14:44

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 17:46:33