Permalink
Browse files

+ -- when workers are writing status messages up to parent, die on SI…

…GPIPE,

+        or really any write errors, but just trap SIGPIPE now, if parent goes away



git-svn-id: http://code.sixapart.com/svn/gearman/trunk@121 011c6a6d-750f-0410-a5f6-93fdcd050bc4
  • Loading branch information...
1 parent 90c30db commit 73ff4bd0efd8ad009b047d76852bce63003aa392 bradfitz committed Jul 6, 2006
Showing with 21 additions and 5 deletions.
  1. +7 −1 CHANGES
  2. +1 −0 MANIFEST
  3. +3 −2 Makefile.PL
  4. +3 −0 TODO
  5. +3 −0 lib/Gearman/Client.pm
  6. +1 −1 lib/Gearman/Util.pm
  7. +3 −1 lib/Gearman/Worker.pm
View
@@ -1,3 +1,9 @@
-1.00 -- finally package it up and call it 1.00 now that we've been using
+1.01 UNRELEASED
+
+ -- when workers are writing status messages up to parent, die on SIGPIPE,
+ or really any write errors, but just trap SIGPIPE now, if parent goes away
+
+1.00
+ -- finally package it up and call it 1.00 now that we've been using
it in (LiveJournal) production for quite a while, finding/fixing
the bugs that happen when you put something into production.
View
@@ -15,3 +15,4 @@ t/10-all.t
t/worker.pl
CHANGES
HACKING
+TODO
View
@@ -4,11 +4,12 @@ use ExtUtils::MakeMaker;
# the contents of the Makefile that is written.
WriteMakefile(
'NAME'=> 'Gearman',
- 'VERSION' => '1.00',
- 'PREREQ_PM'=> {
+ 'VERSION_FROM' => 'lib/Gearman/Client.pm',
+ 'PREREQ_PM' => {
String::CRC32 => 0,
}, # e.g., Module::Name => 1.1
AUTHOR => 'Brad Fitzpatrick <brad@danga.com>',
+ ABSTRACT => "Client and worker libraries for gearman job dispatch dispatch. Server is in separate package.",
);
1;
View
@@ -0,0 +1,3 @@
+* deal with jobservers timing out (going off net) in the middle of
+ workers doing work and submitting a job, status, grabbing a job, etc
+
@@ -4,6 +4,9 @@
package Gearman::Client;
+our $VERSION;
+$VERSION = '1.01';
+
use strict;
use IO::Socket::INET;
use Socket qw(IPPROTO_TCP TCP_NODELAY SOL_SOCKET);
View
@@ -111,7 +111,7 @@ sub send_req {
return 0 unless $sock;
my $len = length($$reqref);
- #TODO: catch SIGPIPE
+ local $SIG{PIPE} = 'IGNORE';
my $rv = $sock->syswrite($$reqref, $len);
return 0 unless $rv == $len;
return 1;
@@ -37,7 +37,9 @@ sub set_status {
my $req = Gearman::Util::pack_req_command("work_status",
join("\0", $self->{handle}, $nu, $de));
- return Gearman::Util::send_req($self->{jss}, \$req);
+ die "work_status write failed" unless
+ Gearman::Util::send_req($self->{jss}, \$req);
+ return 1;
}
sub argref {

0 comments on commit 73ff4bd

Please sign in to comment.