[Zope-CMF] Examining portal_actions with the Zope app objectfrom the Python interpreter

Chris McDonough chrism@zope.com
27 Aug 2002 21:19:11 -0400


On Tue, 2002-08-27 at 20:47, Phil Glaser wrote:
> The makerequest thing works like a charm for this. The pdb thing is good to
> know about, too. I am grateful!

Great!

> Just one more question: after I create this app object and then exit out of
> the browser, Zope will not restart because it thinks Data.fs is locked. I
> tried deleting just the three pid files in the var directory, but that did
> not work, either. I finally discovered I could delete the Data.fs.lock file,
> which does the trick. I did delete the app object before I exected the
> interpreter, but that did not solve the problem. Is this just a fact of
> life, or should I be doing something different to avoid locking Data.fs?

Typically this works ok for me (although sometimes it doesn't)... When
FileStorage starts up on UNIX it tries to lock the file using flock()
(the Windows version does something similar but using Windows API
calls).  If flock() fails, it will raise the error you see.  This
typically means that the Zope process that originally locked the file is
still running somehow.  The next time you see the error, look for a
Python process in a process listing.  If you see it (maybe it freaked
out when you exited the debugger somehow), just kill it and you will be
able to lock the file the next time you run the debugger (or Zope).

If you don't see it in a process list, the ZODB lockfile may not have
been unlocked when the process was exited, which would amount to the
file's inode not being closed for some reason when the process exited (a
very strange situation, as when Python exits, it deletes all of the
objects in memory, and when a file object is deleted, it gets closed
implicitly).  This anomaly might either be a be platform-specific
behavior.  Compared to the number of people who use Zope, not so many
people use or know about the "Zope debugger" (as it were), so this might
be a behavior as-til-now uknown on your platform.  I use Linux and it
works there... it would be good to know what platform you're using if
this continues for you.

HTH,

- C