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.

classification
Title: Intermittant segmentation fault with ctrl-c (threads and queues)
Type: crash Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: shutdown (exit) can hang or segfault with daemon threads running
View: 1856
Assigned To: Nosy List: cgoldberg, ocean-city
Priority: normal Keywords:

Created on 2009-02-05 21:11 by cgoldberg, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg81228 - (view) Author: Corey Goldberg (cgoldberg) Date: 2009-02-05 21:11
I can get the Python interpreter to core dump when running the following
code:

http://pastebin.com/f261f398f

To reproduce:
- run the above code and press ctrl-c to quit while it is running.  It
crashes (segfault) the interpreter every few times you stop it like this.

I think it has something to do with the thread launching another thread
containing a queue.

- Tested on Windows XP and Ubuntu Linux 8.10 (both running Python 2.5.2)
msg81233 - (view) Author: Corey Goldberg (cgoldberg) Date: 2009-02-05 22:38
little more info:


If you create a Queue in the main thread and pass this to each worker
thread, it works fine.

If you create the Queue inside the worker thread and then pass it to a
new thread, it can crash.

when it crashes, you get an immediate core dump with no error messages
or stack trace.

This happens very intermittently but can be reproduced easily.
msg81255 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-02-06 09:36
Here is stack trace.

PyEval_EvalFrameEx(_frame * 0x00a62060, int 83) line 2841 + 6 bytes
fast_function(_object * 0x00000000, _object * * * 0x00fbfa98, int 1, int
1, int 9870576) line 3946
call_function(_object * * * 0x00fbfa98, int 0) line 3880 + 16 bytes
PyEval_EvalFrameEx(_frame * 0x00a60ac0, int 131) line 2515
fast_function(_object * 0x00000000, _object * * * 0x00fbfbe0, int 1, int
1, int 9870576) line 3946
call_function(_object * * * 0x00fbfbe0, int 0) line 3880 + 16 bytes
PyEval_EvalFrameEx(_frame * 0x00a60918, int 131) line 2515
PyEval_EvalCodeEx(PyCodeObject * 0x00a142c8, _object * 0x00a60918,
_object * 0x00000001, _object * * 0x00a194ac, int 1, _object * *
0x00000000, int 0, _object * * 0x00000000, int 0, _object * 0x00000000)
line 3104 + 11 bytes
function_call(_object * 0x00a35350, _object * 0x00a19498, _object *
0x00000000) line 529 + 64 bytes
PyObject_Call(_object * 0x00a35350, _object * 0x00a19498, _object *
0x00000000) line 2506 + 15 bytes
instancemethod_call(_object * 0x00a35350, _object * 0x00a19498, _object
* 0x00000000) line 2579 + 17 bytes
PyObject_Call(_object * 0x009fdef8, _object * 0x008c1038, _object *
0x00000000) line 2506 + 15 bytes
PyEval_CallObjectWithKeywords(_object * 0x009fdef8, _object *
0x008c1038, _object * 0x00000000) line 3729
t_bootstrap(void * 0x008c7608) line 426 + 26 bytes
bootstrap(void * 0x00234d08) line 122 + 7 bytes
_threadstartex(void * 0x009aeaf0) line 227 + 13 bytes
KERNEL32! 77e5b3bc()

//////////////////////////////////////////

	if (tstate->frame->f_exc_type != NULL) /* crash: tstate->frame is NULL */
		reset_exc_info(tstate);
	else {
		assert(tstate->frame->f_exc_value == NULL);
		assert(tstate->frame->f_exc_traceback == NULL);
	}
msg81357 - (view) Author: Corey Goldberg (cgoldberg) Date: 2009-02-08 00:27
note:
on Windows Vista it is not ery intermittant :)
crashes every time the program is stopped.
msg81382 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-02-08 14:58
This seems to be duplicate of issue1856. Let me close this entry.
History
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49410
2009-02-08 14:58:03ocean-citysetstatus: open -> closed
resolution: duplicate
superseder: shutdown (exit) can hang or segfault with daemon threads running
messages: + msg81382
2009-02-08 00:27:23cgoldbergsetmessages: + msg81357
2009-02-06 09:36:04ocean-citysetnosy: + ocean-city
messages: + msg81255
2009-02-05 22:38:48cgoldbergsetmessages: + msg81233
2009-02-05 21:11:51cgoldbergcreate