I'm trying to find out why DESTROY is sometimes called twice on some of my objects.
I've boiled the issue down to this script:
#!/usr/bin/perl package MyModule; use Devel::Peek; sub new { print "IN NEW\n"; return bless {}; } sub DESTROY { print "======= BEGIN DESTROY:".$$."========\n"; # print Dump(@_); print "============ END DESTROY:".$$."========\n"; } 1; package main; use Net::Server::PreFork; my $hardtodestroy = new MyModule; Net::Server::PreFork->run(max_servers=>1, min_servers=>1, min_spare_se +rvers=>0, max_spare_servers=>0);
Try run it a few (10, 20,...) times interrupting it with Ctrl-C. Eventually you'll get a run like this:
2014/05/19-08:55:41 Server closing! ======= BEGIN DESTROY:9980======== ======= BEGIN DESTROY:9980======== ============ END DESTROY:9980======== ======= BEGIN DESTROY:9979======== ============ END DESTROY:9979========
?!?!!? ... why was DESTROY called twice in the same process? ... and why didn't it end?
Enabling Devel::Peek will reveal it's 2 difference references to the same Perl object.
I've reproduced the problem on Perl 5.10/Debian and Perl 5.14/Ubuntu. ... but have been unable to find anything similar by googling which couldn't be explained by some error in an XS module. ... but I think I've ruled that out in the above example.
In reply to Is this absurd, or have I not RTFM? by petermogensen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |