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.

Author stestagg
Recipients stestagg, xxm
Date 2020-12-29.14:28:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609252114.43.0.819397020382.issue42717@roundup.psfhosted.org>
In-reply-to
Content
It's one of those ugly multithreading issues that's really hard to reason about unfortunately.

In this case, it's not the size of the loop so much as you've discovered a way to make it very likely that the background thread is doing IO (and holding the IO lock) during shutdown.

Here's an example that reproduces the abort for me (again, it's multithreading, so you may have a different experience) with a smaller range value:

---
import sys, threading

def run():
    for i in range(100):
        sys.stderr.write(' =.= ' * 10000)

if __name__ == '__main__':
    threading.Thread(target=run, daemon=True).start()
---

The problem with daemon threads is that they get killed fairly suddenly and without much ability to correct bad state during shutdown, so any fix here would likely be around re-visiting the thread termination code as linked in the issue above.

There may be a fix possible, but it's going to be a complex thread state management fix, not just a limit on loop counts, unfortunately
History
Date User Action Args
2020-12-29 14:28:34stestaggsetrecipients: + stestagg, xxm
2020-12-29 14:28:34stestaggsetmessageid: <1609252114.43.0.819397020382.issue42717@roundup.psfhosted.org>
2020-12-29 14:28:34stestagglinkissue42717 messages
2020-12-29 14:28:33stestaggcreate