develooper Front page | perl.perl5.porters | Postings from November 2005

[perl #37777] Missing lines in disk files after multiple open close

From:
Cristiano Passerini
Date:
November 29, 2005 01:09
Subject:
[perl #37777] Missing lines in disk files after multiple open close
Message ID:
rt-3.0.11-37777-124945.2.27103852904499@perl.org
# New Ticket Created by  Cristiano Passerini 
# Please include the string:  [perl #37777]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=37777 >


This is a bug report for perl from cristiano.passerini@gmail.com,
generated with the help of perlbug 1.34 running under perl v5.8.1.


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

While testing a program written with the DBD::mysql module I noticed
that when writing on a sequence of files some lines missed from the
output.

The pseudo-code follows:
while(@{changing_variable}=$sth->fetchrows_array()){
  ...select a proper filename ...
  open OUT,">db_${changing_variable}.txt";
  while(${lines_to_process}){
    ...do_something...
    print OUT, "@{some_array}\n";
  }
  close OUT;
}

This code loses (erroneously) some lines in the output, meaning that if I do
the following:

while(@{changing_variable}=$sth->fetchrows_array()){
  ...select a proper filename ...
  while(${lines_to_process}){
    ...do_something...
    print "@{some_array}\n";
  }
}

and compare the results, I find that the first set of files counts a
minor number of total output lines with respect to the STDOUT
print. The missing number of lines per file is almost random, but it
is constant on a per file basis among different runs.  The \n is
always present in the last line of output of each generated files. The
file sizes seems not to be related with the IO buffer size.

The inner cycle runs extremely fast (MacOS fs loosing data?), less
than 200 ms.

If needed, I can provide the complete code and the dataset (of course
mysql dbs).

Thanks

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl v5.8.1:

Configured by root at Fri Sep 12 19:46:46 PDT 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 1 RC3) configuration:
  Platform:
    osname=darwin, osvers=7.0, archname=darwin-thread-multi-2level
    uname='darwin hampsten 7.0 darwin kernel version 6.0: fri jul 25
16:58:41 pdt 2003;
root:xnu-344.frankd.rootsxnu-344.frankd~objrelease_ppcpower macintosh
powerpc '
    config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe
-Dldflags=-Dman3ext=3pm -Duseithreads -Duseshrplib'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-g -pipe -pipe -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -I/usr/local/include',
    optimize='-Os',
    cppflags='-no-cpp-precomp -g -pipe -pipe -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build
1495)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=
libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-bundle -undefined dynamic_lookup
-L/usr/local/lib'

Locally applied patches:
    RC3

---
@INC for perl v5.8.1:
    /System/Library/Perl/5.8.1/darwin-thread-multi-2level
    /System/Library/Perl/5.8.1
    /Library/Perl/5.8.1/darwin-thread-multi-2level
    /Library/Perl/5.8.1
    /Library/Perl
    /Network/Library/Perl/5.8.1/darwin-thread-multi-2level
    /Network/Library/Perl/5.8.1
    /Network/Library/Perl
    .

---
Environment for perl v5.8.1:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/cristianopasserini
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:.
    PERL_BADLANG (unset)
    SHELL=/bin/bash



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