develooper Front page | perl.perl5.porters | Postings from December 2012

[perl #42869] Problem killing a pseudo-forked child on Win32

From:
bulk88 via RT
Date:
December 26, 2012 22:01
Subject:
[perl #42869] Problem killing a pseudo-forked child on Win32
Message ID:
rt-3.6.HEAD-17500-1356559309-921.42869-15-0@perl.org
On Thu May 10 18:53:53 2007, jdb wrote:
> 
> The error happens because the memory freed by line 823 in perl.c has not
> been allocated from the shared heap:
> 
> 	CopFILE_free(&PL_compiling);
> 
> This happens in the child "process", not the main one.
> 
> Currently this looks like an optimizer bug to me: When I compile with -Od
> instead of -O1 the problem goes away.  And the various values displayed by
> the debugger when using the -O1 binary don't make much sense to me. :(
> 
> Cheers,
> -Jan
> 
> 

In 5.17.6  running, in -Od win32 perl
________________________________________________________
#!/usr/bin/perl -w
#use Data::Dumper;
use warnings;
#use strict;
#use Devel::Peek qw(Dump);
#use B;

my $child;

BEGIN {
$child = fork;
die "Fork failed" unless defined $child;
if (!$child) {
$SIG{INT} = sub {
print "Child $$ caught INT: exiting...\n";
exit;
};
sleep 2;
print "Child $$ exiting...\n";
exit;
}
}

print "Parent $$ forked child $child OK\n";
print "Parent $$ killing child $child...\n";
kill 'INT', $child
or print "Parent $$ failed to kill child $child: $!\n";
print "Parent $$ exiting...\n";
exit;
__________________________________________________________

results in the same crash

______________________________________________________________________
    if (destruct_level == 0) {

	DEBUG_P(debprofdump());

#if defined(PERLIO_LAYERS)
	/* No more IO - including error messages ! */
	PerlIO_cleanup(aTHX);
#endif

>>>>>>>>>>>>>>>>>	CopFILE_free(&PL_compiling);

	/* The exit() function will do everything that needs doing. */
        return STATUS_EXIT;
    }
______________________________________________________________________

Child thread, (crashed)
____________________________________________________________________
 	perl517.dll!VMem::Free(void * pMem=0x0096496c)  Line 202 + 0x3	C
 	perl517.dll!CPerlHost::FreeShared(void * ptr=0x0096496c)  Line 105	C
 	perl517.dll!PerlMemSharedFree(IPerlMem * piPerl=0x0090ac70, void *
ptr=0x0096496c)  Line 364	C
>	perl517.dll!perl_destruct(interpreter * my_perl=0x00934c0c)  Line
827 + 0x20	C
 	perl517.dll!win32_start_child(void * arg=0x00934c0c)  Line 1795 + 0x9	C
 	kernel32.dll!_BaseThreadStart@8()  + 0x37	
____________________________________________________________________

parent thread
____________________________________________________________________
 	ntdll.dll!_KiFastSystemCallRet@0() 	
 	ntdll.dll!_ZwWaitForMultipleObjects@20()  + 0xc	
 	kernel32.dll!_WaitForMultipleObjectsEx@20()  - 0x48	
 	kernel32.dll!_WaitForMultipleObjects@16()  + 0x18	
>	perl517.dll!win32_wait_for_children(interpreter * my_perl=0x00345ecc)
 Line 1224	C
 	perl517.dll!perl_destruct(interpreter * my_perl=0x00345ecc)  Line
535 + 0x9	C
 	perl517.dll!RunPerl(int argc=2, char * * argv=0x00342478, char * *
env=0x003451f0)  Line 274 + 0x9	C
 	perl.exe!mainCRTStartup()  Line 398 + 0xe	C
 	kernel32.dll!_BaseProcessStart@4()  + 0x23	
_____________________________________________________________________

I think this (fork in a BEGIN) is the last remaining issue in this
thread since 5.17 is printing "Child -**** caught INT: exiting..." to
console now. The interp struct layout stuff is meaningless now since the
interp struct member abstraction/ABI compatibility functions stuff was
removed in 5.14.

Console output upto the crash on 5.17.6
______________________________________________________________________
Parent 2528 forked child -2392 OK
Parent 2528 killing child -2392...
Parent 2528 exiting...
Child -2392 caught INT: exiting...
Free to wrong pool 345d90 not 90a048 at C:\Documents and
Settings\Owner\Desktop\
42869.pl line 22 during global destruction.
________________________________________________________________

-- 
bulk88 ~ bulk88 at hotmail.com

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



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