This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author atagar
Recipients atagar
Date 2013-02-02.18:03:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1359828214.1.0.432640165119.issue17105@psf.upfronthosting.co.za>
In-reply-to
Content
Hi. While porting a library of mine (https://stem.torproject.org/) to python 3 I've been reliably encountering a python segmentation fault while running its integration tests. After many hours of head scratching I've narrowed the repro to the following script...

========================================

import queue
import socket

class Demo(object):
  def __init__(self, control_socket_file):
    demo_queue = queue.Queue()

    try:
      raise ValueError()
    except ValueError as exc:
      demo_queue.put(exc)

for i in range(20):
  control_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  control_socket.connect(("www.google.com", 80))
  control_socket_file = control_socket.makefile(mode = "rw", newline = "") 

  Demo(control_socket_file)

========================================

atagar@morrigan:~$ python3 --version
Python 3.2
atagar@morrigan:~$ python3 demo.py 
Segmentation fault

========================================

Yes, I realise that the script is stupidly convoluted but it was the minimal amount of code I could get to in order to reproduce the problem. Some things to note...

* You must have an object that gets a reference to an open socket based file.

* You need to have a try/catch block and enqueue that exception. If you get rid of the try/catch or enqueue something else then no segfault for you.

* The segfault isn't entirely reliable (seems so happen half the time or so), hence the loop.


While this repro script is pointless, it's the last issue preventing me from moving to python 3. At this point I'm out of idea so help would be greatly appreciated.

Thanks! -Damian

Python: Python 3.2 (r32:88445, Oct 20 2012, 14:09:50)
Platform: Ubuntu 11.04

PS. If the advice is 'upgrade python, 3.2 had some segfault bugs' then a pointer to those bugs would be appreciated. I've sunk quite a few hours into this issue so it would be nice to finally figure out what's up.
History
Date User Action Args
2013-02-02 18:03:34atagarsetrecipients: + atagar
2013-02-02 18:03:34atagarsetmessageid: <1359828214.1.0.432640165119.issue17105@psf.upfronthosting.co.za>
2013-02-02 18:03:34atagarlinkissue17105 messages
2013-02-02 18:03:33atagarcreate