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:
|
|