New submission from Devin Jeanpierre:

The code attached runs a while loop that prints, and has a signal handler that 
also prints. There is a thread that constantly fires off signals, but this is 
just to ensure the condition for the bug happens -- this is a bug with signal 
handling, not threads -- I can trigger a RuntimeError (... with a missing 
message?) by commenting out the threading lines and instead running a separate 
process "while true; do kill -s SIGUSR1 4687; done".

Traceback:

$ python3 threading_print_test.py 
hello
world
Traceback (most recent call last):
  File "/usr/local/google/home/devinj/Downloads/threading_print_test.py", line 
36, in <module>
    main()
  File "/usr/local/google/home/devinj/Downloads/threading_print_test.py", line 
30, in main
    print("world")
  File "/usr/local/google/home/devinj/Downloads/threading_print_test.py", line 
13, in print_hello
    print("hello")
RuntimeError: reentrant call inside <_io.BufferedWriter name='<stdout>'>

----------
files: threading_print_test.py
messages: 244020
nosy: Devin Jeanpierre, haypo
priority: normal
severity: normal
status: open
title: Print not safe in signal handlers
Added file: http://bugs.python.org/file39491/threading_print_test.py

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

Reply via email to