python core dump (SIGBUS) on Solaris

Gary Pennington - UK Performance Centre Gary.Pennington at uk.sun.com
Wed Jul 7 04:11:30 EDT 1999


ScherBi at BAM.com wrote:

> I have a bus error problem with this module too.  Some cookies cause the
> error when trying to create an instance for reading cookies; eg:
>
> ck = Cookie.Cookie(os.environ['HTTP_COOKIE'])
>
> Not all cookies cause the error.  If I copy a suspect cookie string into a
> variable in an interactive session and try to create an instance as above,
> Python dumps core with a Bus Error.
>
> I've been able to create a work-around for now by parsing the cookie string,
> but just wanted to say that Mr. Pennington is not alone in this...
>
> PS.
> This is also on Solaris 2.6, compiled with gcc 2.8.1
>
> Bill Scherer
>

<snip>

I've done (a lot) more investigation since yesterday. It appears that the
problem is being generated inside cPickle in the loads function. I altered the
Cookie._debabelize function to trap the error more explicitly and found the
following:-

Test Code :-

    str = _unquote(val)
    try:
        return loads(str)
    except Exception:
        return str

Python 1.5.2 (#1, Jul  6 1999, 16:50:14)  [GCC egcs-2.91.66 19990314
(egcs-1.1.2  on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import Cookie
>>> C=Cookie.Cookie()
>>> C.load("webJudgeUser=garyp;")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python1.5/Cookie.py", line 544, in load
    self.__ParseString(rawdata)
  File "/usr/local/lib/python1.5/Cookie.py", line 572, in __ParseString
    M.set(K, apply(self.net_setfunc, (V,)), V)
  File "/usr/local/lib/python1.5/Cookie.py", line 342, in _debabelize
    return loads(str)
cPickle.BadPickleGet: path
>>>


Hmmm, something going wrong in the cPickle loads function not being trapped in
the exception handler unless you specifically state Exception.

I haven't got the skills/time to look at cPickle, so as a work-around I use the
pickle module and this works fine. Just modify the import statement at the top
of the Cookie.py module.

I hope this is helpful.

Yours,

Gary






More information about the Python-list mailing list