develooper Front page | perl.perl5.porters | Postings from September 2003

[perl #23723] $@ empty after die in eval{}

Thread Previous | Thread Next
From:
Michael Jacob3
Date:
September 4, 2003 13:22
Subject:
[perl #23723] $@ empty after die in eval{}
Message ID:
rt-23723-64139.3.51419683061025@rt.perl.org
# New Ticket Created by  "Michael Jacob3" 
# Please include the string:  [perl #23723]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=23723 >


This is a bug report for perl from micaja@de.ibm.com,
generated with the help of perlbug 1.34 running under perl v5.8.0.


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


Our (closed source) Perl program has now reached 10.000 lines,
and I could not reproduce the problem with a small demo. So this
report will probably not help anybody reproduce the problem,
sorry for that.

Our problem is that the $@ variable stops working. We have a large
eval{} in a testcase. The 14th test creates a new object. If I
place a die() before that test it works as it should, $@ will have
the value I gave to die(). If I place a die() after test 14, $@
will be '' (empty string) after the eval.

I cannot see anything special at the 14th test, the most "unusual"
thing it does is to SELECT from a database (DBD::CSV).

The following modules are used in our project:

 use Data::Compare;
 use Data::Dumper;
 use DBI; (with DBD::CSV)
 use Digest::MD5;
 use IO::File;
 use Log::Log4perl;
 use POSIX;
 use Socket;
 use Storable;
 use strict;
 use Tie::Hash;
 use utf8;
 use warnings;
 use WeakRef;

The modules from CPAN were installed within the last 3 weeks.

I checked $SIG{__DIE__}, it's content does not affect the behavior.
I can workaround the problem with:

 our $___e = undef;
 our $oldSIGDIE = $SIG{__DIE__} || sub {};
 $SIG{__DIE__} = sub { $___e = $@; goto &$oldSIGDIE; }

but I really don't like it.

I tried to follow the program executionwith the Perl debugger, but
I could not see anything that could have affected the problem.

I believe it is a Perl problem (and not a problem with one of the
modules) because I can do this:

 our $___e = undef;
 $SIG{__DIE__} = sub { $___e = $@; }
 eval {
   ... complex program here
   die 1;
 };
 print "BUG" if $___e ne $@; # will fire!
 print "BUG" if not $@;      # will fire!

We also tested the code under a Perl 5.8.0 on a Debian(unstable).
Same problem there, so it's not Win32 specific.


Please help me finding the cause of the problem. I don't expect to
get a "ready-to-use" patch, I will be happy enaugh if I can find
the line of code, that "disables" $@. I have a (dirty) workaround,
but I really would like to know if I know all side-effects of the
problem...

Thank you.


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

Configured by ActiveState at Tue Feb  4 18:07:44 2003.

Summary of my perl5 (revision 5 version 8 subversion 0) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef 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='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf
-libpath:"C:\Perl580\lib\CORE"  -machine:x86'
    libpth="C:\Perl580\lib\CORE"
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-opt:ref,icf  -libpath:"C:\Perl580\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY

---
@INC for perl v5.8.0:
    c:/Perl580/lib
    c:/Perl580/site/lib
    .

---
Environment for perl v5.8.0:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\system32\WBEM;c:
\perl580\bin;c:\cygwin\bin;C:\Program Files\UltraEdit;C:\WINNT\system32;C:
\WINNT;C:\WINNT\system32\WBEM;c:\perl580\bin;c:\cygwin\bin
    PERL_BADLANG (unset)
    PERL_DL_NOLAZY=1
    SHELL (unset)






/mfg/
Michael Jacob

############################################################
Phone: +49-69-6645-3623 (internal: *134-3623)
Mobile: +49-172-6350425
############################################################
Other company, product or service names may be trademarks or service marks
of others.



Thread Previous | Thread Next


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