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

2000-07-31 Thread icottee



I've been using the excellent FSSession product (many thanks Mr Christoforou) to
hold some information on the language a user wishes to display a page in. I kept
having weird errors however - every now and again I'd change some code somewhere
completely unrelated (even just adding a user) and FSSession would break.
Undoing the last change wouldn't help. The error was to do with _v_data and (I
think) _v_id or something similar.

This post isn't about that problem.

From reading through the extremely useful nipltd archives it appeared the
problem was not doing a dtml-call FSSession at the beginning of the code. This
was bemusing because that code was sitting in my standard header and called
everywhere. However, I had an uneasy workaround which did a 'try' on using
FSSession and if it failed initialise it in the normal way. I say 'uneasy'
because I didn't know why I needed it and when I added another bit of code to
handle another cookie that needed to be recorded it broke again.

This post isn't about that problem either.

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.

So if you make the same mistake as I did on a production server you will not be
popular :-). I'm running this on Zope 2.2.0 by the way (although it happens on
the previous production version as well).

Hope this is of some use

Ian



___
Zope maillist  -  [EMAIL PROTECTED]
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 )




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

2000-07-31 Thread Pavlos Christoforou

On Tue, 1 Aug 2000 [EMAIL PROTECTED] wrote:

 
 Zope has encountered an error while publishing this resource.
 
 Error Type: OSError
 Error Value: [Errno 2] No such file or directory
 
 
 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
 
 Hope this is of some use
 
 Ian
 

Ian 

Thanks for the report and the excellent analysis. Unfortunately I did not
consider the case of calling FSSession twice. During the last couple of
days I had a few suggestions (Brian and Dieter) on improving FSSession so
a new version soon.

Thanks

Pavlos



___
Zope maillist  -  [EMAIL PROTECTED]
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 )




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

2000-07-31 Thread icottee



You are very welcome.

By the way, just to confirm I don't have the problems I had before with the new
0.4 version of FSSession so I have no need now to try and call FSSession twice.

Thanks once again

Ian



___
Zope maillist  -  [EMAIL PROTECTED]
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 )