Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

runrig (3385)


Just another perl hacker somewhere near Disneyland

I have this homenode [] of little consequence on Perl Monks [] that you probably have no interest in whatsoever.

I also have some modules [] on CPAN [] some of which are marginally [] more [] useful [] than others.

Journal of runrig (3385)

Wednesday March 24, 2010
01:24 PM

Gearman fun and frustration

[ #40265 ]

I've been using Gearman a lot lately with Gearman::XS. In an effort to reduce boilerplate, I've released GearmanX::Starter to launch Gearman workers.

Other features of the module are signal handling, where if a worker gets a SIGTERM, it'll finish any current task before terminating. To get this to work, I had to use Perl::Unsafe::Signals, otherwise you could not terminate the process while the worker was waiting for a job. It would only terminate after getting a new task from the server (causing the task to fail).

I had an interesting issue converting a worker script to using my GX::S module though...One line had $job->send_complete(1); which tells gearman to send the result "1" and a status of "complete" to the client. However, I was getting an error of "gearman_con_flush:write:14" when the worker was trying to wait for the next job. This didn't happen before I started using GX::S, but it was fixed when I changed the code to $job->send_complete("1"); (with quotes). I can not come up with a simple test case, but just in case someone else has the same issue, here's the possible work around.

Update: This is with Gearman::XS 0.7. It doesn't seem to occur with 0.8, so perhaps it's time to upgrade :-)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.