SeleniumHQ / selenium-google-code-issue-archive

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

global "socket" lock in the dotnet firefox webdriver is bugged when a port is explicitly set #6934

Open lukeis opened 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 6934

in OpenQA.Selenium.Firefox.Internal.ExtensionConnection
at line 83 the locking port is calculate as (this.profile.Port - 1)
but if the user will creates 3 firefox istances setting 3 different ports on the profiles
passed to the .ctor the global lock is broken becouse it will lock on 3 different ports.

a simple fix will be to use the defaultport constant

using (ILock lockObject = new SocketLock(FirefoxDriver.DefaultPort - 1))

but this will not work if the user has another external process that uses that port.

maybe a better alternative is to implement ILock with a file system locking (ie open/create
an empty file in a "global dir", for example in the AppData subdir, and open it with
FileShare.None enum value). OpenOffice uses a similar locking mode so it can be used
also on not-windows os (but i am not sure of it)

Reported by clz.livio on 2014-01-31 09:56:45

lukeis commented 8 years ago

Reported by barancev on 2014-02-01 18:18:24

lukeis commented 8 years ago

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