lockProfileDirectory is not release

UNCONFIRMED
Unassigned

Status

Core Graveyard
Java to XPCOM Bridge
UNCONFIRMED
11 years ago
3 years ago

People

(Reporter: Gerald, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2
Build Identifier: 

I'm using the code from https://bugzilla.mozilla.org/show_bug.cgi?id=340960#c16 to have a create a create a lock with "mozilla.lockProfileDirectory(profileDir);"
But the problem is that when I shutdown the file "parent.lock" has still a lock on it. On shutting down I use the code from
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.atf/components/plugins/org.eclipse.atf.mozilla.ide.core/src/org/eclipse/atf/mozilla/ide/core/MozillaHelper.java?revision=1.5&root=WebTools_Project&view=markup
I create the shutdown hock where I call
{
Mozilla.getInstance().termEmbedding();
deleteDir(profileDir);
}

The documentation of the method at
http://mxr-test.landfill.bugzilla.org/mozilla1.8.x/source/extensions/java/xpcom/interfaces/IGRE.java#80
says "The directory will remain locked until the lock is released by invoking the <code>release</code> method." My problem is that there is no "release()" method and I call already termEmbedding(). 

So how can I get ride of this lock? Because as long as this lock exists I cannot delete the whole profile directory. The parent.lock automatically disapears after the jvm shutdown but then I cannot clean up the rest.


I use:
  Mozilla mozilla = Mozilla.getInstance();
...
  try {
     File grePath = Mozilla.getGREPathWithProperties(range, null);
     mozilla.initialize(grePath);
     profLock = mozilla.lockProfileDirectory(profileDir);
     LocationProvider locProvider = new LocationProvider(grePath, profileDir);
     mozilla.initEmbedding(grePath, grePath, locProvider);
     mozilla.notifyProfile();
  } catch (XPCOMInitializationException xie) {
     // handle exception
  } catch (XPCOMException xe) {
     // handle exception
  }

Reproducible: Always

Comment 1

11 years ago
Did you try profLock.release()
http://mxr-test.landfill.bugzilla.org/mozilla1.8.x/source/extensions/java/xpcom/interfaces/ProfileLock.java#43
(Reporter)

Comment 2

11 years ago
Pervisouly I did not call release but I tried it now with the same result.
I tried to call release() (before and after termEmbedding). But I'm still not able to delete the file. 

if (profLock != null)
 profLock.release();
Mozilla.getInstance().termEmbedding();

the delete() method for the "parent.lock" file still returns me false.
(Reporter)

Comment 3

11 years ago
I figured out what the problem was. The code
if (profLock != null)
 profLock.release();
works but you need a gui for this, meaning that in the Shutdownhook its already too late. I'm not sure why I need a gui (=mozilla??) to release the file.

This this a bug or a feature that .release() depends when it is called?

Updated

4 years ago
Assignee: jhpedemonte → nobody
(Assignee)

Updated

3 years ago
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.