Re: Thread bug in 5.8RC1 Win32

2002-06-15 Thread Jarkko Hietaniemi

In UNIX platforms your test made Perl enter a 100% CPU loop consisting
of SEGVs on top of SEGVs on top of SEGVS...  the below hopefully fixes:

Change 17250 by jhi@alpha on 2002/06/15 15:34:51

Possible cure for

Subject: Re: Thread bug in 5.8RC1 Win32
From: Alessandro Forghieri <[EMAIL PROTECTED]>
Date: Sat, 15 Jun 2002 12:56:35 +0200
Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/perl.c#441 edit

Differences ...

 //depot/perl/perl.c#441 (text) 
Index: perl/perl.c
--- perl/perl.c#440~17194~  Wed Jun 12 04:35:57 2002
+++ perl/perl.c Sat Jun 15 18:34:51 2002
@@ -442,7 +442,8 @@
 
 /* Destroy the main CV and syntax tree */
 if (PL_main_root) {
-   PL_curpad = AvARRAY(PL_comppad);
+/* If running under -d may not have PL_comppad. */
+PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL;
op_free(PL_main_root);
PL_main_root = Nullop;
 }
End of Patch.


-- 
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen



Re: SEGV in bleadperl@17165 under mod_perl

2002-06-13 Thread Jarkko Hietaniemi

> > >   _IO_read_end = 0x646e4128 , 
> > >   _IO_read_base = 0x73616572 , 
> > >   _IO_write_base = 0x202e4a20 , 
> > >   _IO_write_ptr = 0x6eb6c34b , 
> > >   _IO_write_end = 0x20296769 , 
> > >   _IO_buf_base = 0x69736976 , 
> > >   _IO_buf_end = 0x20646574 , 
> > >   _IO_save_base = 0x20656874 , 
> > >   _IO_backup_base = 0x53554150 , 
> > >   _IO_save_end = 0x20200a45 , 
> > 
> > These look fishy...
> 
> $ perl -le 'print pack "i", hex $_ foreach @ARGV' 0x646e4128 0x73616572 0x202e4a20 
>0x6eb6c34b 0x20296769 0x69736976 0x20646574 0x20656874 0x53554150 0x20200a45 
>0x20646e61 
> (And
> reas
>  J. 
> Kön
> ig) 
> visi
> ted 
> the 
> PAUS
> E

Ouch.  How did you even start to suspect this?  Because the hexdigitsq
looked like fitting well into the ASCII range?

> "08\cZ@"
> "08\cZ@"
> "(Andreas J. König) visited the PAUSE and reqested an upload into his/her 
>directory.\n" .
> "The request used the following parameters\n\n  SUBMIT_"
> 
> I think. (that's König in utf8, isn't it?)

Yes.

