Archive Mail, Exim and Locking Bug? (was RE: [ MAILSCANNER] Locki ng failing?)
Desai, Jason
jase at SENSIS.COM
Fri Apr 25 21:09:44 IST 2003
Tony,
Some minor changes to your patch - I think you need to change the last added
"return" to "exit" in the second hunk or your patch. When messages got
quarantined as a whole messages instead of queue files, extra mailscanner
processes started hanging around and not exiting. I changed "return" to
"exit" and it seemed to fix the problem.
Also, should you change the first added "return" to "return 1" in the second
hunk to match the "return 1" at the end of the function?
I've attached an updated patch to this message in case I'm not communicating
clearly.
I'm no perl guru, but that's what I came up with. Thanks for your help!
Jason
> -----Original Message-----
> From: Tony Finch [mailto:dot at DOTAT.AT]
> Sent: Friday, April 25, 2003 1:17 PM
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Re: [MAILSCANNER] Archive Mail, Exim and Locking
> Bug? (was RE:
> [ MAILSCANNER] Locki ng failing?)
>
>
> "Desai, Jason" <jase at SENSIS.COM> wrote:
> >
> >Thanks Tony. I had just narrowed it down to losing the lock
> when copying
> >the -D file. If you want me to test any patches just let me know.
>
> I'm testing this at the moment.
>
> --- EximDiskStore.pm 27 Mar 2003 17:28:47 -0000 1.7
> +++ EximDiskStore.pm 25 Apr 2003 16:33:27 -0000 1.8
> @@ -358,14 +358,22 @@
>
>
> # Copy a dfile and hfile to a directory
> +# This has to be done in a subprocess in order to avoid
> breaking POSIX locks.
> sub CopyToDir {
> my($this,$dir) = @_;
> + my $pid = fork;
> + MailScanner::Log::DieLog("fork: $!") if not defined $pid;
> + if ($pid) {
> + waitpid $pid, 0;
> + return;
> + }
> my $hpath = $this->{hpath};
> my $dpath = $this->{dpath};
> my $hfile = basename($hpath);
> my $dfile = basename($dpath);
> copy($hpath, "$dir/$hfile");
> copy($dpath, "$dir/$dfile");
> + exit;
> }
>
>
> @@ -415,8 +423,18 @@
> if (MailScanner::Config::Value('storeentireasdfqf')) {
> $this->CopyToDir($targetdir);
> } else {
> + # Do this in a subprocess in order to avoid breaking POSIX locks.
> + my $pid = fork;
> + MailScanner::Log::DieLog("fork: $!") if not defined $pid;
> + if ($pid) {
> + waitpid $pid, 0;
> + return;
> + }
> my $target = new IO::File "$targetdir/$targetfile", "w";
> + MailScanner::Log::DieLog("writing to $targetdir/$targetfile: $!")
> + if not defined $target;
> $this->WriteEntireMessage($message, $target);
> + return;
> }
>
> return 1;
> @@ -447,9 +465,9 @@
>
> my $pipe = new IO::Pipe;
> my $pid;
> -
> +
> if (not defined $pipe or not defined ($pid = fork)) {
> - MailScanner::Log::WarnLog("Cannot build message from
> $this->{dpath} " .
> + MailScanner::Log::DieLog("Cannot build message from
> $this->{dpath} " .
> "and $message->{headerspath}, %s", $!);
> } elsif ($pid) { # Parent
> $pipe->reader();
>
>
> Tony.
> --
> f.a.n.finch <dot at dotat.at> http://dotat.at/
> MALIN HEBRIDES: EAST OR SOUTHEAST 5 OR 6. RAIN AT TIMES.
> MODERATE OR GOOD.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myMailScannerPatch.diff
Type: application/octet-stream
Size: 1611 bytes
Desc: not available
Url : http://lists.mailscanner.info/pipermail/mailscanner/attachments/20030425/926d5b83/myMailScannerPatch.obj
More information about the MailScanner
mailing list