Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unlink not working in specific piece of code, possibly an issue with threading or buffering? #6978

Closed
p5pRT opened this issue Dec 12, 2003 · 15 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 12, 2003

Migrated from rt.perl.org#24645 (status was 'rejected')

Searchable as RT24645$

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2003

From eric.egdorf@mci.com

Created by eric.egdorf@mci.com

I've got a program I'm writing that dumps text out to file, does "stuff" then
performs an unlink on the files. This has suddenly stopped working only in one
section of code. I am using the same commands in several functions and they work
fine in all occurances but this one. The code executes the unlink but the
files are still left on the file system. I've create several statements
to try to see what is occuring, code below. The interesting thing is that if
I try to reference the files in the code after the unlink I'll get an error
stating that the files don't exist, but if I look on the file system the
files are there. If I try to unlink twice I get an error that the file doesn't
exist and when I look at the file system the files are indeed gone. I find
it very strange that it is only occuring in one of several functions that use
the same commands.

  $tdir = "/tmp";
  $tfile = $tdir . "/storage_$$.tmp";
  ...
  open <FILE> ...
  ...
  close <FILE> ...

  $ddl = $tfile . ".DDL";
  $tmu = $tfile . ".TMU";

  print "" . `ls -l $tfile` . "";
  print "" . `ls -l $tmu` . "";
  print "" . `ls -l $ddl` . "\n";

  print "Deleting files\n";
  # unlink suddenly not removing files
  # but only in this function, figure that out
  unlink $tfile or die "Could not delete $tfile​: $!";
  unlink $ddl or die "Could not delete $ddl​: $!";
  unlink $tmu or die "Could not delete $tmu​: $!";
  print "Deleted files\n";

  print "\n" . `ls -l $tfile` . "";
  print "" . `ls -l $tmu` . "";
  print "" . `ls -l $ddl` . "\n";

  # if unlink is uncommented it will fail, if left commented out
  # the files do not get removed
  # unlink $ddl or die "Could not delete $ddl​: $!";
  # unlink $tmu or die "Could not delete $tmu​: $!";
  # unlink $tfile or die "Could not delete $tfile​: $!";

------------------------------------------------------------------------------------
Program Output
------------------------------------------------------------------------------------
-rw-rw-rw- 1 redbrick users 364 2003-12-12 02​:48 /tmp/storage_28156.tmp
-rw-rw-rw- 1 redbrick users 354 2003-12-12 02​:48 /tmp/storage_28156.tmp.TMU
-rw-rw-rw- 1 redbrick users 170 2003-12-12 02​:48 /tmp/storage_28156.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_28156.tmp​: No such file or directory
ls​: /tmp/storage_28156.tmp.TMU​: No such file or directory
ls​: /tmp/storage_28156.tmp.DDL​: No such file or directory
------------------------------------------------------------------------------------

------------------------------------------------------------------------------------
ls -l stor* Output
------------------------------------------------------------------------------------
-rw-rw-rw- 1 redbrick users 451 2003-12-12 02​:48 storage_28156.tmp
-rw-rw-rw- 1 redbrick users 306 2003-12-12 02​:48 storage_28156.tmp.DDL
-rw-rw-rw- 1 redbrick users 534 2003-12-12 02​:48 storage_28156.tmp.TMU
------------------------------------------------------------------------------------

As you can see the files are still there.

Executing code with the 2nd set of unlinks uncommented​:
------------------------------------------------------------------------------------
Program Output
------------------------------------------------------------------------------------
-rw-rw-rw- 1 redbrick users 364 2003-12-12 02​:51 /tmp/storage_28220.tmp
-rw-rw-rw- 1 redbrick users 354 2003-12-12 02​:51 /tmp/storage_28220.tmp.TMU
-rw-rw-rw- 1 redbrick users 170 2003-12-12 02​:51 /tmp/storage_28220.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_28220.tmp​: No such file or directory
ls​: /tmp/storage_28220.tmp.TMU​: No such file or directory
ls​: /tmp/storage_28220.tmp.DDL​: No such file or directory
Could not delete /tmp/storage_28220.tmp.DDL​: No such file or directory at /home/redbrick/tools/dev/schema/schema.pl line 503.
------------------------------------------------------------------------------------

------------------------------------------------------------------------------------
ls -l stor* Output
------------------------------------------------------------------------------------
ls​: stor*​: No such file or directory
------------------------------------------------------------------------------------

I've tried putting in several place holders and even threw in a sleep command
thinking that some sort of threading/buffering issue was going on but nothing
has worked. I am left to conclude that there is some weird bug in the perl
interpreter.

Perl Info

Flags:
    category=core
    severity=medium

This perlbug was built using Perl v5.8.0 - Thu Mar 13 22:21:38 UTC 2003
It is being executed now by  Perl v5.8.0 - Thu Mar 13 22:14:08 UTC 2003.

Site configuration information for perl v5.8.0:

Configured by root at Thu Mar 13 22:14:08 UTC 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.20, archname=i586-linux-thread-multi
    uname='linux d20 2.4.20 #1 smp thu oct 10 18:10:26 utc 2002 i686 unknown unknown gnulinux '
    config_args='-ds -e -Dprefix=/usr -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Duseshrplib=true'
    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 ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 --pipe',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing'
    ccversion='', gccversion='3.3 20030226 (prerelease) (SuSE Linux)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =''
    libpth=/lib /usr/lib /usr/local/lib
    libs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.0/i586-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared'

Locally applied patches:
    


@INC for perl v5.8.0:
    /usr/lib/perl5/5.8.0/i586-linux-thread-multi
    /usr/lib/perl5/5.8.0
    /usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl
    .


Environment for perl v5.8.0:
    HOME=/home/redbrick
    LANG=en_US
    LANGUAGE (unset)
    LC_COLLATE=POSIX
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/redbrick/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome2/bin:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/jre/bin:/opt/gnome/bin:/usr/java/j2sdk1.4.2_02/bin:.:/redbrick/bin:.:/redbrick/bin:/home/redbrick/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2003

From rick@bort.ca

On Fri, Dec 12, 2003 at 10​:06​:08AM -0000, eric.egdorf@​mci.com (via RT) wrote​:

------------------------------------------------------------------------------------
Program Output
------------------------------------------------------------------------------------
-rw-rw-rw- 1 redbrick users 364 2003-12-12 02​:48 /tmp/storage_28156.tmp
-rw-rw-rw- 1 redbrick users 354 2003-12-12 02​:48 /tmp/storage_28156.tmp.TMU
-rw-rw-rw- 1 redbrick users 170 2003-12-12 02​:48 /tmp/storage_28156.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_28156.tmp​: No such file or directory
ls​: /tmp/storage_28156.tmp.TMU​: No such file or directory
ls​: /tmp/storage_28156.tmp.DDL​: No such file or directory
------------------------------------------------------------------------------------

------------------------------------------------------------------------------------
ls -l stor* Output
------------------------------------------------------------------------------------

You might want to try a pwd here. The following files are not the same
as above.

-rw-rw-rw- 1 redbrick users 451 2003-12-12 02​:48 storage_28156.tmp
-rw-rw-rw- 1 redbrick users 306 2003-12-12 02​:48 storage_28156.tmp.DDL
-rw-rw-rw- 1 redbrick users 534 2003-12-12 02​:48 storage_28156.tmp.TMU
------------------------------------------------------------------------------------

As you can see the files are still there.

I see files there but I doubt they are *the* files. Try changing
`ls -l` to `ls -li` to be sure. If it turns out that they are the same
files then do try very hard to provide us with code that actually runs
so we can reproduce the bug.

--
Rick Delaney
rick@​bort.ca

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2003

From Robin.Barker@npl.co.uk

Created by eric.egdorf@mci.com

I've got a program I'm writing that dumps text out to file, does "stuff"
then
performs an unlink on the files. This has suddenly stopped working only
in one
section of code. I am using the same commands in several functions and
they work
fine in all occurances but this one. The code executes the unlink but
the
files are still left on the file system. I've create several statements
to try to see what is occuring, code below. The interesting thing is
that if
I try to reference the files in the code after the unlink I'll get an
error
stating that the files don't exist, but if I look on the file system the
files are there. If I try to unlink twice I get an error that the file
doesn't
exist and when I look at the file system the files are indeed gone. I
find
it very strange that it is only occuring in one of several functions
that use
the same commands.

  $tdir = "/tmp";
  $tfile = $tdir . "/storage_$$.tmp";
  ...
  open <FILE> ...
  ...
  close <FILE> ...

  $ddl = $tfile . ".DDL";
  $tmu = $tfile . ".TMU";

  print "" . `ls -l $tfile` . "";
  print "" . `ls -l $tmu` . "";
  print "" . `ls -l $ddl` . "\n";

  print "Deleting files\n";
  # unlink suddenly not removing files
  # but only in this function, figure that out
  unlink $tfile or die "Could not delete $tfile​: $!";
  unlink $ddl or die "Could not delete $ddl​: $!";
  unlink $tmu or die "Could not delete $tmu​: $!";
  print "Deleted files\n";

  print "\n" . `ls -l $tfile` . "";
  print "" . `ls -l $tmu` . "";
  print "" . `ls -l $ddl` . "\n";

  # if unlink is uncommented it will fail, if left commented out
  # the files do not get removed
  # unlink $ddl or die "Could not delete $ddl​: $!";
  # unlink $tmu or die "Could not delete $tmu​: $!";
  # unlink $tfile or die "Could not delete $tfile​: $!";

------------------------------------------------------------------------
------------
Program Output
------------------------------------------------------------------------
------------
-rw-rw-rw- 1 redbrick users 364 2003-12-12 02​:48
/tmp/storage_28156.tmp
-rw-rw-rw- 1 redbrick users 354 2003-12-12 02​:48
/tmp/storage_28156.tmp.TMU
-rw-rw-rw- 1 redbrick users 170 2003-12-12 02​:48
/tmp/storage_28156.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_28156.tmp​: No such file or directory
ls​: /tmp/storage_28156.tmp.TMU​: No such file or directory
ls​: /tmp/storage_28156.tmp.DDL​: No such file or directory
------------------------------------------------------------------------
------------

------------------------------------------------------------------------
------------
ls -l stor* Output
------------------------------------------------------------------------
------------
-rw-rw-rw- 1 redbrick users 451 2003-12-12 02​:48
storage_28156.tmp
-rw-rw-rw- 1 redbrick users 306 2003-12-12 02​:48
storage_28156.tmp.DDL
-rw-rw-rw- 1 redbrick users 534 2003-12-12 02​:48
storage_28156.tmp.TMU
------------------------------------------------------------------------
------------

As you can see the files are still there.

Executing code with the 2nd set of unlinks uncommented​:
------------------------------------------------------------------------
------------
Program Output
------------------------------------------------------------------------
------------
-rw-rw-rw- 1 redbrick users 364 2003-12-12 02​:51
/tmp/storage_28220.tmp
-rw-rw-rw- 1 redbrick users 354 2003-12-12 02​:51
/tmp/storage_28220.tmp.TMU
-rw-rw-rw- 1 redbrick users 170 2003-12-12 02​:51
/tmp/storage_28220.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_28220.tmp​: No such file or directory
ls​: /tmp/storage_28220.tmp.TMU​: No such file or directory
ls​: /tmp/storage_28220.tmp.DDL​: No such file or directory
Could not delete /tmp/storage_28220.tmp.DDL​: No such file or directory
at /home/redbrick/tools/dev/schema/schema.pl line 503.
------------------------------------------------------------------------
------------

------------------------------------------------------------------------
------------
ls -l stor* Output
------------------------------------------------------------------------
------------
ls​: stor*​: No such file or directory
------------------------------------------------------------------------
------------

I've tried putting in several place holders and even threw in a sleep
command
thinking that some sort of threading/buffering issue was going on but
nothing
has worked. I am left to conclude that there is some weird bug in the
perl
interpreter.

Perl Info

Flags:
    category=core
    severity=medium

This perlbug was built using Perl v5.8.0 - Thu Mar 13 22:21:38 UTC 2003
It is being executed now by  Perl v5.8.0 - Thu Mar 13 22:14:08 UTC 2003.

Site configuration information for perl v5.8.0:

Configured by root at Thu Mar 13 22:14:08 UTC 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.20, archname=i586-linux-thread-multi
    uname='linux d20 2.4.20 #1 smp thu oct 10 18:10:26 utc 2002 i686
unknown unknown gnulinux '
    config_args='-ds -e -Dprefix=/usr -Dusethreads -Di_db -Di_dbm
-Di_ndbm -Di_gdbm -Duseshrplib=true'
    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 ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 --pipe',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing'
    ccversion='', gccversion='3.3 20030226 (prerelease) (SuSE Linux)',
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =''
    libpth=/lib /usr/lib /usr/local/lib
    libs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic
-Wl,-rpath,/usr/lib/perl5/5.8.0/i586-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared'

Locally applied patches:
    


@INC for perl v5.8.0:
    /usr/lib/perl5/5.8.0/i586-linux-thread-multi
    /usr/lib/perl5/5.8.0
    /usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl
    .


Environment for perl v5.8.0:
    HOME=/home/redbrick
    LANG=en_US
    LANGUAGE (unset)
    LC_COLLATE=POSIX
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
 
PATH=/home/redbrick/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr
/games:/opt/gnome2/bin:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/jre/bi
n:/opt/gnome/bin:/usr/java/j2sdk1.4.2_02/bin:.:/redbrick/bin:.:/redbrick
/bin:/home/redbrick/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Teddington, Middlesex, United Kingdom TW11 0LW.
-------------------------------------------------------------------


@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2003

From eric.egdorf@mci.com

Created by eric.egdorf@mci.com

I've got a program I'm writing that dumps text out to file, does "stuff"
then
performs an unlink on the files. This has suddenly stopped working only
in one
section of code. I am using the same commands in several functions and
they work
fine in all occurances but this one. The code executes the unlink but
the
files are still left on the file system. I've create several statements
to try to see what is occuring, code below. The interesting thing is
that if
I try to reference the files in the code after the unlink I'll get an
error
stating that the files don't exist, but if I look on the file system the
files are there. If I try to unlink twice I get an error that the file
doesn't
exist and when I look at the file system the files are indeed gone. I
find
it very strange that it is only occuring in one of several functions
that use
the same commands.

  $tdir = "/tmp";
  $tfile = $tdir . "/storage_$$.tmp";
  ...
  open <FILE> ...
  ...
  close <FILE> ...

  $ddl = $tfile . ".DDL";
  $tmu = $tfile . ".TMU";

  print "" . `ls -l $tfile` . "";
  print "" . `ls -l $tmu` . "";
  print "" . `ls -l $ddl` . "\n";

  print "Deleting files\n";
  # unlink suddenly not removing files
  # but only in this function, figure that out
  unlink $tfile or die "Could not delete $tfile​: $!";
  unlink $ddl or die "Could not delete $ddl​: $!";
  unlink $tmu or die "Could not delete $tmu​: $!";
  print "Deleted files\n";

  print "\n" . `ls -l $tfile` . "";
  print "" . `ls -l $tmu` . "";
  print "" . `ls -l $ddl` . "\n";

  # if unlink is uncommented it will fail, if left commented out
  # the files do not get removed
  # unlink $ddl or die "Could not delete $ddl​: $!";
  # unlink $tmu or die "Could not delete $tmu​: $!";
  # unlink $tfile or die "Could not delete $tfile​: $!";

------------------------------------------------------------------------
------------
Program Output
------------------------------------------------------------------------
------------
-rw-rw-rw- 1 redbrick users 364 2003-12-12 02​:48
/tmp/storage_28156.tmp
-rw-rw-rw- 1 redbrick users 354 2003-12-12 02​:48
/tmp/storage_28156.tmp.TMU
-rw-rw-rw- 1 redbrick users 170 2003-12-12 02​:48
/tmp/storage_28156.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_28156.tmp​: No such file or directory
ls​: /tmp/storage_28156.tmp.TMU​: No such file or directory
ls​: /tmp/storage_28156.tmp.DDL​: No such file or directory
------------------------------------------------------------------------
------------

------------------------------------------------------------------------
------------
ls -l stor* Output
------------------------------------------------------------------------
------------
-rw-rw-rw- 1 redbrick users 451 2003-12-12 02​:48
storage_28156.tmp
-rw-rw-rw- 1 redbrick users 306 2003-12-12 02​:48
storage_28156.tmp.DDL
-rw-rw-rw- 1 redbrick users 534 2003-12-12 02​:48
storage_28156.tmp.TMU
------------------------------------------------------------------------
------------

As you can see the files are still there.

Executing code with the 2nd set of unlinks uncommented​:
------------------------------------------------------------------------
------------
Program Output
------------------------------------------------------------------------
------------
-rw-rw-rw- 1 redbrick users 364 2003-12-12 02​:51
/tmp/storage_28220.tmp
-rw-rw-rw- 1 redbrick users 354 2003-12-12 02​:51
/tmp/storage_28220.tmp.TMU
-rw-rw-rw- 1 redbrick users 170 2003-12-12 02​:51
/tmp/storage_28220.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_28220.tmp​: No such file or directory
ls​: /tmp/storage_28220.tmp.TMU​: No such file or directory
ls​: /tmp/storage_28220.tmp.DDL​: No such file or directory
Could not delete /tmp/storage_28220.tmp.DDL​: No such file or directory
at /home/redbrick/tools/dev/schema/schema.pl line 503.
------------------------------------------------------------------------
------------

------------------------------------------------------------------------
------------
ls -l stor* Output
------------------------------------------------------------------------
------------
ls​: stor*​: No such file or directory
------------------------------------------------------------------------
------------

I've tried putting in several place holders and even threw in a sleep
command
thinking that some sort of threading/buffering issue was going on but
nothing
has worked. I am left to conclude that there is some weird bug in the
perl
interpreter.

Perl Info

Flags:
    category=core
    severity=medium

This perlbug was built using Perl v5.8.0 - Thu Mar 13 22:21:38 UTC 2003
It is being executed now by  Perl v5.8.0 - Thu Mar 13 22:14:08 UTC 2003.

Site configuration information for perl v5.8.0:

Configured by root at Thu Mar 13 22:14:08 UTC 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.20, archname=i586-linux-thread-multi
    uname='linux d20 2.4.20 #1 smp thu oct 10 18:10:26 utc 2002 i686
unknown unknown gnulinux '
    config_args='-ds -e -Dprefix=/usr -Dusethreads -Di_db -Di_dbm
-Di_ndbm -Di_gdbm -Duseshrplib=true'
    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 ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 --pipe',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing'
    ccversion='', gccversion='3.3 20030226 (prerelease) (SuSE Linux)',
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =''
    libpth=/lib /usr/lib /usr/local/lib
    libs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic
-Wl,-rpath,/usr/lib/perl5/5.8.0/i586-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared'

Locally applied patches:
    


