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 jinty
Recipients gvanrossum, jinty, r.david.murray, vstinner, yselivanov
Date 2015-10-29.17:20:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20151029172041.GA38847@Admins-MacBook-Air.local>
In-reply-to <1446043794.95.0.181430831888.issue25489@psf.upfronthosting.co.za>
Content
On Wed, Oct 28, 2015 at 02:49:55PM +0000, R. David Murray wrote:
> 
> R. David Murray added the comment:
> 
> Using sys.exit means you are depending on garbage collection to clean
> up all of your program's resources.  In the general case this is a bad
> idea.  A better design is to call loop.stop, and then do cleanup
> (which might involve calling some wait_closed functions via
> loop.run_until_complete).  If you just call sys.exit, your resources
> may not get cleaned up correctly, or may not get cleaned up correctly
> somewhat randomly due to the indeterminacies in the order in which
> garbage collection is done.  This may not matter for a simple program,
> but I find it makes it easier for me if I just do it "the right way"
> always :)

I think it depends on the problem, sometimes "crash-only" software is
safer. You have to design for immediate failure anyway, can't stop those
pesky hardware failures. So if you always immediately crash there is
only one, well-tested path to stopping a program.

Also saves a lot of cleanup code writing;)

Hmm, I suppose that means I should really be using os._exit(42) to avoid
garbage collection...
History
Date User Action Args
2015-10-29 17:20:45jintysetrecipients: + jinty, gvanrossum, vstinner, r.david.murray, yselivanov
2015-10-29 17:20:45jintylinkissue25489 messages
2015-10-29 17:20:45jintycreate