> I don't think we're in FILE* any longer, Toto.
> 
> (and I didn't get the misquote quite correct, did I?)
> 
> What's a good memory leak checker for running PAUSE under? valgrind with

Dunno about memory *leaks* but definitely looks like "fandango on core"...

> showleaks turned on?

-- 
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen



Re: SEGV in bleadperl@17165 under mod_perl

2002-06-13 Thread Jarkko Hietaniemi

On Thu, Jun 13, 2002 at 08:26:30PM +0200, Andreas J. Koenig wrote:
> > On Thu, 13 Jun 2002 10:32:01 -0700 (PDT), Doug MacEachern <[EMAIL PROTECTED]> 
>said:
> 
>   > On Thu, 13 Jun 2002, Andreas J. Koenig wrote:
>  >> Program received signal SIGSEGV, Segmentation fault.
>  >> 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43
>  >> 43 iofflush.c: No such file or directory.
>  >> (gdb) bt
>  >> #0  0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43
> 
>   > also, if possible could you:
>   > (gdb) p *fp
> 
> (gdb) p *fp

> 
> I'll try the other suggestions next.

Mine probably doesn't help much since the pointer seems to be non-NULL...

> $1 = {_flags = 1075460144, 
>   _IO_read_ptr = 0x401a3830 
>"0ã\210\b0ã\210\bØñw\bØñw\b88\032@88\032@@8\032@@8\032@H8\032@H8\032@P8\032@P8\032@X8\032@X8\032@`8\032@`8\032@h8\032@h8\032@p8\032@p8\032@x8\032@x8\032@\2008\032@\2008\032@\2108\032@\2108\032@\2208\032@\2208\032@\2308\032@\2308\032@ 8\032@ 8\032@¨8\032@¨8\032@°8\032@°8\032@¸8\032@¸8\032@À8\032@À8\032@È8\032@È8\032@0ð\213\b0ð\213\bØ8\032@Ø8\032@à8\032@à8\032@è8\032@è8\032@"...,

This doesn't look good...

>   _IO_read_end = 0x646e4128 , 
>   _IO_read_base = 0x73616572 , 
>   _IO_write_base = 0x202e4a20 , 
>   _IO_write_ptr = 0x6eb6c34b , 
>   _IO_write_end = 0x20296769 , 
>   _IO_buf_base = 0x69736976 , 
>   _IO_buf_end = 0x20646574 , 
>   _IO_save_base = 0x20656874 , 
>   _IO_backup_base = 0x53554150 , 
>   _IO_save_end = 0x20200a45 , 

These look fishy...

>   _markers = 0x20646e61, _chain = 0x75716572, _fileno = 1702130533, 
>   _blksize = 1851859044, _old_offset = 1819309344, _cur_column = 24943, 
>   _vtable_offset = 100 'd', _shortbuf = " ", _lock = 0x6f746e69, 
>   _offset = 8243109245980600352, _codecvt = 0x72696420, 
>   _wide_data = 0x6f746365, _mode = 170817906, 
>   _unused2 = "The request used the following parameters\n\n  SUBMIT_"}

If this is an unused field why does it contain a very readable string :-)
In my Linux stdio.h unused2 is int _unused2[16], but off-hand I don't
even think it should be part of a FILE, so I really don't know what to say.

-- 
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen



Re: SEGV in bleadperl@17165 under mod_perl

2002-06-13 Thread Jarkko Hietaniemi