@INC for perl v5.8.0:
    /usr/lib/perl5/5.8.0/i586-linux-thread-multi
    /usr/lib/perl5/5.8.0
    /usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl
    .


Environment for perl v5.8.0:
    HOME=/home/redbrick
    LANG=en_US
    LANGUAGE (unset)
    LC_COLLATE=POSIX
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
 
PATH=/home/redbrick/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr
/games:/opt/gnome2/bin:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/jre/bi
n:/opt/gnome/bin:/usr/java/j2sdk1.4.2_02/bin:.:/redbrick/bin:.:/redbrick
/bin:/home/redbrick/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Teddington, Middlesex, United Kingdom TW11 0LW.
-------------------------------------------------------------------



@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2003

From eric.egdorf@mci.com

Got emails from both of you so decided to copy both... Here is the output with the ls -li, the inode numbers matched.

program output​:

250746 -rw-rw-rw- 1 redbrick users 364 2003-12-12 10​:32 /tmp/storage_6476.tmp
250757 -rw-rw-rw- 1 redbrick users 353 2003-12-12 10​:32 /tmp/storage_6476.tmp.TMU
249303 -rw-rw-rw- 1 redbrick users 170 2003-12-12 10​:32 /tmp/storage_6476.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_6476.tmp​: No such file or directory
ls​: /tmp/storage_6476.tmp.TMU​: No such file or directory
ls​: /tmp/storage_6476.tmp.DDL​: No such file or directory

ls command output​:

250746 -rw-rw-rw- 1 redbrick users 451 2003-12-12 10​:32 storage_6476.tmp
249303 -rw-rw-rw- 1 redbrick users 306 2003-12-12 10​:32 storage_6476.tmp.DDL
250757 -rw-rw-rw- 1 redbrick users 533 2003-12-12 10​:32 storage_6476.tmp.TMU

Eric Egdorf
DBA -- EPS
MCI
719-535-4289
v622-4289

