-
-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pickling OperationalError causes segfault with Python 2.7.3 #170
Comments
Originally submitted by: Chris Schmich More details: this appears to be an issue with the base error class, I was able to successfully pickle |
Chris, thank you for your report. Yes, bug confirmed. The problem is probably with exceptions containing no result (e.g. generated on connect), because for the ones generated after db operations pickling is fine (and unit-tested):
I'll add your case to the test suite too. About this issue tracker: yes, I was thinking about the problem yesterday after answering to #169. I would love to have Lighthouse history exported to github though. |
Originally submitted by: Chris Schmich Hi Daniele, Thanks for the quick response, and sorry for being so delayed in mine. Your explanation makes sense, and it's consistent with what I'm seeing. I'd be happy to help with the migration to GitHub (I started watching issue #171). I don't want to overlap with any work you guys are doing, so if there's a specific task you'd like me to do (e.g. writing an automation script to copy tickets from Lighthouse to GitHub), let me know. Thanks again! |
Issue fixed in my branch: dvarrazzo/psycopg@0e08fbb To be released in 2.5.2. |
Originally submitted by: Chris Schmich
When attempting to pickle an
OperationalError
, I get an immediate segfault. I understand thatOperationalError
might not be pickle-able, but I would expect a separate Python exception as a result, not a segfault.Minimal repro script:
@@@ python
import pickle
from psycopg2 import connect, OperationalError
print 'Start.'
try:
conn = connect("host='doesnotexist' dbname='foo'")
print 'Connected.'
except OperationalError as e:
print 'Exception.'
pickled = pickle.dumps(e)
print 'Pickled.'
print 'Fin.'
Start.
Exception.
Segmentation fault (core dumped)
Program received signal SIGSEGV, Segmentation fault.
dict_set_item_by_hash_or_entry (value=0x0, ep=0x0, hash=-2121493956, key='pgerror', op={})
at ../Objects/dictobject.c:762
762 ../Objects/dictobject.c: No such file or directory.
(gdb) bt
#230 dict_set_item_by_hash_or_entry (value=0x0, ep=0x0, hash=-2121493956, key='pgerror', op={})
#231 PyDict_SetItem (op=op@entry={}, key='pgerror', value=value@entry=0x0) at ../Objects/dictobject.c:818
#232 0x080f482f in PyDict_SetItemString (v={}, key=key@entry=0xb7ac6b9b "pgerror", item=0x0)
#233 0xb7ab9990 in psyco_error_reduce (self=0x838ef7c) at psycopg/error_type.c:166
#234 0x080e4975 in PyObject_Call (kw=0x0, arg=(), func=
#235 PyEval_CallObjectWithKeywords (func=func@entry=
#236 0x0814869f in PyObject_CallObject (o=o@entry=
#237 0x08115568 in object_reduce_ex.25465 (self=<OperationalError at remote 0x838ef7c>, args=(0,))
#238 0x080a517b in call_function (oparg=, pp_stack=0xbfffeb9c) at ../Python/ceval.c:4021
#239 PyEval_EvalFrameEx (f=f@entry=
#240 0x080a5728 in fast_function (nk=, na=, n=2, pp_stack=0xbfffec8c, func=
#241 call_function (oparg=, pp_stack=0xbfffec8c) at ../Python/ceval.c:4042
#242 PyEval_EvalFrameEx (f=f@entry=
#243 0x080a5728 in fast_function (nk=, na=, n=2, pp_stack=0xbfffed7c, func=
#244 call_function (oparg=, pp_stack=0xbfffed7c) at ../Python/ceval.c:4042
#245 PyEval_EvalFrameEx (f=f@entry=
#246 0x080abac9 in PyEval_EvalCodeEx (co=0xb7cfca88, globals=globals@entry=
#247 0x080a57cd in fast_function (nk=, na=1, n=, pp_stack=0xbfffeeec, func=
#248 call_function (oparg=, pp_stack=0xbfffeeec) at ../Python/ceval.c:4042
#249 PyEval_EvalFrameEx (f=f@entry=Frame 0x82d91e4, for file p.py, line 10, in (), throwflag=throwflag@entry=0)
#250 0x080abac9 in PyEval_EvalCodeEx (co=co@entry=0xb7d50cc8, globals=globals@entry=
#251 0x08113b57 in PyEval_EvalCode (co=co@entry=0xb7d50cc8, globals=globals@entry=
#252 0x0814ca7d in run_mod.42766 (mod=mod@entry=0x8354410, filename=filename@entry=0xbffff3c4 "p.py",
#253 0x0808e4d2 in PyRun_FileExFlags (fp=fp@entry=0x82d91d8, filename=filename@entry=0xbffff3c4 "p.py",
#254 0x0808ea80 in PyRun_SimpleFileExFlags (fp=0x82d91d8, filename=, closeit=1, flags=0xbffff0ec)
#255 0x0808eb42 in PyRun_AnyFileExFlags (fp=fp@entry=0x82d91d8, filename=filename@entry=0xbffff3c4 "p.py",
#26 0x0808f917 in Py_Main (argc=argc@entry=2, argv=argv@entry=0xbffff224) at ../Modules/main.c:639
#27 0x0808f9e9 in main (argc=2, argv=0xbffff224) at ../Modules/python.c:23
(gdb) py-list
301 return
302
303 # Check for a reduce_ex method, fall back to reduce
304 reduce = getattr(obj, "reduce_ex", None)
305 if reduce:
Thanks & regards,
Chris
P.S. While I completely respect your decision in how you manage your software, I must put in my vote for you to use GitHub's issue tracker. I say this because I am far more inclined to raise issues and support open source with a single, centralized account rather than having to create a new account for each piece of software I wish to give feedback on. Also, running into Lighthouse problems while even trying to post this issue was pretty discouraging. With that said, though, thanks for your work on this project!
The text was updated successfully, but these errors were encountered: