Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cPickle segfault with nested dicts in threaded env

1 view
Skip to first unread message

Kenneth Dombrowski

unread,
Sep 8, 2010, 2:58:22 PM9/8/10
to pytho...@python.org
Hi all,

Before creating an issue @ bugs.python.org I wanted to run the
following by everyone

We are having a difficult time with what looks like a cPickle issue
when given a data structure containing >15 nested dictionaries, but
only when threading is involved

Environment is FreeBSD 8, Python 2.5.5

The following diff contains an addition for
/usr/ports/lang/python25/work/Python-2.5.5/Lib/test/test_cpickle.py
which reproduces the issue

kenneth@kenneth0 Python-2.5.5 $ cat
/tmp/test_cpickle.nested_dicts_in_threaded_env.diff
1a2
> import copy
2a4
> import threading
93a96,105
> def test_nested_dicts_in_threaded_env(self):
> # segfaults on python2.5.5/FreeBSD 8.0-RELEASE-p2
> def threadloop():
> x = {}
> for i in range(16):
> x = {i:copy.copy(x)}
> cPickle.dumps(x, 2)
> t = threading.Thread(target=threadloop)
> t.start()
>

Any thoughts will be appreciated, thanks for looking,
Kenneth

Thomas Jollans

unread,
Sep 8, 2010, 3:55:56 PM9/8/10
to pytho...@python.org
On Wednesday 08 September 2010, it occurred to Kenneth Dombrowski to exclaim:

> Environment is FreeBSD 8, Python 2.5.5

Which architecture?

Also, Python 2.5 is frightfully old. There's not really any problem with still
using it, but nobody's maintaining it upstream, so don't bother reporting a
bug with Python 2.5, as you'll just be told to test a newer version. Check if
this still occurs in Python 2.7 and/or Python 3.1, and, if it does, then
please do report the bug.

Chances are this was actually fixed a couple of years ago. See:
http://bugs.python.org/issue3640
(and http://bugs.python.org/issue3338)

Carl Banks

unread,
Sep 8, 2010, 4:03:13 PM9/8/10
to
On Sep 8, 11:58 am, Kenneth Dombrowski <kdombrow...@gmail.com> wrote:
> Hi all,
>
> Before creating an issue @ bugs.python.org I wanted to run the
> following by everyone
>
> We are having a difficult time with what looks like a cPickle issue
> when given a data structure containing >15 nested dictionaries, but
> only when threading is involved
>
> Environment is FreeBSD 8, Python 2.5.5

Since Python 2.7 is released, Python 2.5 is no longer accepting bug
fixes, only security fixes. So be aware.


> The following diff contains an addition for
> /usr/ports/lang/python25/work/Python-2.5.5/Lib/test/test_cpickle.py
> which reproduces the issue
>
> kenneth@kenneth0 Python-2.5.5 $ cat
> /tmp/test_cpickle.nested_dicts_in_threaded_env.diff
> 1a2
>
> > import copy
> 2a4
> > import threading
> 93a96,105
> >     def test_nested_dicts_in_threaded_env(self):
> >         # segfaults on python2.5.5/FreeBSD 8.0-RELEASE-p2
> >         def threadloop():
> >             x = {}
> >             for i in range(16):
> >                 x = {i:copy.copy(x)}
> >             cPickle.dumps(x, 2)
> >         t = threading.Thread(target=threadloop)
> >         t.start()
>
> Any thoughts will be appreciated, thanks for looking,

Bug. Python should never segfault (unless you're doing bad things
with ctypes). Even if threading isn't supported in this case, it
should fail with an exception or have undefined behavior, not
segfault. I would check to see if the same problem exists on 2.7, and
file a bug report if so. If they fix it in 2.7 maybe you could apply
the same fix to your own 2.5.


Carl Banks

Paul Rubin

unread,
Sep 8, 2010, 6:55:31 PM9/8/10
to
Carl Banks <pavlove...@gmail.com> writes:
> Since Python 2.7 is released, Python 2.5 is no longer accepting bug
> fixes, only security fixes. So be aware.

Segfaults should be treated as security holes unless there's convincing
reasons that no exploit is possible. So the bug should be reported
against 2.5 as well as later versions.

Aahz

unread,
Sep 8, 2010, 11:53:10 PM9/8/10
to
In article <mailman.583.12839758...@python.org>,
Thomas Jollans <tho...@jollybox.de> wrote:
>
>Also, Python 2.5 is frightfully old. [...]

"Frightfully"??? I'm sure plenty of people are still using Python 2.3
in production environments (certainly my last job did as of 1.5 years
ago, and I would be mildly surprised if they upgraded by now).
--
Aahz (aa...@pythoncraft.com) <*> http://www.pythoncraft.com/

[on old computer technologies and programmers] "Fancy tail fins on a
brand new '59 Cadillac didn't mean throwing out a whole generation of
mechanics who started with model As." --Andrew Dalke

Kenneth Dombrowski

unread,
Sep 9, 2010, 11:06:42 AM9/9/10
to pytho...@python.org

Hi Paul,

Thanks for the input, it sounds reasonable to me. I reported it & the
maintainers can decide what to do with it:
http://bugs.python.org/issue9812

Thanks again everyone,
Kenneth

0 new messages