[ZODB-Dev] problem with _p_mtime
Tres Seaver
tseaver at palladion.com
Thu Dec 4 11:37:15 EST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Miles Waller wrote:
> Tres Seaver wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Miles wrote:
>>
>>> Hi,
>>>
>>> I've moved a FileStorage from one (old) machine to another (new)
>>> machine, but when I mount it on the new machine I get a lot of time errrors:
>>>
>>> Traceback (innermost last):
>>> Module ZPublisher.Publish, line 115, in publish
>>> Module ZPublisher.mapply, line 88, in mapply
>>> Module ZPublisher.Publish, line 41, in call_object
>>> Module Shared.DC.Scripts.Bindings, line 311, in __call__
>>> Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
>>> Module App.special_dtml, line 176, in _exec
>>> Module DocumentTemplate.DT_Let, line 76, in render
>>> Module DocumentTemplate.DT_In, line 703, in renderwob
>>> Module DocumentTemplate.DT_With, line 76, in render
>>> Module DocumentTemplate.DT_Var, line 214, in render
>>> Module App.PersistentExtra, line 43, in bobobase_modification_time
>>> Module DateTime.DateTime, line 509, in __init__
>>> Module DateTime.DateTime, line 760, in _parse_args
>>> Module DateTime.DateTime, line 437, in safelocaltime
>>> TimeError: The time 98040302366.810165 is beyond the range of this
>>> Python implementation.
>>>
>>> I googled around on this problem and didn't find much, but I did find
>>> that as a temporary fix, I've put a try/except in App.PersistentExtra,
>>> so if it generates an exception, it returns the current date and time.
>>> This keeps things working.
>>>
>>> Out of interst, can anyone tell me why there is a difference? On both
>>> machines, python was compiled from source with the same options, so I'm
>>> not sure what this is down to.
>>>
>>> More importantly, what's the most straightforward way to set all the
>>> dates to usable values? From my POV, it's fine to set them all to the
>>> current date, but I don't know how to go about doing this exhaustively.
>>>
>>> Thanks for your help,
>>>
>> For each machine: what version of Python and Zope? what OS?
>>
> Old machine: Python 2.3.5, Zope 2.8.6, OS is Red Hat 8.0 (!)
>
> New machine: Python 2.4.3, Zope 2.9.8, OS is Ubuntu 7.10
>
> I had discounted python/zope version differences as other databases had
> upgraded fine.
(CC'ing the newsgroup)
Zope is defending against a change in Python's time module, which in
turn is due to a change in the platform's time_t:
$ bin/python2.3
Python 2.3.7 (#1, Aug 20 2008, 12:39:04)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> int(98040302366.81016)
98040302366L
>>> from time import gmtime, localtime
>>> gmtime(int(98040302366.81016))
(1901, 12, 13, 20, 45, 52, 4, 347, 0)
>>> localtime(int(98040302366.81016))
(1901, 12, 13, 15, 45, 52, 4, 347, 0)
$ bin/python2.4
Python 2.4.4 (#2, Nov 14 2007, 13:58:47)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> int(98040302366.81016)
98040302366L
>>> from time import gmtime, localtime
>>> gmtime(int(98040302366.81016))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: timestamp out of range for platform time_t
>>> localtime(int(98040302366.81016))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: timestamp out of range for platform time_t
As you can see, the Python 2.3 version has a wraparound problem. I have
no idea how you got such an odd value stored for your '_p_mtime', unless
you have been using Guido's time machine to run your appserver in 2039. ;)
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFJOAcs+gerLs4ltQ4RAooLAKCbzF9wBkwhtnhISmIGqIt22y7+rACfThhx
IyjRAFhHuPE+LAVSj4Ct3Mk=
=iq+a
-----END PGP SIGNATURE-----
More information about the ZODB-Dev
mailing list