Great Circle Associates Majordomo-Workers
(October 1996)
 

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

Subject: Simultaneous opens for list file. Questions.
From: zielonko @ ucx . lkg . dec . com (Karol Zielonko - UCX engineering - (508)-486-5632)
Date: Fri, 11 Oct 1996 11:24:43 -0400
To: Majordomo-Workers @ greatcircle . com

Hello,

I am working on porting Majordomo to VMS. In doing so I have hit a problem which
I would like to ask you about.

In testing the SUBSCRIBE command in the majordomo script the process terminated
with a VMS error when trying to open the list file. The error was:

  %RMS-E-FLK, file currently locked by another user

I tracked it down in the code and I know why it's happening. The majordomo
script calls the shlock routine lopen() to open the list file for append access
and then procedes to call is_list_member() for the file which then opens the
file for input. To refresh your memory, here is an excerpt from majordomo.

	    # Lock and open the list first, even though &is_list_member()
	    #	 will reopen it read-only, to prevent a race condition
	    &lopen(LIST, ">>", "$listdir/$clean_list")
		|| &abort("Can't append to $listdir/$clean_list: $!");
	    if (&is_list_member($subscriber, $listdir, $clean_list)) {
		print REPLY "**** Address already subscribed to $clean_list\n";

I am pretty ignorant about Unix but I must assume that opening the file two
times simultaneously in this fashion is an entirely supported thing to do.
Unfortunately for me I can't do it quit like this in VMS so I will have to
change it.  Could you please tell me if you know of any other places in the code
where this technique is used? I am worried that the same thing might be hidden
deep in some thread that I, a Perl and Majordomo novice, could easily miss.

Please correct me if I'm wrong, the race condition mentioned in the comments is
two or more majordomo processes all trying to access the list file, no? You
prevent it by calling lopen() to lock the file so that the second process blocks
until the lock is released, no?

Thanks for your time,

Karol



Follow-Ups:
Indexed By Date Previous: Help with SGI
From: Gabriel Hall <gabriel@xtechinc.com>
Next: bug report 1.94b4
From: "Vincent D. Skahan" <vds7789@aw101.iasl.ca.boeing.com>
Indexed By Thread Previous: Latest beta 1.94b5?
From: "Joe R. Jah" <jjah@ccsf.cc.ca.us>
Next: Re: Simultaneous opens for list file. Questions.
From: Chan Wilson <cwilson@slurp.neu.sgi.com>

Google
 
Search Internet Search www.greatcircle.com