New submission from Тарас Войнаровський <voyn1...@gmail.com>:

My use case:
I have a background task, say called "coordination". In that task, I want to 
catch any errors and push those to the user waiting in the main task and only 
continue running the background coroutine after the user manually resolves the 
exception. 

Issue:
When testing the behaviour with ``unittest.Case`` and using ``assertRaises`` to 
catch the exception, the background coroutine manages to just freeze. I have 
narrowed it down to ``traceback.clear_frames`` in ``assertRaises`` that causes 
a GeneratorExit in the background coroutine.

I believe this issue is a duplicate to https://bugs.python.org/issue29211, but 
wanted to provide another actual use case where it can pop up. Also even if the 
generator raises a GeneratorExit, why did the background thread freeze is still 
a mystery to me.

Script to reproduce in my case is attached.

----------
components: asyncio
files: test_async_deadlock.py
messages: 333759
nosy: asvetlov, yselivanov, Тарас Войнаровський
priority: normal
severity: normal
status: open
title: traceback.clear_frames manages to deadlock a background task
type: behavior
versions: Python 3.6, Python 3.7
Added file: https://bugs.python.org/file48059/test_async_deadlock.py

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

Reply via email to