mozilla / web-ext

A command line tool to help build, run, and test web extensions
Mozilla Public License 2.0
2.68k stars 339 forks source link

Running extensions in both Chrome and Firefox leaves temporary directories #1981

Open ghostwords opened 4 years ago

ghostwords commented 4 years ago

Is this a feature request or a bug?

Bug

What is the current behavior?

Running extensions in both Chrome and Firefox still leaves temporary directories. This happens despite web-ext logging that it cleans up some temp directory on exit in verbose mode. (The directory logged is indeed missing, but others remain.)

Here are some recent leftover folders in /tmp/:

.com.google.Chrome.tV0jJO
tmp-web-ext--2445-Rid4u33i0TaN
.com.google.Chrome.1YiHq1
tmp-web-ext--9065-2sTtAd1ZXCx2
lighthouse.cc52DU2
lighthouse.elq0cnz
lighthouse.1p1kCZO
lighthouse.aEuUs7s
lighthouse.GxOVGAS
lighthouse.LTtzBYw
vxRzd7e
lighthouse.mXLE5jI
tmp-web-ext--8248-8w2G2D5WDdNB

The "lighthouse", "Chrome" and "vxRzd7e"-like folders come from Chrome, I think. "tmp-web-ext" folders are from Firefox.

"lighthouse" folders in particular seem to sometimes grow to hundreds of megabytes in size when a web-ext run session is left running for days.

Versions

web-ext 5.0.0 Various versions (both latest and older) of Firefox and Chrome.

ghostwords commented 4 years ago

1957 sounds related.

Rob--W commented 4 years ago

Confirmed with -t chromium, but not reproducible with Firefox. Are you seeing this with web-ext run (Firefox)?

We should either ensure that the directory content is destroyed, or call tmp.setGracefulCleanup() in https://github.com/mozilla/web-ext/blob/cfc49ce803a9a320d06af5871a2e3aa8a8c533b5/src/util/temp-dir.js

ghostwords commented 4 years ago

Yes, the tmp-web-ext folders are from Firefox runs. I just tried again with the latest version of Firefox and got two new folders with names like "Temp-075a8052-2cd9-4460-8ac9-13e76c3aa77e". Plus there are a bunch of "rust_mozprofile.pspDgJWpvtWe" folders too, also probably from Firefox. These are all in /tmp. It's possible some of these are not from web-ext, but I'm sure a lot of them are.