C.<p><span class="h-card" translate="no"><a href="https://mindly.social/@wanderinghermit" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>wanderinghermit</span></a></span> </p><p>"Silently die" is commonly caused on Linux by the system OOM killer if the program allocates enough memory to drive the system into an out-of-memory state. Turning off overcommit on the system can be used to confirm this, as it will generally result in the Python program running until a MemoryError exception is thrown, and it will exit with a stacktrace rather than be killed before it can do so. Offhand I don't know what the behaviour on other OSes would be.</p><p>The print-prevents-dying thing I have seen before, but only when running programs on a remote machine. If there is no I/O at all happening, a network connection can end up getting reset for various reasons, causing the exit-to-shell behaviour. Adding print statements that happen to get called often enough to prevent this papers over the problem.</p><p>If this is the problem, and you're running over SSH, there are SSH options to make the session not die like this - keepalives.</p><p><a href="https://mindly.social/tags/SSH" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SSH</span></a> <a href="https://mindly.social/tags/network" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>network</span></a> <a href="https://mindly.social/tags/timeout" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>timeout</span></a> <a href="https://mindly.social/tags/NAT" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>NAT</span></a> <a href="https://mindly.social/tags/KeepAlive" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>KeepAlive</span></a> <a href="https://mindly.social/tags/die" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>die</span></a></p>