On Thu, Jun 13, 2002 at 06:52:13PM +0200, Andreas J. Koenig wrote:
> > On Wed, 12 Jun 2002 23:45:41 +0200, [EMAIL PROTECTED] (Andreas J. 
>Koenig) said:
> 
>   > Currently I have a testcase that is still 7300 lines of perl code for
>   > the server (after all these are in one file) but only 50 lines for the
>   > client. I hope to cut that down to a reasonable size tomorrow.
> 
> I fear I have to give up on this, I cannot cut the test case below
> 2800 lines. I cannot make it database-independent either. Whatever I
> cut out, the SEGV goes away.  :-(
> 
> I have switched to blead@17207 (apache is 1.3.24, mod_perl is 1.27)
> and this is the stack trace today. The line numbers are again wrong
> and I have no idea why. Please take another *sharp* look. If this bug
> cannot be fixed, I cannot upgrade PAUSE to 5.8.0 (unless I rename it
> to PAUSEGV :-)
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43
> 43 iofflush.c: No such file or directory.
> (gdb) bt
> #0  0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43
> #1  0x8205fea in PerlIOStdio_flush (my_perl=0x82f4258, f=0x82fb298)
> at perlio.c:2738

I'm grasping at straws, and I really don't know much about
PerlIO... but try this:

 //depot/perl/perlio.c#179 - /u/vieraat/vieraat/jhi/pp4/perl/perlio.c 
Index: perl/perlio.c
--- perl/perlio.c.~1~   Thu Jun 13 20:05:05 2002
+++ perl/perlio.c   Thu Jun 13 20:05:05 2002
@@ -2734,7 +2734,7 @@
 PerlIOStdio_flush(pTHX_ PerlIO *f)
 {
 FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
-if (PerlIOBase(f)->flags & PERLIO_F_CANWRITE) {
+if (stdio && PerlIOBase(f)->flags & PERLIO_F_CANWRITE) {
return PerlSIO_fflush(stdio);
 }
 else {
End of Patch.


NI-S will probably find this patch very wrong :-)

> #2  0x8203fde in Perl_PerlIO_flush (my_perl=0x82f4258, f=0x82fb298)
> at perlio.c:1459
> #3  0x82040a8 in Perl_PerlIO_flush (my_perl=0x82f4258, f=0x82fb298)
> at perlio.c:1487
> #4  0x8173e8f in Perl_my_popen (my_perl=0x82f4258, cmd=0x88b8fc1 "-", 
> mode=0xb524 "w") at util.c:2080
> #5  0x81e3297 in Perl_do_openn (my_perl=0x82f4258, gv=0x88c5f34, 
> name=0x88b8fc1 "-", len=1, as_raw=0, rawmode=0, rawperm=0, 
> supplied_fp=0x0, svp=0x84f7098, num_svs=0) at doio.c:282
> #6  0x81cbda3 in Perl_pp_open (my_perl=0x82f4258) at pp_sys.c:542
> #7  0x816eb43 in Perl_runops_debug (my_perl=0x82f4258) at dump.c:1398
> #8  0x81174a3 in S_call_body (my_perl=0x82f4258, myop=0xb758, is_eval=0)
> at perl.c:2044
> #9  0x8117003 in Perl_call_sv (my_perl=0x82f4258, sv=0x8387470, flags=4)
> at perl.c:1962
> #10 0x809da38 in perl_call_handler (sv=0x8387470, r=0x87869ac, args=0x0)
> at mod_perl.c:1658
> #11 0x809cbc4 in perl_run_stacked_handlers (hook=0x828e399 "PerlHandler", 
> r=0x87869ac, handlers=0x83873ec) at mod_perl.c:1371
> #12 0x809a637 in perl_handler (r=0x87869ac) at mod_perl.c:897
> #13 0x80e6379 in ap_invoke_handler () at eval.c:88
> #14 0x80fbbdf in process_request_internal () at eval.c:88
> #15 0x80fbc4a in ap_process_request () at eval.c:88
> #16 0x80f2897 in child_main () at eval.c:88
> #17 0x80f2a55 in make_child () at eval.c:88
> #18 0x80f2bd6 in startup_children () at eval.c:88
> #19 0x80f326d in standalone_main () at eval.c:88
> #20 0x80f3acc in main () at eval.c:88
> #21 0x400a475d in __libc_start_main (main=0x80f3738 , argc=4, 
> ubp_av=0xbae4, init=0x807a628 <_init>, fini=0x8286704 <_fini>, 
> rtld_fini=0x4000b8f4 <_dl_fini>, stack_end=0xbadc)
> at ../sysdeps/generic/libc-start.c:129
> 
> Loaded modules of the application are quite a lot:
> 
>   Apache Apache::Connection Apache::Constants Apache::Constants::Exports
>   Apache::HeavyCGI Apache::HeavyCGI::Date Apache::HeavyCGI::Exception
>   Apache::HeavyCGI::ExePlan Apache::HeavyCGI::Layout Apache::Request
>   Apache::Server Apache::Status Apache::Symbol Apache::Table Apache::URI
>   AutoLoader B Carp Class::Singleton Compress::Zlib Config Cwd
>   DBD::mysql DBI Data::Dumper Devel::Symdump DirHandle DynaLoader Encode
>   Encode::Alias Encode::Config Encode::Encoding Exporter Exporter::Heavy
>   ExtUtils::Manifest Fcntl File::Basename File::Copy File::Find
>   File::Spec File::Spec::Unix HTML::Entities HTML::Parser HTTP::Date IO
>   IO::File IO::Handle IO::Seekable List::Util Mail::Mailer
>   Mail::Mailer::rfc822 Mail::Mailer::sendmail Mail::Send Scalar::Util
>   SelectSaver String::Random Symbol Text::Tabs Text::Wrap Time::HiRes
>   Time::Local URI URI::Escape URI::URL URI::WithBase URI::_generic
>   URI::_query URI::_server URI::_userpass URI::ftp Unicode::String
>   XML::Parser XML::Parser::Expat XSLoader base bytes constant fields
>   integer lib mod_perl overload pause_1999::authensegv
>   pause_1999::configsegv re strict utf8 vars warnings warnings::register
> 
> Most of the modules are not involved in any action, most of the
> testscript is unused code. The test script only does the followin

Re: SEGV in bleadperl@17165 under mod_perl

2002-06-11 Thread Jarkko Hietaniemi

On Tue, Jun 11, 2002 at 08:23:18AM -0700, Doug MacEachern wrote:
> On Tue, 11 Jun 2002, Andreas J. Koenig wrote:
> 
> > PAUSE is suffering from a SEGV since I installed RC1. After I upgraded
> > yesterday to snapshot 17165 I finally caught the following within gdb.

There was something funky with the linenumber/stack trace... the linenumber
didn't look like those of 17165.

> > I'd appreciate further instructions where to go from here.
> 
> test case?
> 
> > #4  0x816fc96 in Perl_my_popen (my_perl=0x82ffcc8, cmd=0x8a073f1 "-", 
> > mode=0xb828 "w") at util.c:2080
> 
> looks like something along the lines of:
> open my $foo, '|-' or ...;
> 
> ?

-- 
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen



Re: [gsar@ActiveState.com: v5.6.1 trial2 is available]

2001-03-14 Thread Jarkko Hietaniemi

Hi,

sorry for not answering sooner.  The suggested patch seems to work
find with the development branch of Perl, and I believe Sarathy
will apply the patch also to the maintenance branch.

On Wed, Feb 21, 2001 at 09:32:04PM +0100, Jens-Uwe Mager wrote:
> On Fri, Feb 16, 2001 at 05:44:34PM +0100, [EMAIL PROTECTED] wrote:
> > On Fri, 16 Feb 2001 [EMAIL PROTECTED] wrote:
> > 
> > > Hi Jarkko,
> > >
> > > > > I'll try to do one or two more builds. I'd really like to try it with
> > > > > Apache's mod_perl and mod_embed, these really didn't work at all with
> > > > > perl-5.6.0, but I'm not sure I'll find the time.
> > 
> > [AIX-4.3.2, IBM's C compiler, Apache apxs shared modules]
> > 
> > I tried to get mod_perl-1.25 (an Apache/perl module that's
> > supposed to let you use perl to implement script-based apache modules)
> > working with perl-5.6.1-trial2, and failed. I can get mod_perl
> > working with perl-5.5.3, but I never succeeded with perl-5.6.0.
> > 
> > With perl-5.6.1-trial2, the mod-perl initialisation is successful, but I
> > get a segmentation fault as soon as I try to access the perl script
> > (test.pl or test.perl).
> 
> A short while ago the Apache distribution did change over to the native
> dlopen library if the AIX version 4.3 and above. For previous versions
> the dlopen emulation layer is still used. Perl does always use the
> emulation, which produces a conflict if Apache uses the native one in
> the modperl case. I attach a patch below that changes the perl
> distribution to also use the native AIX dlopen on AIX 4.3 and above as
> in the Apache case.
> 
> For getting some more involved modperl modules like Embperl to work we
> probably need to change the modperl.exp file to include the magic "#! ."
> instead of simply "#!" at the beginning, this signals the native dlopen
> to import symbols from the main program. The patch already does that in
> makedef.pl for the perl.exp file, but only on AIX 4.3 and above because
> the older AIX linkers do strange things if this option is used.
> 
> -- 
> Jens-Uwe Mager
> 
> HELIOS Software GmbH
> Steinriede 3
> 30827 Garbsen
> Germany
> 
> Phone:+49 5131 709320
> FAX:  +49 5131 709325
> Internet: [EMAIL PROTECTED]

> --- perl-5.6.1-TRIAL2/ext/DynaLoader/dl_aix.xs.orig   Wed Feb 21 19:45:18 2001
> +++ perl-5.6.1-TRIAL2/ext/DynaLoader/dl_aix.xsWed Feb 21 21:16:53 2001
> @@ -14,6 +14,21 @@
>  #define PERLIO_NOT_STDIO 0
>  
>  /*
> + * On AIX 4.3 and above the emulation layer is not needed any more, and
> + * indeed if perl uses its emulation and perl is linked into apache
> + * which is supposed to use the native dlopen conflicts arise.
> + * Jens-Uwe Mager [EMAIL PROTECTED]
> + */
> +#ifdef USE_NATIVE_DLOPEN
> +
> +#include "EXTERN.h"
> +#include "perl.h"
> +#include "XSUB.h"
> +#include 
> +
> +#else
> +
> +/*
>   * @(#)dlfcn.c   1.5 revision of 93/02/14  20:14:17
>   * This is an unpublished work copyright (c) 1992 Helios Software GmbH
>   * 3000 Hannover 1, Germany
> @@ -89,6 +104,13 @@
>  # define FREAD(p,s,n,ldptr)  fread(p,s,n,IOPTR(ldptr))
>  #endif
>  
> +#ifndef RTLD_LAZY
> +# define RTLD_LAZY 0
> +#endif
> +#ifndef RTLD_GLOBAL
> +# define RTLD_GLOBAL 0
> +#endif
> +
>  /*
>   * We simulate dlopen() et al. through a call to load. Because AIX has
>   * no call to find an exported symbol we read the loader section of the
> @@ -627,6 +649,7 @@
>   safefree(buf);
>   return ret;
>  }
> +#endif /* USE_NATIVE_DLOPEN */
>  
>  /* dl_dlopen.xs
>   * 
> @@ -672,7 +695,7 @@
>   DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dl_load_file(%s,%x):\n", 
>filename,flags));
>   if (flags & 0x01)
>   Perl_warn(aTHX_ "Can't make loaded symbols global on this platform while 
>loading %s",filename);
> - RETVAL = dlopen(filename, 1) ;
> + RETVAL = dlopen(filename, RTLD_GLOBAL|RTLD_LAZY) ;
>   DLDEBUG(2,PerlIO_printf(Perl_debug_log, " libref=%x\n", RETVAL));
>   ST(0) = sv_newmortal() ;
>   if (RETVAL == NULL)
> --- perl-5.6.1-TRIAL2/hints/aix.sh.orig   Wed Feb 21 19:39:30 2001
> +++ perl-5.6.1-TRIAL2/hints/aix.shWed Feb 21 19:45:00 2001
> @@ -55,9 +55,11 @@
>  case "$osvers" in
> 3.*|4.1.*|4.2.*)
>usenm='undef'
> +  usenativedlopen='false'
>;;
> *)
>usenm='true'
> +  usenativedlopen='true'
>;;
>  esac
>  
> @@ -405,20 +407,25 @@
>  esac
>  EOCBU
>  
> -# If the C++ libraries, libC and libC_r, are available we will prefer them
> -# over the vanilla libc, because the libC contain loadAndInit() and
> -# terminateAndUnload() which work correctly with C++ statics while libc
> -# load() and unload() do not.  See ext/DynaLoader/dl_aix.xs.
> -# The C-to-C_r switch is done by usethreads.cbu, if needed.
> -if test -f /lib/libC.a -a X"`$cc -v 2>&1 | grep gcc`" = X; then
> -# Cify libswanted.
> -set `echo X "$libswanted "| sed -e 's/ c / C c /'`
> -shift
> -libswanted="$*"
> -# Cify lddlflags.
> -set `echo X "$lddlflag