develooper Front page | perl.perl5.porters | Postings from October 1999

[ID 19991004.001] flock with dual processor fails

From:
richard
Date:
October 4, 1999 07:46
Subject:
[ID 19991004.001] flock with dual processor fails
Message ID:
19991004144652.15735.qmail@tmtowtdi.perl.org

This is a bug report for perl from noah@webclipping.com,
generated with the help of perlbug 1.26 running under perl 5.00502.


-----------------------------------------------------------------
[Please enter your report here]
Hi,

I just came across an interesting but.  Neither myself, anyone I know, or
the perl clinic can figure this one out.

We have multiple copies of the same program that lock and read the input
from a named pipe (FIFO).  This works GREAT with a single processor.  When
we try with more than one processor then more than one program can flock
the pipe at the same time creating a real mess.  It looks as if perl
internally is using one form of file locking that is not absolute.

below is a summary of the logic used.

use Fcntl ':flock';
flock(PIPE, LOCK_EX);
while(sysread(PIPE, $ch, 1) != 0 && $ch ne "\n") {
	$line .= $ch;
}
flock(PIPE, LOCK_UN);

Thanks,

-Noah Silverman


[Please do not change anything below this line]
-----------------------------------------------------------------

---
Site configuration information for perl 5.00502:

Configured by joshg at Wed May  5 10:45:20 EDT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos meow.dn.net 5.6 generic_105181-11 sun4m sparc sunw,sparcstation-20 '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O', gccversion=2.8.1
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldb -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl 5.00502:
    /usr/local/lib/perl5/5.00502/sun4-solaris
    /usr/local/lib/perl5/5.00502
    /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.005
    .

---
Environment for perl 5.00502:
    HOME=/code
    LANG (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/code/bin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/etc:/usr/etc:/usr/X/bin:/usr/dt/bin:/usr/ccs/bin:/usr/ucb:/usr/local/mysql/bin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/tcsh



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About