Hi Marc,

I'm using AnyEvent::DBI and was getting some strange behavior (corrupt SQLite 
databases after a select(?)) and noticed that the spawned process did not 
always exit correctly, it sill existed even after the AnyEvent::DBI object was 
gone. After trashing the module with a lot of debug output I saw that the TERM 
signal was most likely ignored in the serve_fh and resulted in the process 
still waiting for input after the object was gone. Checked the code where the 
TERM signal was sent and saw that it only closes the socket, no specific 
shutdown. Added shutdown (both read/write) and it seems to have solved this 
issue.

Heres the patch:

diff -ur AnyEvent-DBI-2.3.orig/DBI.pm AnyEvent-DBI-2.3/DBI.pm
--- AnyEvent-DBI-2.3.orig/DBI.pm        2013-08-26 14:34:45.780104460 +0200
+++ AnyEvent-DBI-2.3/DBI.pm     2013-08-26 14:35:37.349725147 +0200
@@ -442,6 +442,7 @@
       kill TERM => $pid;
    }

+   shutdown $self->{fh}, 2;
    close delete $self->{fh};
 }

/Jerry

--
Jerry Lundström - Software Engineer
.SE - The Internet Infrastructure Foundation
http://www.iis.se/

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
anyevent mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/anyevent

Reply via email to