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

starting a thread in a nother thread

3 views
Skip to first unread message

Richard Lamboj

unread,
Jan 27, 2010, 8:06:23 AM1/27/10
to pytho...@python.org

hello,

just for _curiosity_. What would be if i start a thread in a nother thread and
acquire a lock in the "child" thread. Is there anything that could go wrong
if someone try to start threads in threads?

Kind Regards,

Richi

Stefan Behnel

unread,
Jan 27, 2010, 8:10:13 AM1/27/10
to
Richard Lamboj, 27.01.2010 14:06:

> just for _curiosity_. What would be if i start a thread in a nother thread and
> acquire a lock in the "child" thread. Is there anything that could go wrong
> if someone try to start threads in threads?

There's usually tons of things that can go wrong w.r.t. threads:

http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf

However, there's nothing special to a thread that was started from another
thread, so the problems don't change.

Stefan

Richard Lamboj

unread,
Jan 27, 2010, 9:23:35 AM1/27/10
to pytho...@python.org

Hello,

i have tried a little bit around with psycopg2 and threads,

I'am sharing one connection for all threads. When i'am starting the
threads "normal" everything works without any Problem. When i'am starting the
threads from another thread than i got a "segmentation fault" - i'am using
locks. I'am sending 2048 Reqeuest at once. The "normal" Methode with one
thread for every Request needs 10 seconds. The other Methode starting a
thread and starting two other threads from this thread crashes after 10 to 40
requests with the segmentation fault error. Any Idea why? Its a 64 bit
maschine. Maybe i'am making something wrong?

Kind Regards

Stefan Behnel

unread,
Jan 27, 2010, 9:30:17 AM1/27/10
to
Richard Lamboj, 27.01.2010 15:23:

> Am Wednesday 27 January 2010 14:10:13 schrieb Stefan Behnel:
>> Richard Lamboj, 27.01.2010 14:06:
>>> just for _curiosity_. What would be if i start a thread in a nother
>>> thread and acquire a lock in the "child" thread. Is there anything that
>>> could go wrong if someone try to start threads in threads?
>> There's usually tons of things that can go wrong w.r.t. threads:
>>
>> http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf
>>
>> However, there's nothing special to a thread that was started from another
>> thread, so the problems don't change.
>
> i have tried a little bit around with psycopg2 and threads,
>
> I'am sharing one connection for all threads. When i'am starting the
> threads "normal" everything works without any Problem. When i'am starting the
> threads from another thread than i got a "segmentation fault"

Sounds like a bug that you might want to report to the maintainers of psycopg2.

Stefan

Message has been deleted

John Nagle

unread,
Jan 27, 2010, 4:03:04 PM1/27/10
to

If a C package called from Python crashes, the package is defective.
Nothing you can do from Python should be able to cause a segmentation fault.

Google search: "Results 1 - 10 of about 29,400 for psycopg2 crash".

John Nagle

Richard Lamboj

unread,
Jan 28, 2010, 2:42:26 AM1/28/10
to pytho...@python.org

Yes i should make a bug report and thanks for your help.

Just some Debugginginfo:
[New Thread 0x429b5950 (LWP 27486)]
python-dbg: ../Objects/stringobject.c:116: PyString_FromString: Assertion
`str != ((void *)0)' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x431b6950 (LWP 27484)]
0x00007f6d932feed5 in raise () from /lib/libc.so.6

Aahz

unread,
Feb 1, 2010, 4:16:47 PM2/1/10
to
In article <4b60a661$0$1598$742e...@news.sonic.net>,

John Nagle <na...@animats.com> wrote:
>
>If a C package called from Python crashes, the package is defective.
>Nothing you can do from Python should be able to cause a segmentation
>fault.

...unless you use ctypes.
--
Aahz (aa...@pythoncraft.com) <*> http://www.pythoncraft.com/

import antigravity

0 new messages