[Zope] FSSession - don't call FSSession twice!

Kapil Thangavelu kvthan@wm.edu
Mon, 31 Jul 2000 00:17:32 -0700


icottee@bluefountain.com wrote:

> 
> I decided enough was enough today and thought I'd try and find out what was
> happening. So I could give some proper information to Pavlos Christoforou I
> downloaded the latest version of FSSession and tried to reproduce my error. Bang
> - I got a much more impressive error. Whenever I went to any of my pages that
> used FSSession I got the following.
> 
> Zope has encountered an error while publishing this resource.
> 
> Error Type: OSError
> Error Value: [Errno 2] No such file or directory
> 
> Followed by the following traceback
> 
> Traceback (innermost last):
>   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 222, in
> publish_module
>   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 187, in publish
>   File /usr/local/zope/lib/python/Zope/__init__.py, line 221, in
> zpublisher_exception_hook
>     (Object: ElementWithAttributes)
>   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 175, in publish
>   File /usr/local/zope/lib/python/Zope/__init__.py, line 235, in commit
>   File /usr/local/zope/lib/python/ZODB/Transaction.py, line 296, in commit
>   File /usr/local/zope/lib/python/Shared/DC/ZRDB/TM.py, line 122, in tpc_finish
>     (Object: TM)
>   File /usr/local/zope/lib/python/Products/FSSession/FSSession.py, line 84, in
> _finish
>     (Object: TM)
>   File /usr/local/zope/lib/python/Products/FSSession/FSSession.py, line 193, in
> final_commit
>     (Object: FSSession)
> OSError: (see above)
> 
> Interestingly the line above 193 in FSSession.py is a comment which reads
> 'should never fail'.  Well it does and the reason is (as you may have guessed
> from the title) that I called FSSession twice. Line 193 appears to rename a .tmp
> file and I'd guess that by calling it twice my second attempt fails as the file
> has already been renamed. Obviously this isn't the way I should be doing things
> and I'm going to have a go and see if the new version of FSSession cures my
> earlier problems. The reason I mention this now is that the problem causes any
> future attempts at transactions to give the following error - which can only be
> remedied by restarting zope.
> 
> Error Type: TransactionError
> Error Value: A serious error, which was probably a system error, occurred in a
> previous database transaction. This application may be in an invalid state and
> must be restarted before database updates can be allowed. Beware though that if
> the error was due to a serious system problem, such as a disk full condition,
> then the application may not come up until you deal with the system problem. See
> your application log for information on the error that lead to this problem.

Whats Going On-
on every page request FSSession loads up its data(_v_data) from the fs.
At the beg. of transaction commit FSSession opens up a temp file and
dumps its data to it. at the end of a transaction commit.. actually now
that i think about it is the second pass of Zope's two-phase commit. On
the second phase of the commit FSSession tries to copy this temp file
(not a proper one in unix terms just a file with .tmp , portability)
over to the actual file. an error in the second phase of the two-phase
commit basically signals to zope that something seriously bad has
happened and it disallows any commits to transaction aware objects
(ZODB, FSSession,etc). 

if this is disjointed i apologize i'm sleep deprived.

Possible Fixes-
hmmm. i'm not exactly sure you since had fssession up and running
before... i know i've had this error before... but i can't remember
right now why... oh yeah i was developing an FSSession derivative
product...

hmmm... make sure the directory exists (Zope/Var/FSSession) and has the
proper permissions on it. 

if that doesn't work.... hmmm... contact Pavlos.


Cheers

Kapil


> Ian
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )