develooper Front page | perl.perl5.porters | Postings from March 2013

[perl #44051] panic: top_env from embedded perl using 'do' with unused XS calls

Thread Previous | Thread Next
From:
bulk88 via RT
Date:
March 1, 2013 04:31
Subject:
[perl #44051] panic: top_env from embedded perl using 'do' with unused XS calls
Message ID:
rt-3.6.HEAD-28177-1362112270-1854.44051-15-0@perl.org
On Wed Nov 07 21:40:01 2012, bulk88 wrote:
> > I've attached a new example tar.
> > 
> > --
> > David Ljung Madison
> > http://GetDave.com/     http://MarginalHacks.com/      
> > http://DaveSource.com/
> 
> I got something else from the code you supplied. On Win32 Perl I got a
> crash.
> ___________________________________________________
>  	ntdll.dll!_RtlpWaitForCriticalSection@4()  + 0x5b	
>  	ntdll.dll!_RtlEnterCriticalSection@4()  + 0x46	
> >	perl517.dll!PerlIOUnix_refcnt_inc(int fd=0)  Line 2374	C
>  	perl517.dll!PerlIOUnix_setfd(interpreter * my_perl=0x008647bc, _PerlIO
> * * f=0x00913254, int fd=0, int imode=0)  Line 2654 + 0x9	C
>  	perl517.dll!PerlIOUnix_open(interpreter * my_perl=0x008647bc,
> _PerlIO_funcs * self=0x2819ee20, PerlIO_list_s * layers=0x00913104, long
> n=0, const char * mode=0x281921d5, int fd=0, int imode=0, int perm=0,
> _PerlIO * * f=0x00913254, int narg=0, sv * * args=0x00000000)  Line
> 2735 + 0x15	C
>  	perl517.dll!PerlIOBuf_open(interpreter * my_perl=0x008647bc,
> _PerlIO_funcs * self=0x2819efe0, PerlIO_list_s * layers=0x00913104, long
> n=1, const char * mode=0x281921d4, int fd=0, int imode=0, int perm=0,
> _PerlIO * * f=0x00000000, int narg=0, sv * * args=0x00000000)  Line
> 3860 + 0x35	C
>  	perl517.dll!PerlIO_openn(interpreter * my_perl=0x008647bc, const char
> * layers=0x00000000, const char * mode=0x281921d4, int fd=0, int
> imode=0, int perm=0, _PerlIO * * f=0x00000000, int narg=0, sv * *
> args=0x00000000)  Line 1649 + 0x32	C
>  	perl517.dll!PerlIO_fdopen(int fd=0, const char * mode=0x281921d4) 
> Line 4884 + 0x1d	C
>  	perl517.dll!PerlIO_stdstreams(interpreter * my_perl=0x008647bc)  Line
> 1221 + 0xc	C
>  	perl517.dll!PerlIO_resolve_layers(interpreter * my_perl=0x008647bc,
> const char * layers=0x00000000, const char * mode=0x28189294, int
> narg=1, sv * * args=0x0012fde4)  Line 1539 + 0x9	C
>  	perl517.dll!PerlIO_openn(interpreter * my_perl=0x008647bc, const char
> * layers=0x00000000, const char * mode=0x28189294, int fd=-1, int
> imode=0, int perm=0, _PerlIO * * f=0x00000000, int narg=1, sv * *
> args=0x0012fde4)  Line 1620 + 0x19	C
>  	perl517.dll!PerlIO_open(const char * path=0x2818a0b0, const char *
> mode=0x28189294)  Line 4893 + 0x1d	C
>  	perl517.dll!S_open_script(interpreter * my_perl=0x008647bc, const char
> * scriptname=0x2818a0b0, char dosearch=0, char * suidscript=0x0012fe53)
>  Line 3705 + 0xe	C
>  	perl517.dll!S_parse_body(interpreter * my_perl=0x008647bc, char * *
> env=0x00000000, void (interpreter *)* xsinit=0x00000000)  Line 2062
+ 0x15	C
>  	perl517.dll!perl_parse(interpreter * my_perl=0x008647bc, void
> (interpreter *)* xsinit=0x00000000, int argc=3, char * *
> argv=0x0012ff50, char * * env=0x00000000)  Line 1621 + 0x11	C
>  	main.exe!main()  Line 28 + 0x14	C
>  	main.exe!mainCRTStartup()  Line 398 + 0xe	C
>  	kernel32.dll!_BaseProcessStart@4()  + 0x23	
> ___________________________________________________
> PL_perlio_mutex is not set up correctly since DebugInfo should be a
> pointer not null. DebugInfo is part of a link list debugging thing
> Windows does in critical section structs.
> ___________________________________________________
> -	PL_perlio_mutex	{DebugInfo=0x00000000 {Type=???
> CreatorBackTraceIndex=??? CriticalSection=??? ...} LockCount=1
> RecursionCount=0 ...}	_RTL_CRITICAL_SECTION
> +	DebugInfo	0x00000000 {Type=??? CreatorBackTraceIndex=???
> CriticalSection=??? ...}	_RTL_CRITICAL_SECTION_DEBUG *
> 	LockCount	1	long
> 	RecursionCount	0	long
> 	OwningThread	0x00000000	void *
> 	LockSemaphore	0x000007bc	void *
> 	SpinCount	0	unsigned long
> ___________________________________________________


The crash on windows is caused by a missing (see perlembed )
"PERL_SYS_INIT3(&argc,&argv,&env);" and "PERL_SYS_TERM();" in main.c .
On threaded Win32 Perl, File IO definitely won't work without those 2
calls. I dont know what those 2 do under the hood on Unix, so that might
explain why there is more subtle behavior on Unix. Try adding those 2 as
described in perlembed and see if your problem goes away. I deleted the
files I used to do the above a while ago and forgot about this post so I
can't test the suggestion to see if it stops crashing on Win32 Perl.

-- 
bulk88 ~ bulk88 at hotmail.com



---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=44051

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