-----Original Message-----
From​: Rick Delaney via RT [mailto​:perlbug-followup@​perl.org]
Sent​: Friday, December 12, 2003 8​:36 AM
To​: eric.egdorf@​mci.com
Subject​: Re​: [perl #24645] unlink not working in specific piece of code,
possibly an issue with threading or buffering?

On Fri, Dec 12, 2003 at 10​:06​:08AM -0000, eric.egdorf@​mci.com (via RT) wrote​:

------------------------------------------------------------------------------------
Program Output
------------------------------------------------------------------------------------
-rw-rw-rw- 1 redbrick users 364 2003-12-12 02​:48 /tmp/storage_28156.tmp
-rw-rw-rw- 1 redbrick users 354 2003-12-12 02​:48 /tmp/storage_28156.tmp.TMU
-rw-rw-rw- 1 redbrick users 170 2003-12-12 02​:48 /tmp/storage_28156.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_28156.tmp​: No such file or directory
ls​: /tmp/storage_28156.tmp.TMU​: No such file or directory
ls​: /tmp/storage_28156.tmp.DDL​: No such file or directory
------------------------------------------------------------------------------------

------------------------------------------------------------------------------------
ls -l stor* Output
------------------------------------------------------------------------------------

You might want to try a pwd here. The following files are not the same
as above.

-rw-rw-rw- 1 redbrick users 451 2003-12-12 02​:48 storage_28156.tmp
-rw-rw-rw- 1 redbrick users 306 2003-12-12 02​:48 storage_28156.tmp.DDL
-rw-rw-rw- 1 redbrick users 534 2003-12-12 02​:48 storage_28156.tmp.TMU
------------------------------------------------------------------------------------

As you can see the files are still there.

I see files there but I doubt they are *the* files. Try changing
`ls -l` to `ls -li` to be sure. If it turns out that they are the same
files then do try very hard to provide us with code that actually runs
so we can reproduce the bug.

--
Rick Delaney
rick@​bort.ca

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2003

From guest@guest.guest.xxxxxxxx

Isolated the problem, sort of. It appears the problem is that the
variablefor the file name, $tfile, is somehow getting changed between
assignment and reference. I'm assigning it a value at the beginning of
the function, but the values are different each time it gets referenced
in the code withouth getting reassigned.

I saw that the notes for 8.1 and 8.2 mention memory leak issues so I'm
wondering if maybe I'm just hitting one of those.

Code​:

#-------------------------------------------------------------------------
# FUNCTION​: genTable
#-------------------------------------------------------------------------
# generate the create table statements
#-------------------------------------------------------------------------
sub genTable
{
  if ( $DEBUG >= 4 )
  {
  print "Entering genTable\n";
  }

  $tfile = $tdir . "/columns_$$.tmp";

  $ntbs = $#tables;

  # read through the table list -- wherefor for and not foreach?
  for ( $tcnt = 0; $tcnt < $ntbs + 1; $tcnt++ )
  {

  $table = $tables[$tcnt][0] ;
  $maxsegs = $tables[$tcnt][1] ;
  $maxrows = $tables[$tcnt][2] ;
  $maxsize = $tables[$tcnt][3] ;
  $tcom = $tables[$tcnt][4] ;

  # generate create segment statements?
  if ( ! $s_NS ) { genStorage($table); }

  $SELECT = "select name, type, length, precision, scale, start, ";
  $SELECT .= "step, fillfactor, nulls, uniq, pkseq, comment as ccom, ";
  $SELECT .= "defaultvalue ";

  $FROM = "from rbw_columns ";

  $WHERE = "where tname = '" . uc($table) . "' ";

  $GROUP = "";

  $ORDER = "order by seq ";

  if ( $DEBUG >= 3 )
  {
  print "----- DEBUG ----- \n";
  print "SELECT​: $SELECT \n";
  print "FROM : $FROM \n";
  print "WHERE : $WHERE \n";
  print "GROUP : $GROUP \n";
  print "ORDER : $ORDER \n";
  }

  # tfile has different value then one assigned above
  # unless it is reassigned here
  $tfile = $tdir . "/columns_$$.tmp";
 
  $cmd = qq# $sqlcmd <<EOF

  export to '$tfile'
  format delimited
  ( $SELECT
  $FROM
  $WHERE
  $GROUP
  $ORDER
  )
EOF
#;

  if ( $DEBUG >= 3 )
  {
  print "cmd​: $cmd\n";
  print "tfile​: $tfile\n";
  }

  $ret = `$cmd`;

  if ( $ret !~ "EXPORT" )
  {
  print "Error getting column information from database​:\n";
  print "$ret\n";
  exit;
  }

  open(COLS, $tfile) or die "Could not open file $tfile​: $!";

  @​clmn = <COLS>;

  $cnt = 0;

  $ncols = $#clmn;

  $c_cnt = 0; # number of coumments

  print "create table $table\n(\n";

  @​c_com = ();

  foreach $c_data ( @​clmn )
  {
  $col = "";

  @​column = split /\|/, $c_data;

  # print "c_data​:\n$c_data\n";
  # print "column​:\n@​column\n";

  $cname = $column[0];
  $type = $column[1];
  $length = $column[2];
  $precision = $column[3];
  $scale = $column[4];
  $start = $column[5];
  $step = $column[6];
  $fillfactor = $column[7];
  $nulls = $column[8];
  $uniq = $column[9];
  $pkseq = $column[10];
  $comment = $column[11];
  $default = $column[12];

  if ( $comment ne "" )
  {
  $c_com[$c_cnt++] = "alter table $table alter column $cname
comment '$comment'";
  }

  if ( $pkseq ne "" )
  {
  $pkseq = int($pkseq);
  }

  $col .= "$cname $type ";

  if ( $type eq "INTEGER" )
  {
  $col .= "";
  }
  elsif ( $type eq "SMALLINT" )
  {
  $col .= "";
  }
  elsif ( $type eq "TINYINT" )
  {
  $col .= "";
  }
  elsif ( $type eq "SERIAL" )
  {
  $col .= "( " . int($start) . " , " . int($step) . " ) ";
  }
  elsif ( $type eq "TINYINT" )
  {
  $col .= "";
  }
  elsif ( $type eq "REAL" )
  {
  $col .= "";
  }
  elsif ( $type eq "DOUBLE" )
  {
  $col .= "PRECISION ";
  }
  elsif ( $type eq "FLOAT" )
  {
  $col .= "( " . int($precision) . " , " . int($scale) . " ) ";
  }
  elsif ( $type eq "NUMERIC" )
  {
  $col .= "PRECISION ";
  }
  elsif ( $type eq "DECIMAL" )
  {
  $col .= "( " . int($precision) . " , " . int($scale) . " ) ";
  }
  elsif ( $type eq "CHAR" )
  {
  $col .= "( " . int($length) . " ) ";
  }
  elsif ( $type eq "VARCHAR" )
  {
  $col .= "( " . int($length) . " ) ";

  if ( $fillfactor ne "" )
  {
  $col .= "fillfactor ( " . int($fillfactor) . " ) ";
  }
  }
  elsif ( $type eq "DATE" )
  {
  $col .= "";
  }
  elsif ( $type eq "TIME" )
  {
  $col .= "( " . int($precision) . " ) ";
  }
  elsif ( $type eq "TIMESTAMP" )
  {
  $col .= "( " . int($precision) . " ) ";
  }
  else
  {
  print "Unknown data type encountered​: $type\n";
  exit;
  }

  if ( $nulls eq "N" )
  {
  $col .= "not null ";
  }

  if ( $uniq eq "Y" )
  {
  $col .= "unique ";
  }

  if ( $default ne "" )
  {
  # remove trailing white space
  $default =~ s/\s+?$//;
  $col .= "default '" . $default . "' ";
  }

  if ( $cnt < $ncols ) { $col .= ",\n"; }

  print " $col";

  $cnt++;
  }

  # additional statements
  #----------------------------------------------------------
  # retrieve PK info and display then get FK info
  # constraints
  # data in
  # ranges

  # I thought the new functions might be the problem so
  # I commented them out, get the same reault even if they
  # don't execute
  genPKConstraints($table);

  genFKConstraints($table);

  print "\n);\n\n";

  if ( $maxsegs ne "" )
  {
  print "maxsegments " . int($maxsegs) . "\n";
  }

  if ( $maxrows ne "" )
  {
  print "maxrows per seg " . int($maxrows) . "\n";
  }

  print ";\n";

  if ( $tcom ne "" )
  {
  # remove any trailing white space
  $tcom =~ s/\s+?$//;
  print "\nalter table $table comment '$tcom';\n";
  }

  foreach $ccmt (@​c_com)
  {
  print "$ccmt\n";
  }
  }

  # tfile has different value then values assigned above
  # unless it is reassigned here
  $tfile = $tdir . "/columns_$$.tmp";

  $ddl = $tfile . ".DDL";
  $tmu = $tfile . ".TMU";
 
  print "" . `ls -li $tfile` . "";
  print "" . `ls -li $tmu` . "";
  print "" . `ls -li $ddl` . "\n";

  print "Deleting files\n";

  unlink $tfile or die "Could not delete $tfile​: $!";
  unlink $ddl or die "Could not delete $ddl​: $!";
  unlink $tmu or die "Could not delete $tmu​: $!";

  print "Deleted files\n";

  print "" . `ls -li $tfile` . "";
  print "" . `ls -li $tmu` . "";
  print "" . `ls -li $ddl` . "\n";

  close(COLS);

  if ( $DEBUG >= 4 )
  {
  print "Exiting genTable\n";
  }
}
### END genTable()

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2003

From eric.egdorf@mci.com

My code file is about 1000 lines. Should I post it or would anybody like me to send it to them as an attachment?

Eric Egdorf
DBA -- EPS
MCI
719-535-4289
v622-4289

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2003

From nick@ing-simmons.net

Eric Egdorf <Eric.Egdorf@​mci.com> writes​:

Got emails from both of you so decided to copy both... Here is the output with the ls -li, the inode numbers matched.

program output​:

250746 -rw-rw-rw- 1 redbrick users 364 2003-12-12 10​:32 /tmp/storage_6476.tmp
250757 -rw-rw-rw- 1 redbrick users 353 2003-12-12 10​:32 /tmp/storage_6476.tmp.TMU
249303 -rw-rw-rw- 1 redbrick users 170 2003-12-12 10​:32 /tmp/storage_6476.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_6476.tmp​: No such file or directory
ls​: /tmp/storage_6476.tmp.TMU​: No such file or directory
ls​: /tmp/storage_6476.tmp.DDL​: No such file or directory

ls command output​:

250746 -rw-rw-rw- 1 redbrick users 451 2003-12-12 10​:32 storage_6476.tmp
249303 -rw-rw-rw- 1 redbrick users 306 2003-12-12 10​:32 storage_6476.tmp.DDL
250757 -rw-rw-rw- 1 redbrick users 533 2003-12-12 10​:32 storage_6476.tmp.TMU

Sizes are changing - is something else writing them?

Eric Egdorf
DBA -- EPS
MCI
719-535-4289
v622-4289

-----Original Message-----
From​: Rick Delaney via RT [mailto​:perlbug-followup@​perl.org]
Sent​: Friday, December 12, 2003 8​:36 AM
To​: eric.egdorf@​mci.com
Subject​: Re​: [perl #24645] unlink not working in specific piece of code,
possibly an issue with threading or buffering?

On Fri, Dec 12, 2003 at 10​:06​:08AM -0000, eric.egdorf@​mci.com (via RT) wrote​:

------------------------------------------------------------------------------------
Program Output
------------------------------------------------------------------------------------
-rw-rw-rw- 1 redbrick users 364 2003-12-12 02​:48 /tmp/storage_28156.tmp
-rw-rw-rw- 1 redbrick users 354 2003-12-12 02​:48 /tmp/storage_28156.tmp.TMU
-rw-rw-rw- 1 redbrick users 170 2003-12-12 02​:48 /tmp/storage_28156.tmp.DDL

Deleting files
Deleted files
ls​: /tmp/storage_28156.tmp​: No such file or directory
ls​: /tmp/storage_28156.tmp.TMU​: No such file or directory
ls​: /tmp/storage_28156.tmp.DDL​: No such file or directory
------------------------------------------------------------------------------------

------------------------------------------------------------------------------------
ls -l stor* Output
------------------------------------------------------------------------------------

You might want to try a pwd here. The following files are not the same
as above.

-rw-rw-rw- 1 redbrick users 451 2003-12-12 02​:48 storage_28156.tmp
-rw-rw-rw- 1 redbrick users 306 2003-12-12 02​:48 storage_28156.tmp.DDL
-rw-rw-rw- 1 redbrick users 534 2003-12-12 02​:48 storage_28156.tmp.TMU
------------------------------------------------------------------------------------

As you can see the files are still there.

I see files there but I doubt they are *the* files. Try changing
`ls -l` to `ls -li` to be sure. If it turns out that they are the same
files then do try very hard to provide us with code that actually runs
so we can reproduce the bug.

@p5pRT
Copy link
Author

p5pRT commented Dec 14, 2003

From @pjcj

On Fri, Dec 12, 2003 at 10​:36​:06AM -0700, Eric Egdorf wrote​:

My code file is about 1000 lines. Should I post it or would anybody
like me to send it to them as an attachment?

If Nick's observation doesn't lead anywhere useful please try to reduce
the test case as much as possible. That is what anyone looking into the
problem would need to do anyway.

Hopefully you would be able to reduce the test to such a size that there
would be no problems with posting it.

--
Paul Johnson - paul@​pjcj.net
http​://www.pjcj.net

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2003

From guest@guest.guest.xxxxxxxx

As per my last post and email, the problem appears to be a memory leak.
I am assigning a variable and using it a few lines later, the value
getting used is not what I am assigning and there are no othere
references to the variable between when I assign it and when I use it.
When I reported the bug I was thrown off track by the value in the
variable because the file name is only used in one function. The old
file name got moved into (or retained) the variable even though I
assigned it a different value. The problem is not with unlink, the
problem is either the variable getting changed without any assignment or
it didn't get updated properly. It is displaying all of the classic
characteristics of a memory leak.

I am using the same variable name in each function so my assumption is
that the interpreter is mangling the variable space in memory. Since
5.8.1 and 5.8.2 are full of bug fixes for memory leaks I'm happy to
assume that is the issue until I can upgrade.

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2003

From eric.egdorf@mci.com

Eric Egdorf
DBA -- EPS
MCI
719-535-4389
v622-4289

-----Original Message-----
From​: Paul Johnson via RT [mailto​:perlbug-followup@​perl.org]
Sent​: Sunday, December 14, 2003 3​:15 PM
To​: eric.egdorf@​mci.com
Subject​: Re​: [perl #24645]

On Fri, Dec 12, 2003 at 10​:36​:06AM -0700, Eric Egdorf wrote​:

My code file is about 1000 lines. Should I post it or would anybody
like me to send it to them as an attachment?

If Nick's observation doesn't lead anywhere useful please try to reduce
the test case as much as possible. That is what anyone looking into the
problem would need to do anyway.

Hopefully you would be able to reduce the test to such a size that there
would be no problems with posting it.

--
Paul Johnson - paul@​pjcj.net
http​://www.pjcj.net

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2003

From eric.egdorf@mci.com

Hit the wrong button, <sigh>.

As per my last post and email, the problem appears to be a memory leak. I am assigning a variable and using it a few lines later, the value getting used is not what I am assigning and there are no othere references to the variable between when I assign it and when I use it. When I reported the bug I was thrown off the track by the value in the variable because the file name is only used in one function. The old file name got moved into the variable even though I assigned it a different value. The problem is not with unlink, the problem is the variable getting changed without any assignment.

Eric Egdorf
DBA -- EPS
MCI
719-535-4389
v622-4289

-----Original Message-----
From​: Paul Johnson via RT [mailto​:perlbug-followup@​perl.org]
Sent​: Sunday, December 14, 2003 3​:15 PM
To​: eric.egdorf@​mci.com
Subject​: Re​: [perl #24645]

On Fri, Dec 12, 2003 at 10​:36​:06AM -0700, Eric Egdorf wrote​:

My code file is about 1000 lines. Should I post it or would anybody
like me to send it to them as an attachment?

If Nick's observation doesn't lead anywhere useful please try to reduce
the test case as much as possible. That is what anyone looking into the
problem would need to do anyway.

Hopefully you would be able to reduce the test to such a size that there
would be no problems with posting it.

--
Paul Johnson - paul@​pjcj.net
http​://www.pjcj.net

@p5pRT
Copy link
Author

p5pRT commented Jul 6, 2016

From @dcollinsn

Never got a minimal test case, not enough information to determine if this is resolved or user error, but unable to reproduce. Closing.

@p5pRT
Copy link
Author

p5pRT commented Jul 6, 2016

From [Unknown Contact. See original ticket]

Never got a minimal test case, not enough information to determine if this is resolved or user error, but unable to reproduce. Closing.

@p5pRT
Copy link
Author

p5pRT commented Jul 6, 2016

@dcollinsn - Status changed from 'open' to 'rejected'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant