New submission from Xiang Zhang <angwe...@126.com>:

A simple snippet:

import threading

def func():
        while True:
                print(1,2,3,4,5,6,7,8,9,10) 

t1 = threading.Thread(target=func)
t2 = threading.Thread(target=func)
t1.start()
t2.start()

Running this snippet and Ctrl-C raises FatalError:

^CException ignored in: <module 'threading' from 
'/root/Python-2.8.1/Lib/threading.py'>
Traceback (most recent call last):
1 2 3 4 5 6 7 8 9 10
  File "/root/Python-2.8.1/Lib/threading.py", line 1294, in _shutdown
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
    t.join()
  File "/root/Python-2.8.1/Lib/threading.py", line 1056, in join
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
    self._wait_for_tstate_lock()
  File "/root/Python-2.8.1/Lib/threading.py", line 1072, in 
_wait_for_tstate_lock
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
    elif lock.acquire(block, timeout):
KeyboardInterrupt
Fatal Python error: could not acquire lock for <_io.BufferedWriter 
name='<stdout>'> at interpreter shutdown, possibly due to daemon threads

Thread 0x00007f7f6b22e700 (most recent call first):
  File "/tmp/test.py", line 5 in func
  File "/root/Python-2.8.1/Lib/threading.py", line 864 in run
  File "/root/Python-2.8.1/Lib/threading.py", line 916 in _bootstrap_inner
  File "/root/Python-2.8.1/Lib/threading.py", line 884 in _bootstrap

Thread 0x00007f7f6ba2f700 (most recent call first):
  File "/tmp/test.py", line 5 in func
  File "/root/Python-2.8.1/Lib/threading.py", line 864 in run
  File "/root/Python-2.8.1/Lib/threading.py", line 916 in _bootstrap_inner
  File "/root/Python-2.8.1/Lib/threading.py", line 884 in _bootstrap

Current thread 0x00007f7f73761740 (most recent call first):
已放弃(吐核) /* segfault(core dump) */

----------
components: IO
messages: 311215
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: fatal error raised when Ctrl-C print loop
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32719>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to