selenium-google-code-issue-archive icon indicating copy to clipboard operation
selenium-google-code-issue-archive copied to clipboard

Selenium webdriver.firefox.port not working

Open lukeis opened this issue 8 years ago • 6 comments

Originally reported on Google Code with ID 8593

We are using a javascript library that relies on user focus and mouse events.  Thus,
multiple firefox agents running within a single node interfere with one another, and
we have to run single firefox instances within multiple agents instead.  When doing
so, we get the following intermittent error:

org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within
45000 ms
    Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
    System info: host: '<ip address>', ip: '127.0.0.1', os.name: 'Linux', os.arch:
'amd64', os.version: '3.2.0-36-virtual', java.version: '1.7.0_55'
    Driver info: driver.version: FirefoxDriver
    Command duration or timeout: 46.30 seconds
    Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0',
time: '2014-09-10 09:43:55'
    System info: host: '<ip address>', ip: '<ip address>', os.name: 'Linux', os.arch:
'amd64', os.version: '3.2.0-58-virtual', java.version: '1.7.0_55'
    Driver info: org.openqa.selenium.remote.RemoteWebDriver

        Caused by:
        org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054
within 45000 ms
        Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
        System info: host: '<ip address>', ip: '127.0.0.1', os.name: 'Linux', os.arch:
'amd64', os.version: '3.2.0-36-virtual', java.version: '1.7.0_55'
        Driver info: driver.version: FirefoxDriver
        Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0',
time: '2014-09-10 09:43:55'
        System info: host: '<ip address>', ip: '<ip address>', os.name: 'Linux', os.arch:
'amd64', os.version: '3.2.0-58-virtual', java.version: '1.7.0_55'
        Driver info: driver.version: FirefoxDriver

This appears to be caused by multiple Firefox agents trying to access the same locking
port as described in the Firefox agent port locking strategy here:  https://code.google.com/p/selenium/wiki/FirefoxDriverInternals
From reading the documentation here:  https://code.google.com/p/selenium/wiki/FirefoxDriver
there appears to be a system property named webdriver.firefox.port that can be used
to avoid port conflicts between different agents running on the same box.  After setting
this port, the agents continue to fail with the same exception and port number (even
though this port should no longer be in use because of the system property being specified).
 Further investigation reveals that the code does not seem to honor the property: 
https://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/internal/SocketLock.java?r=1e77c63607a89eb5919f1b4cb8f50f1ade7094bd

There also appears to be some discussion of the issue (with how to recreate it) here:
 https://code.google.com/p/selenium/issues/detail?id=7272&can=1&q=webdriver.firefox.port&colspec=ID%20Stars%20Type%20Status%20Priority%20Milestone%20Owner%20Summary

Affects version: 'org.seleniumhq.selenium:selenium-java:2.45.0'

Reported by appliedsoftwaredesign on 2015-03-10 14:43:16

lukeis avatar Mar 04 '16 09:03 lukeis

For anyone else who may be dealing with multiple firefox agents fighting over focus,
I have been advised that setting http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/firefox/FirefoxProfile.html#setAlwaysLoadNoFocusLib%28boolean%29
might help.

Reported by appliedsoftwaredesign on 2015-03-10 15:06:34

lukeis avatar Mar 04 '16 09:03 lukeis

Reported by barancev on 2015-03-12 07:39:43

  • Labels added: Browser-Firefox

lukeis avatar Mar 04 '16 09:03 lukeis

Issue 8576 has been merged into this issue.

Reported by barancev on 2015-03-12 08:08:51

lukeis avatar Mar 04 '16 09:03 lukeis

Reported by barancev on 2015-03-22 11:51:39

lukeis avatar Mar 04 '16 09:03 lukeis

FirefoxProfile p = new FirefoxProfile();
p.setPreference("webdriver_firefox_port", port); 

will work

Reported by ramprasadgk on 2015-06-23 16:05:40

lukeis avatar Mar 04 '16 09:03 lukeis

Reported by luke.semerau on 2015-09-17 17:47:31

  • Labels added: Restrict-AddIssueComment-Commit

lukeis avatar Mar 04 '16 09:03 lukeis