Great Circle Associates Majordomo-Users
(May 1997)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: Re: Possible race condition in Majordomo 1.94.1 causing bounces
From: Dave Wolfe <dwolfe @ risc . sps . mot . com>
Date: Thu, 1 May 1997 10:22:39 -0500 (CDT)
To: pettern @ thule . no (Petter Nilsen)
Cc: Majordomo-users @ GreatCircle . COM, majordomo-workers @ GreatCircle . COM (Majordomo developer's mailing list), cwilson @ slurp . neu . sgi . com (Chan Wilson), majordomo-patches @ cloud . ccsf . cc . ca . us (Majordomo patches)
In-reply-to: <1301.7060T926T1494@thule.no> from "Petter Nilsen" at May 1, 97 03:26:29 pm
Reply-to: Dave Wolfe <david_wolfe @ risc . sps . mot . com>

[ Copied to Majordomo-workers due to the included patch ]

[ Petter Nilsen writes: ]
> 
> See the attached message from the bounce I got yesterday. I'm pretty
> sure what the problem is, and it's caused by majordomo. I haven't
> checked, and most likely won't since I don't want to experiment with
> majordomo which is running quite a few lists. Anyway, he's my theory
> about the problem:
> 
> - majordomo receives a message to a mailing list
> - majordomo receives a admin unsubscribe message from me for the same
>   list
> - majordomo updates the subscribtion list for this list, but doesn't
>   create a lockfile to keep others away until it's done.
> - majordomo tries to pass the subscribtion list to sendmail, which
>   fails since it's being modified. Also, it doesn't check if anyone is
>   actually modifying the list of subscribers (using that non-existing
>   lock file). The alias loop breaks, the mail bounces.
> 
> Is this the correct scenario? From what I can see from the sources,
> this could very well be the case. Any chance of a fix coming fairly
> soon?

It's true that there's no locking of the list between Mj and the MTA (do
any MTAs even attempt to lock included files?). In fact I noted this
awhile back (see the thread starting with:

    http://www.hpc.uh.edu/majordomo-users/9704/msg00346.html

The problem is a window when Mj is unsubscribing an address between the
time the list file is unlinked and the updated file is linked to the
list file name.

I proposed a patch but never got around to doing it when someone claimed
that rename() didn't exist in Perl 4. Seems to work fine in 4.036, so
here 'tis:

--- majordomo.orig	Sun Apr 20 11:11:49 1997
+++ majordomo	Thu May  1 09:46:05 1997
@@ -457,9 +457,8 @@
 		# we deleted exactly 1 name, so now we shuffle the files
 		link("$listdir/$clean_list", "$listdir/$clean_list.old") ||
 		    &abort("link(\"$listdir/$clean_list\", \"$listdir/$clean_list.old\"): $!");
-		unlink("$listdir/$clean_list");
-		link("$listdir/$clean_list.new", "$listdir/$clean_list") ||
-		    &abort("link(\"$listdir/$clean_list.new\", \"$listdir/$clean_list\"): $!");
+		rename("$listdir/$clean_list.new", "$listdir/$clean_list") ||
+		    &abort("rename(\"$listdir/$clean_list.new\", \"$listdir/$clean_list\"): $!");
 		unlink("$listdir/$clean_list.old");
 		if (defined $deflist) {
 		  print REPLY "Succeeded (from list $deflist).\n";

-- 
 Dave Wolfe


Follow-Ups:
References:
Indexed By Date Previous: Re: Possible race condition in Majordomo 1.94.1 causing bounces
From: Jeffrey Haas <jhaas@uiuc.edu>
Next: Re: Possible race condition in Majordomo 1.94.1 causing bounces
From: Petter Nilsen <pettern@thule.no>
Indexed By Thread Previous: Re: Possible race condition in Majordomo 1.94.1 causing bounces
From: Petter Nilsen <pettern@thule.no>
Next: Re: Possible race condition in Majordomo 1.94.1 causing bounces
From: Petter Nilsen <pettern@thule.no>

Google
 
Search Internet Search www.greatcircle.com