NERDVANA has asked for the wisdom of the Perl Monks concerning the following question:
Well, believe it or not, we actually managed to accomplish this feat with the existing app and Plack server using an Inline::C pthread and PadWalker and shelling out to run mysql -e 'kill $conn_id' and some other insanity, but IT WORKS!
To celebrate this achievement, I would like to bundle it up in a CPAN module. The main goal is to abort/kill/cancel everything a single-threaded web worker is doing (in a highly configurable manner, of course) whenever we lose the ability to reply to the requestor. The best name I have so far is IO::SocketStatusSignaler IO::SocketStatusTrigger IO::SocketAlarm. Anyone have other ideas?
I'm also happy to entertain conversations about less-insane methods for solving this problem.
Update:
API Preview:
# When the client goes away, terminate the current process # and also kill the mysql query that is running on the server. my $watch= watch_socket( socket => $socket, event => EVENT_EOF|EVENT_EPIPE, actions => [ [ run => 'mysql', -e => "kill $id" ], [ kill => $$, SIGKILL ], ] );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Naming a CPAN module that watches for closed sockets
by talexb (Chancellor) on Jul 24, 2024 at 14:59 UTC | |
by NERDVANA (Curate) on Jul 24, 2024 at 23:28 UTC | |
Re: Naming a CPAN module that watches for closed sockets
by Danny (Hermit) on Jul 23, 2024 at 21:37 UTC | |
by NERDVANA (Curate) on Jul 23, 2024 at 22:48 UTC | |
by Discipulus (Canon) on Jul 24, 2024 at 07:28 UTC | |
by choroba (Cardinal) on Jul 24, 2024 at 10:40 UTC | |
by NERDVANA (Curate) on Jul 24, 2024 at 18:00 UTC | |
| |
by Danny (Hermit) on Jul 23, 2024 at 23:28 UTC |