Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

IEDriverServer.exe is not cleaned up, if main thread exited with exception #4288

Closed
lukeis opened this issue Mar 3, 2016 · 5 comments
Closed

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 4288

If main thread of the program exited with exception (and not finalized properly), the
process IEDriverServer.exe is not removed.

Selenium version : 2.25.0
IEDriver version: 2.25.1 Win 32

Steps to reproduce:

1) Create a temp dir, lets say 'testcase'
2) Create 'testcase\bin' and put there selenium-server-standalone-2.25.0.jar and IEDriverServer.exe
(can be downloaded from: http://selenium.googlecode.com/files/selenium-server-standalone-2.25.0.jar
and http://selenium.googlecode.com/files/IEDriverServer_Win32_2.25.1.zip)

Also put there the Rhino jar: js.jar from https://github.com/downloads/mozilla/rhino/rhino1_7R4.zip
3) Save the following test case to the 'testcase.js':

java.lang.System.setProperty("webdriver.ie.driver", "bin\\IEDriverServer.exe")

var driverClass     = Packages.org.openqa.selenium.ie.InternetExplorerDriver
var driver          = new driverClass()

driver.get('http://google.com')

throw "yo"

4) Launch it with:

java -cp "bin\binary\selenium-server-standalone-2.25.0.jar;bin\binary\js.jar" org.mozilla.javascript.tools.shell.Main
test.js


Note, that after running test case,  the IEDriverServer.exe will still be running in
the background, effectively leaking the memory.

Reported by nickolay8 on 2012-07-20 12:48:01

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi,

i'm not sure that it's bug.

If uncaught exception is occured then IEDriverServer.exe and iexplore.exe can not closed
w/o any actions.

This code will work well, i think:
--------------------------------
java.lang.System.setProperty("webdriver.ie.driver", "bin\\IEDriverServer.exe")

var driverClass     = Packages.org.openqa.selenium.ie.InternetExplorerDriver
var driver          = new driverClass()

try {
    driver.get('http://google.com')
    throw "yo"
} catch (e) {
    //
} finally {
    driver.quit()
}
--------------------------------


I has no experience with Rhino so i can be mistaken.

Reported by a.u.savchuk on 2012-07-20 17:49:29

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

If I'm not mistaken one can use "shutDownHook" for cleanup, which will be called when
process exit, regardless is it because of exception or not:

(Again, Rhino script, I was using it in some other program):

java.lang.Runtime.getRuntime().addShutdownHook(java.lang.Thread(function () {
}))

Reported by nickolay8 on 2012-07-20 18:51:43

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2012-07-21 16:41:43

  • Labels added: Component-WebDriver, Browser-IE, Lang-Java

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Selenium provides an API to drive the IE browser using a driver executable. This API
includes 'quit' operation that stops the browser and the driver and performs cleanup.

Selenium is an API rather than a test execution framework, hence it just provides an
operation to stop the browser and the driver. To call it or not to call -- it's your
choice. If you don't call this operation, Selenium doesn't perform cleanup. You may
use whatever you want: a shutdown hook, a 'tear down' method of your framework, a try-catch
block, anything else.

If you want to negotiate this design desision welcome to IRC channel [1] or dev list
[2]!

[1] #selenium at Freenode (irc.freenode.net)
[2] https://groups.google.com/forum/?fromgroups#!forum/selenium-developers

Reported by barancev on 2012-08-05 15:22:02

  • Status changed: WorkingAsIntended
  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:15:52

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant