Re: Issue 1934 in selenium: WebDriver is not deleting the profile directory after test exits

1,167 views
Skip to first unread message

sele...@googlecode.com

unread,
Feb 2, 2012, 2:06:04 PM2/2/12
to selenium-develope...@googlegroups.com

Comment #25 on issue 1934 by jong...@gmail.com: WebDriver is not deleting
the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

Hi clayton,

This is a nice solution but it won't work when running tests in remote,
using grid. Am i right?

sele...@googlecode.com

unread,
Apr 26, 2012, 4:46:11 AM4/26/12
to selenium-develope...@googlegroups.com

Comment #26 on issue 1934 by wolfgang.schnerring: WebDriver is not deleting
the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

Hello Kristian,

I think the subject of this issue should be "*Remote*WebDriver does not
delete firefox profile directory", and I think I have found the root cause
of this issue (which still exists on trunk):

org.openqa.selenium.remote.server.DefaultSession creates a temporary
directory named after the session id (and properly deletes it when the
session is closed).
So I guess the assumption is that code in the session should use
TemporaryFilesystem.getTmpFsBasedOn(SESSION_TMP_DIR).

But src.org.openqa.selenium.firefox.FirefoxProfile.fromJson() is not aware
of this and instead uses TemporaryFilesystem.getDefaultTmpFS() to place its
profile copy, and this never gets deleted.
However, I'm not sure that FirefoxProfile *can* be aware of the Session,
since it may or may not be running under a RemoteWebDriver.

I can't really propose how to fix this issue; maybe the FirefoxDriver needs
to explicitly remove its Profile when quitting?

sele...@googlecode.com

unread,
Apr 26, 2012, 5:32:19 PM4/26/12
to selenium-develope...@googlegroups.com

Comment #27 on issue 1934 by alonec...@gmail.com: WebDriver is not deleting
the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

Hm, this is still a pain ass bug after so many months!?!

sele...@googlecode.com

unread,
May 5, 2012, 4:39:02 AM5/5/12
to selenium-develope...@googlegroups.com

Comment #28 on issue 1934 by barancev: WebDriver is not deleting the
Issue 2642 has been merged into this issue.

sele...@googlecode.com

unread,
May 5, 2012, 10:12:12 AM5/5/12
to selenium-develope...@googlegroups.com

Comment #29 on issue 1934 by barancev: WebDriver is not deleting the
Issue 3155 has been merged into this issue.

sele...@googlecode.com

unread,
May 12, 2012, 3:53:08 AM5/12/12
to selenium-develope...@googlegroups.com
Updates:
Status: Fixed

Comment #30 on issue 1934 by barancev: WebDriver is not deleting the
This issue was closed by revision r16883.

sele...@googlecode.com

unread,
Jun 12, 2012, 12:31:10 AM6/12/12
to selenium-develope...@googlegroups.com

Comment #31 on issue 1934 by max.abuk...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

This bug is reproduced again in the latest release (2.23.1). Status should
be updated: "Fixed" -> "Reopened".

sele...@googlecode.com

unread,
Jun 12, 2012, 12:32:30 AM6/12/12
to selenium-develope...@googlegroups.com

Comment #32 on issue 1934 by max.abuk...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

Reproduced under Win7 / FirefoxDriver (Firefox 12).

sele...@googlecode.com

unread,
Jun 13, 2012, 5:44:52 PM6/13/12
to selenium-develope...@googlegroups.com

Comment #33 on issue 1934 by pauldavi...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

Is it possible to change the tmp directory to another directory? I tried to
override the "java.io.tmpdir" and it still writes to /tmp

sele...@googlecode.com

unread,
Jun 19, 2012, 9:11:56 AM6/19/12
to selenium-develope...@googlegroups.com

Comment #34 on issue 1934 by tom.goem...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

reproduced with selenium v2.23.1 on windows 7 / firefox 10.0.3

occasionally I get exceptions:

java.lang.NullPointerException
at org.openqa.selenium.io.FileHandler.delete(FileHandler.java:189)
at org.openqa.selenium.io.FileHandler.delete(FileHandler.java:190)
at org.openqa.selenium.io.FileHandler.delete(FileHandler.java:190)
at
org.openqa.selenium.io.TemporaryFilesystem.deleteTempDir(TemporaryFilesystem.java:115)
at
org.openqa.selenium.firefox.FirefoxProfile.clean(FirefoxProfile.java:403)
at
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.quit(NewProfileExtensionConnection.java:164)
at
org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.quit(FirefoxDriver.java:299)
at
org.openqa.selenium.firefox.FirefoxDriver.stopClient(FirefoxDriver.java:257)
at
org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:333)


or


Exception in thread "Thread-1" java.lang.NullPointerException
at org.openqa.selenium.io.FileHandler.delete(FileHandler.java:189)
at org.openqa.selenium.io.FileHandler.delete(FileHandler.java:190)
at org.openqa.selenium.io.FileHandler.delete(FileHandler.java:190)
at
org.openqa.selenium.io.TemporaryFilesystem.deleteTemporaryFiles(TemporaryFilesystem.java:129)
at
org.openqa.selenium.io.TemporaryFilesystem$1.run(TemporaryFilesystem.java:36)

sele...@googlecode.com

unread,
Jun 19, 2012, 11:34:44 PM6/19/12
to selenium-develope...@googlegroups.com

Comment #35 on issue 1934 by winter.k...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

Also seems to happen with ChromeDriver. It leaves behind a bunch of
scoped_dir* directories within the C:\Documents And Settings\<user>\Local
Settings\Temp\ directory.

Selenium 2.23.0 on Windows XP, Chrome/Chromedriver 19

Should I create a separate issue for this, or leave it here?

sele...@googlecode.com

unread,
Jun 25, 2012, 4:59:09 AM6/25/12
to selenium-develope...@googlegroups.com

Comment #36 on issue 1934 by la...@avast.com: WebDriver is not deleting the
Selenium 2.23.1 on Win XP, Chrome 19.0184.56m/Chromedriver 20.0.1133.0
Also a lot of scoped_dir* directories in Temp.

sele...@googlecode.com

unread,
Aug 1, 2012, 9:21:11 AM8/1/12
to selenium-develope...@googlegroups.com

Comment #37 on issue 1934 by alex.ikh...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

any updates on the "scoped_dir* directories not cleaned up" issue with
ChromeDriver? It fills up disk space in our CI environment and is a problem
we really want to tackle.

sele...@googlecode.com

unread,
Aug 1, 2012, 11:31:49 AM8/1/12
to selenium-develope...@googlegroups.com

Comment #38 on issue 1934 by barancev: WebDriver is not deleting the
@alex.ikhelis: Please create a new issue in the chromedriver issue tracker:
http://code.google.com/p/chromedriver/issues/list

sele...@googlecode.com

unread,
Aug 10, 2012, 11:51:43 PM8/10/12
to selenium-develope...@googlegroups.com

Comment #39 on issue 1934 by MarkSt...@gmail.com: WebDriver is not deleting
the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

hmm... looks a bit strange that developers of testing tools seemingly don't
write regression tests for their bugfixes.

sele...@googlecode.com

unread,
Aug 13, 2012, 5:08:49 AM8/13/12
to selenium-develope...@googlegroups.com

Comment #40 on issue 1934 by barancev: WebDriver is not deleting the
Is there regression?

sele...@googlecode.com

unread,
Nov 2, 2012, 4:06:30 AM11/2/12
to selenium-develope...@googlegroups.com

Comment #41 on issue 1934 by manfredm...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

Please reopen. This is not fixed. I just deleted tons of these folders each
of them about with a size of approximately 30 MBytes.

I'm using WebDriver 2.25.1 (.NET version) with FireFox 16.0.2. Operating
system is Windows 7 (64bit), latest patches installed.

sele...@googlecode.com

unread,
Nov 19, 2012, 11:10:50 AM11/19/12
to selenium-develope...@googlegroups.com

Comment #42 on issue 1934 by tjul...@dyn.com: WebDriver is not deleting the
********************
You can get this problem by failing to issue a .quit() at the end of your
session. If you just end with a .close() it won't do a cleanup. We were
seeing this exact same problem (FireFox on Win7 browser cache/profile being
dumped to a appdata/local/temp folder for every test run), but by adding
the .quit() to the end the problem went away and now we get clean runs.
********************

sele...@googlecode.com

unread,
Nov 19, 2012, 12:34:41 PM11/19/12
to selenium-develope...@googlegroups.com

Comment #43 on issue 1934 by manfredm...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

@tjul...@dyn.com Tried what you suggested and your workaround appears to
work. Thank you!

sele...@googlecode.com

unread,
Dec 11, 2012, 11:19:37 AM12/11/12
to selenium-develope...@googlegroups.com

Comment #44 on issue 1934 by chrisedw...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

We are seeing this issue on Win7 using selenium-server-standalone-2.26.0.
We are also calling Quit() on the driver before exiting, yet our node disks
are filling up with the following types of folders/files in our
\Users\<username>\AppData\Local\Temp folder:

(1) Folders with names like "1343943823037"
I assume these are session id folders. These folders are empty, but they
exist even after shutting down selenium node.

(2) Folders with names like "anonymous1972864079409089672webdriver-profile"
These folders are about 8 MB each.

(3) Folders with names like "scoped_dir14656_4658"
These folders are mostly empty. Sometimes there is a 0 byte
chrome_debug.log file.

(4) Folders with names like "webdriver-ie9198441489016361573"
These folders all seem to be empty.

Even after shutting down the selenium node, these files persist. They are
consuming a most of our drive and we have to keep deleting them. This is an
issue that needs to be resolved. Please re-open this issue.


sele...@googlecode.com

unread,
Jan 1, 2013, 9:45:44 PM1/1/13
to selenium-develope...@googlegroups.com

Comment #45 on issue 1934 by lin.yaxi...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

I am seeing the scope_dirxxxx left around on Win7 running 2.28 (local
WebDriver server, not remote node). When Chrome browser is started, it
created two scope_dirxxx (with different sequence number): one empty and
the other containing two subfolders "Default" and "Temp" and 5 text files
(chrome_debug.log, EULA file, etc.).

When Chrome is stopped (.close() and .quit()) called, the empty
scope_dirxxx was delete as expected, but the other folder scope_dirxxx was
left behind (about 8mb).

This is repeatable.

I am running the latest chromedriver.exe.


sele...@googlecode.com

unread,
Jan 3, 2013, 11:13:51 AM1/3/13
to selenium-develope...@googlegroups.com

Comment #46 on issue 1934 by jari.bakken: WebDriver is not deleting the
@45 You should report this in the ChromeDriver tracker:

https://code.google.com/p/chromedriver/issues/list

sele...@googlecode.com

unread,
Feb 21, 2013, 1:19:55 PM2/21/13
to selenium-develope...@googlegroups.com

Comment #47 on issue 1934 by eric.pet...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

I have been using a workaround that upon testcleanup we would clean out all
those files. However, now that we started using Grid, I think we are
accidentally cleaning out the folders that are also still in use. To
continue to use this solution more effectively (until the root cause is
fixed), is there a way to find the folder that was created per test? This
way with that reference I would be able to delete the folder that would no
longer be used.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

sele...@googlecode.com

unread,
Aug 23, 2013, 12:55:35 PM8/23/13
to selenium-develope...@googlegroups.com

Comment #48 on issue 1934 by luizalbe...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

I have the same problem.

When Chrome browser is started, it create two folders scope_dirxxx (with
different sequence number): one empty and the other containing two
subfolders "Default" and "Temp" and 5 text files (chrome_debug.log, EULA
file, etc.).

When Chrome is stopped (.close() and .quit()) called, the empty
scope_dirxxx was delete as expected, but the other folder scope_dirxxx was
left behind (about 8mb).

This is repeatable in interval of 15 minutes. After a few hours, i dont
have no more disk space.

I am running the latest chromedriver.exe.

Selenium version: Selenium-Java 2.35
OS: XP
ChromeDriver (v2.2)
Browser: Chrome
Browser version: 29.0.1547.57

sele...@googlecode.com

unread,
Sep 5, 2013, 11:11:17 AM9/5/13
to selenium-develope...@googlegroups.com

Comment #49 on issue 1934 by paul.del...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

I got a strange problem. I was running ChromeDriver on a test and found the
hard disk full the next day. After cleaning out the System Temp files using
Ccleaner, I re-booted the machine. However, something is still generating
scoped_dirxxx folders and writing to them.

Attachments:
processes.JPG 56.2 KB

sele...@googlecode.com

unread,
Sep 10, 2013, 12:19:16 PM9/10/13
to selenium-develope...@googlegroups.com

Comment #50 on issue 1934 by rolandas...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

We are seeing the same issue sas well. Is there anyone working on this?

sele...@googlecode.com

unread,
Sep 10, 2013, 12:38:36 PM9/10/13
to selenium-develope...@googlegroups.com

Comment #51 on issue 1934 by kristian...@zenior.no: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

No-one here is working on the chromedriver issue, it is not part of this
project. If chromedriver leaves files, it has to be fixed there, as per
coment #46

sele...@googlecode.com

unread,
Oct 18, 2013, 2:21:45 AM10/18/13
to selenium-develope...@googlegroups.com

Comment #52 on issue 1934 by alexandr...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

Hello, I'm working with FF and windows Server 2008 64 bits. This problem
has not been fixed, so I can't use Selenium WebDriver any more. My Hard
drive is full and also My RAM, cause selenium doesn't kill Firefox.

Regards

sele...@googlecode.com

unread,
Oct 18, 2013, 4:29:25 AM10/18/13
to selenium-develope...@googlegroups.com

Comment #53 on issue 1934 by barancev: WebDriver is not deleting the
>>> cause selenium doesn't kill Firefox

There is no "auto-stop". Do you call driver.quit() in the end?

sele...@googlecode.com

unread,
Oct 18, 2013, 3:09:24 PM10/18/13
to selenium-develope...@googlegroups.com

Comment #54 on issue 1934 by alexandr...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

I'm Sorry something was wrong in my code. All is ok.
Nevermind..

sele...@googlecode.com

unread,
Jan 14, 2014, 3:37:17 PM1/14/14
to selenium-develope...@googlegroups.com

Comment #55 on issue 1934 by sakamoto...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

I am seeing this issue. As my testing requires installing a FF plugin, and
comparing Plugin enabled browser with clean browser (No plugin). This is
blocking current testing. A workaround using a compiled .exe is currently
being used to install the plugin and preserve the profile name, but not our
ideal solution.

sele...@googlecode.com

unread,
Jan 28, 2014, 2:51:57 PM1/28/14
to selenium-develope...@googlegroups.com

Comment #56 on issue 1934 by tobias.f...@admeta.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

I'm also still having the exact same issue using Windows 7, C# and the
WebDriver for Firefox version 2.39. I have resorted to calling
WebDriver.Close only and then manually delete the profile directory
(recursivly) as extracted via

var profile = new FirefoxProfile(Config.FireFoxProfilePath);
var _profileDirectory = profile.ProfileDirectory;
//in dispose method:
WebDriver.Close();

Directory.Delete(_profileDirectory, recursive: true); //WebDriver.Quit();

The problem is, besides that WebDriver.Quit fails due to an exception, is
that I have to have a try catch around the Directory.Delete statement due
to an IOException telling me that ""Access to the
path 'csharpfo...@seleniumhq.org.xpi' is denied.". Though when
checking the file with a Windows Explorer plugin like Unlocker, it reveals
that there are no locks on the file. And there is no problem deleting the
file manually in the the File Explorer. Running Visual Studio as an
administrator makes no difference.

When using the WebDriver.Quit() method instead, it actually seemt, with
this version of the We3bDriver to catch the exception since exactly the
same files remains after the execution. So my manual Delete statement I
guess is similar to what is under the hood in WebDriver.Quit(). But the
problem remains that all files are not deleted. The memory footpring seem
to be reduced to <800 KB which.

sele...@googlecode.com

unread,
Jan 28, 2014, 3:04:49 PM1/28/14
to selenium-develope...@googlegroups.com

Comment #57 on issue 1934 by tobias.f...@admeta.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

I'm also still having the exact same issue using Windows 7, C# and the
WebDriver for Firefox version 2.39. I have resorted to calling
WebDriver.Close() only and then manually delete the profile directory. Some
code to show this:

//in constructor of WebDriver wrapper class:
var profile = new FirefoxProfile(Config.FireFoxProfilePath); //reusing an
old FireFoxProfile
var _profileDirectory = profile.ProfileDirectory; //If I understand this
correctly, this is the actual temp profile directly as created based on the
constructor template folder?


//in dispose method:
WebDriver.Close(); //instead of WebDriver.Quit();
Directory.Delete(_profileDirectory, recursive: true);

The problem is, besides that WebDriver.Quit fails due to an exception, is
that I have to have a try catch around the Directory.Delete statement due
to an IOException telling me that ""Access to the
path 'csharpfo...@seleniumhq.org.xpi' is denied.". Though when
checking the file with a Windows Explorer plugin like Unlocker, it reveals
that there are no locks on the file. And there is no problem deleting the
file manually in the the File Explorer. Running Visual Studio as an
administrator makes no difference.

When using the WebDriver.Quit() method instead, it seems, with this version
of the WebDriver to catch the exception since exactly the same files
remains after the execution. So my manual Delete statement I guess is
similar to what is under the hood in WebDriver.Quit() (I have not checked
obviously). But the problem remains that all files are not deleted. The
memory footpring seem to be reduced to <800 KB which which is better than
20+ GB but still not good enough for a test server running tests often.

sele...@googlecode.com

unread,
Jan 31, 2014, 1:12:58 PM1/31/14
to selenium-develope...@googlegroups.com

Comment #58 on issue 1934 by jef...@mavericklabel.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

Exception in thread "Thread-4" java.lang.NullPointerException
at org.openqa.selenium.io.FileHandler.delete(FileHandler.java:132)
at org.openqa.selenium.io.FileHandler.delete(FileHandler.java:133)
at org.openqa.selenium.io.FileHandler.delete(FileHandler.java:133)
at org.openqa.selenium.io.FileHandler.delete(FileHandler.java:133)
at
org.openqa.selenium.io.TemporaryFilesystem.deleteTemporaryFiles(TemporaryFilesystem.java:129)
at
org.openqa.selenium.io.TemporaryFilesystem$1.run(TemporaryFilesystem.java:36)

sele...@googlecode.com

unread,
May 13, 2014, 6:58:26 PM5/13/14
to selenium-develope...@googlegroups.com

Comment #59 on issue 1934 by bdan...@conservice.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

The way I found to get around this issue was to wrap my instance of the
webdriver in a "Using" clause and cleaning the profile.
I performed a few things to speed up my tests. #1. Made my custom profile
as small as possible and only what was needed. #2. Generated a port to
avoid not being able to bind to a locking port. #3. Called profile.Clean();
after my tests are completed.
Windows 7 / Windows Server 2008. C#. Selenium Webdriver 2.35
public static void Test()
{
FirefoxProfile profile = new FirefoxProfile(CustomProfile);
//Generate a Port for the profile to use (I was having binding
issues with multiple tests)
Random genPort = new Random();
profile.Port = genPort.Next(7000, 7500);
using (IWebDriver driver = new FirefoxDriver(profile))
{
//Perform my Test
//Quit my driver
driver.Quit()
}
//Call Profile.Clean() to delete any profiles that may have been
generated.
profile.Clean();
}

Using this method, I have been able to keep my servers clean of Anonymous
webdriver profiles. Previously I had my drives becoming full rather
quickly, but decreasing the size of the profiles helped dramatically. (50
mb per to 2.5 mb per).

sele...@googlecode.com

unread,
Jul 30, 2014, 3:31:13 AM7/30/14
to selenium-develope...@googlegroups.com

Comment #60 on issue 1934 by robin.st...@gmail.com: WebDriver is not
deleting the profile directory after test exits
http://code.google.com/p/selenium/issues/detail?id=1934

The NullPointerException in FileHandler.delete is caused by the code not
checking the return value of File#listFiles() properly (it can return
null). I've submitted a pull request here:

https://github.com/SeleniumHQ/selenium/pull/241

sele...@googlecode.com

unread,
Aug 26, 2014, 10:26:30 AM8/26/14
to selenium-develope...@googlegroups.com

Comment #61 on issue 1934 by supp...@oxygenxml.com: WebDriver is not
deleting the profile directory after test exits
https://code.google.com/p/selenium/issues/detail?id=1934

Hello,

I also got the NPE mentioned in a comment above and managed to find out the
cause.

I was trying to make the cleanup on shutdown hook. But the files created by
the TemporaryFilesystem are scheduled for deletion on exit by using:
File.deleteOnExit() which also deletes the files on a shutdown hook that
runs concurrently with mine.

Maybe this helps you identify some other issues in this area.

sele...@googlecode.com

unread,
Aug 5, 2015, 4:14:53 PM8/5/15
to selenium-develope...@googlegroups.com

Comment #62 on issue 1934 by gloch...@widen.com: WebDriver is not deleting
the profile directory after test exits
https://code.google.com/p/selenium/issues/detail?id=1934

Still happening to me..
Reply all
Reply to author
Forward
0 new messages