Message253686
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... |
|
Date |
User |
Action |
Args |
2015-10-29 17:20:45 | jinty | set | recipients:
+ jinty, gvanrossum, vstinner, r.david.murray, yselivanov |
2015-10-29 17:20:45 | jinty | link | issue25489 messages |
2015-10-29 17:20:45 | jinty | create | |
|