[Zope-dev] [Warning] Weird Zope behaviour: int(1200 * 0.20000000000000001) or 1 == -2147483648
Dieter Maurer
dieter@handshake.de
Mon, 14 Jan 2002 23:51:01 +0100
ZopeCVS (trunk) from 9.1.2002; Python 2.1.1; Linux 2
I just met really strange behaviour:
For testing purposes, I did:
export ZODB_READ_ONLY=1
python
>>> import Zope
This lead to a deadlock in "ThreadLock.acquire".
I ran the process in GDB with breakpoints in "ThreadLock.acquire"
and "ThreadLock.release". After a while, I get an
exception:
> File "/home/dieter/Haufe/src/Zope/lib/python/Zope/__init__.py", line 77, in ? OFS.Application.initialize(c)
> File "/home/dieter/Haufe/src/Zope/lib/python/OFS/Application.py", line 316, in initialize
> delNotification = delnotify, limit=limit)
> File "/home/dieter/Haufe/src/Zope/lib/python/Products/Transience/Transience.py", line 114, in __init__
> self._reset()
> File "/home/dieter/Haufe/src/Zope/lib/python/Products/Transience/Transience.py", line 334, in _reset
> self._ring = Ring(l, index)
> File "/home/dieter/Haufe/src/Zope/lib/python/Products/Transience/Transience.py", line 479, in __init__
> raise "ring must have at least one element"
> ring must have at least one element
Analysis reveals, that in "_reset" we have:
> (Pdb) p vars(self)
> {'_err_margin': 0.20000000000000001, 'id': 'session_data', '_delCallback': None, 'title': 'Session Data Container', '_timeout_secs': 1200, '_limit': 1000, '_addCallback': None, '_resolution_secs': -2147483648}
"_resolution_secs" is severely wrong! It was computed by:
> t_secs = self._timeout_secs
> r_secs = self._resolution_secs = int(t_secs * self._err_margin) or 1
and the result should have been "240" which I get, when I evaluate
the expression in "pdb".
Some serious bug is lingering here. I expect a memory corruption.
Dieter