Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Perl crashing with Parallel::ForkManager and WWW::Mechanize

by bulk88 (Priest)
on Aug 04, 2012 at 06:32 UTC ( #985388=note: print w/ replies, xml ) Need Help??


in reply to Perl crashing with Parallel::ForkManager and WWW::Mechanize

Your sample script does not run. Fatal error is.

Can't locate object method "new" via package "Parallel::ForkManager" ( +perhaps you forgot to load "Parallel::ForkManager"?) at C:\Documents and S +ettings\Owner\Desktop\n13.pl line 40 (#2) Uncaught exception from user code: Can't locate object method "new" via package "Parallel::ForkManage +r" (perhaps you forgot to load "Parallel::ForkManager"?) at C:\Docume +nts and Settings\Owner\Desktop\n13.pl line 40. at C:\Documents and Settings\Owner\Desktop\n13.pl line 40
Fixing that.
C:\Documents and Settings\Owner\Desktop>perl n13.pl Name "main::OUTPUT" used only once: possible typo at n13.pl line 39 (# +1) (W once) Typographical errors often show up as unique variable nam +es. If you had a good reason for having a unique name, then just menti +on it again somehow to suppress the message. The our declaration is provided for this purpose. NOTE: This warning detects symbols that have been used only once s +o $c, @c, %c, *c, &c, sub c{}, c(), and c (the filehandle or format) are con +sidered the same; if a program uses $c only once but also uses any of the +others it will not trigger this warning. Parsing of undecoded UTF-8 will give garbage when decoding entities at + n13.pl li ne 58, <INPUT> line 2. C:\Documents and Settings\Owner\Desktop>
It didn't crash for me. But if I do a -d, it does crash with a "Free to wrong pool".
C:\Documents and Settings\Owner\Desktop>perl -d n13.pl Name "main::OUTPUT" used only once: possible typo at n13.pl line 39 (# +1) (W once) Typographical errors often show up as unique variable nam +es. If you had a good reason for having a unique name, then just menti +on it again somehow to suppress the message. The our declaration is provided for this purpose. NOTE: This warning detects symbols that have been used only once s +o $c, @c, %c, *c, &c, sub c{}, c(), and c (the filehandle or format) are con +sidered the same; if a program uses $c only once but also uses any of the +others it will not trigger this warning. Attempt to free non-existent shared string '', Perl interpreter: 0x +7331ad4 at (eval 2)[C:/Perl/lib/DynaLoader.pm:225] line 1, <INPUT> line 3. Attempt to free non-existent shared string 'LineNumber', Perl interpre +ter: 0x733 1ad4 at (eval 2)[C:/Perl/lib/DynaLoader.pm:225] line 1, <INPUT> line 3 +. Attempt to free non-existent shared string 'SourceFile', Perl interpre +ter: 0x733 1ad4 at (eval 2)[C:/Perl/lib/DynaLoader.pm:225] line 1, <INPUT> line 3 +. Attempt to free non-existent shared string 'WatchList', Perl interpret +er: 0x7331 ad4 at (eval 2)[C:/Perl/lib/DynaLoader.pm:225] line 1, <INPUT> line 3. Attempt to free non-existent shared string 'Command', Perl interpreter +: 0x7331ad 4 at (eval 2)[C:/Perl/lib/DynaLoader.pm:225] line 1, <INPUT> line 3. Free to wrong pool 59184e0 not 235c78 at (eval 2)[C:/Perl/lib/DynaLoad +er.pm:225] line 1, <INPUT> line 3. C:\Documents and Settings\Owner\Desktop>
This is on Perl 5.10. The C stack is.
> perl510.dll!VMem::Free(void * pMem=0x0187742c) Line 218 C++ perl510.dll!PerlMemFree(IPerlMem * piPerl=0x0781ed6c, void * ptr= +0x0187742c) Line 310 C++ perl510.dll!Perl_safesysfree(void * where=0x0187742c) Line 250 + + 0xe C perl510.dll!Perl_hv_undef(interpreter * my_perl=0x07823a1c, hv * +hv=0x00000000) Line 1786 C perl510.dll!Perl_sv_clear(interpreter * my_perl=0x07823a1c, sv * +sv=0x0000000c) Line 5184 + 0x7 C perl510.dll!Perl_sv_free2(interpreter * my_perl=0x07823a1c, sv * +sv=0x01a21a34) Line 5367 C perl510.dll!Perl_sv_free(interpreter * my_perl=0x07823a1c, sv * s +v=0x01a21a34) Line 5345 + 0xa C OLE.dll!ReleasePerlObject(interpreter * my_perl=0x000573fc, WINOL +EOBJECT * pObj=0x01a525d4) Line 1198 C++ OLE.dll!Uninitialize(interpreter * my_perl=0x07823a1c, PERINTERP +* pInterp=0x01a2fe14) Line 3271 + 0xa C++ OLE.dll!XS_Win32__OLE_Initialize(interpreter * my_perl=0x08493700 +, cv * cv=0x00360b14) Line 3478 + 0x7 C++ perl510.dll!Perl_pp_entersub(interpreter * my_perl=0x079933f4) L +ine 2847 + 0x4 C perl510.dll!Perl_runops_standard(interpreter * my_perl=0x07823a1c +) Line 36 + 0xc C perl510.dll!Perl_call_sv(interpreter * my_perl=0x07823a1c, sv * s +v=0x08651a84, long flags=6) Line 2647 + 0xc C perl510.dll!Perl_call_list(interpreter * my_perl=0x07823a1c, long + oldscope=9, av * paramList=0x086519d4) Line 5158 C perl510.dll!win32_start_child(void * arg=0x07823a1c) Line 1778 + + 0xa C++ kernel32.dll!_BaseThreadStart@8() + 0x37
Interp curcop file is, file = "(eval 2)C:/Perl/lib/DynaLoader.pm:225", line=1, is last Perl line executed.

line 225 is
my @unresolved = dl_undef_symbols(); if (@unresolved) { require Carp; Carp::carp("Undefined symbols present after loading $file: @unreso +lved\n"); } $boot_symbol_ref = dl_find_symbol($libref, $bootname) or croak("Can't find '$bootname' symbol in $file\n"); push(@dl_modules, $module); # record loaded module boot: my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, + $file); # See comment block above push(@dl_shared_objects, $file); # record files loaded >>>>>>>>>>>>>>>>>>>> &$xs(@args); }
void Initialize(...) ALIAS: Uninitialize = 1 SpinMessageLoop = 2 MessageLoop = 3 QuitMessageLoop = 4 FreeUnusedLibraries = 5 _Unique = 6 PPCODE: { char *paszMethod[] = {"Initialize", "Uninitialize", "SpinMessageLo +op", "MessageLoop", "QuitMessageLoop", "FreeUnusedLibraries", "_Unique"}; if (CallObjectMethod(aTHX_ mark, ax, items, paszMethod[ix])) return; DBG(("Win32::OLE->%s()\n", paszMethod[ix])); if (items == 0) { warn("Win32::OLE->%s must be called as class method", paszMeth +od[ix]); XSRETURN_EMPTY; } HV *stash = gv_stashsv(ST(0), TRUE); SetLastOleError(aTHX_ stash); switch (ix) { case 0: { // Initialize DWORD dwCoInit = COINIT_MULTITHREADED; if (items > 1 && SvOK(ST(1))) dwCoInit = (DWORD)SvIV(ST(1)); Initialize(aTHX_ gv_stashsv(ST(0), TRUE), dwCoInit); break; } case 1: { // Uninitialize dPERINTERP; >>>>>>>>>>>>> Uninitialize(aTHX_ INTERP); break;
void Uninitialize(pTHX_ PERINTERP *pInterp) { DBG(("Uninitialize\n")); EnterCriticalSection(&g_CriticalSection); if (g_bInitialized) { OBJECTHEADER *pHeader = g_pObj; while (pHeader) { DBG(("Zombiefy object |%lx| lMagic=%lx\n", pHeader, pHeader->lMagic)); switch (pHeader->lMagic) { case WINOLE_MAGIC: >>>>>>>>>>>> ReleasePerlObject(aTHX_ (WINOLEOBJECT*)pHeader); break;
void ReleasePerlObject(pTHX_ WINOLEOBJECT *pObj) { dSP; HV *stash = SvSTASH(pObj->self); DBG(("ReleasePerlObject |%lx|", pObj)); if (!pObj) return; /* ReleasePerlObject may be called multiple times for a single obj +ect: * first by Uninitialize() and then by Win32::OLE::DESTROY. * Make sure nothing is cleaned up twice! */ if (pObj->destroy) { SV *self = sv_2mortal(newRV_inc((SV*)pObj->self)); /* honour OVERLOAD setting */ if (Gv_AMG(stash)) SvAMAGIC_on(self); DBG((" Calling destroy method for object |%lx|\n", pObj)); ENTER; SAVETMPS; if (SvPOK(pObj->destroy)) { /* $self->Dispatch($destroy,$retval); */ EXTEND(SP, 3); PUSHMARK(sp); PUSHs(self); PUSHs(pObj->destroy); PUSHs(sv_newmortal()); PUTBACK; perl_call_method("Dispatch", G_DISCARD); } else { /* &$destroy($self); */ PUSHMARK(sp); XPUSHs(self); PUTBACK; perl_call_sv(pObj->destroy, G_DISCARD); } FREETMPS; LEAVE; DBG((" Returned from destroy method for 0x%08x\n", pObj)); SvREFCNT_dec(pObj->destroy); pObj->destroy = NULL; } if (pObj->pEventSink) { DBG((" Unadvise connection |%lx|", pObj)); pObj->pEventSink->Unadvise(); pObj->pEventSink = NULL; } if (pObj->pDispatch) { if (pObj->flags & OBJFLAG_UNIQUE) { dPERINTERP; IUnknown *punk; // XXX check error? pObj->pDispatch->QueryInterface(IID_IUnknown, (void**)&pun +k); hv_delete(g_hv_unique, (char*)&punk, sizeof(punk), G_DISCA +RD); DBG((" hv_delete(%08x)", punk)); punk->Release(); } DBG((" Release pDispatch")); pObj->pDispatch->Release(); pObj->pDispatch = NULL; } if (pObj->pTypeInfo) { DBG((" Release pTypeInfo")); pObj->pTypeInfo->Release(); pObj->pTypeInfo = NULL; } if (pObj->pEnum) { DBG((" Release pEnum")); pObj->pEnum->Release(); pObj->pEnum = NULL; } if (pObj->destroy) { DBG((" destroy(%d)", SvREFCNT(pObj->destroy))); SvREFCNT_dec(pObj->destroy); pObj->destroy = NULL; } if (pObj->hashTable) { DBG((" hashTable(%d)", SvREFCNT(pObj->hashTable))); >>>>>>>>>>>>>>>> SvREFCNT_dec(pObj->hashTable); pObj->hashTable = NULL; } DBG(("\n")); } /* ReleasePerlObject */
Done for now. I might try to reproduce it on a newer Perl later today. What is causing the double free() (or is it my old activeperl 5.10), (it may or not be Win32::OLE) I dont know.


Comment on Re: Perl crashing with Parallel::ForkManager and WWW::Mechanize
Select or Download Code
Re^2: Perl crashing with Parallel::ForkManager and WWW::Mechanize
by Anonymous Monk on Aug 04, 2012 at 07:49 UTC

    Yes indeed. I have not posted the complete script as I mentioned in my first post.
    It only gives the structure of the Perl Script and the relevant information which should help in troubleshooting this issue.
    I have am unable to understand from your response, that was the correct solution!
    Thanks.

Re^2: Perl crashing with Parallel::ForkManager and WWW::Mechanize
by Anonymous Monk on Aug 04, 2012 at 08:34 UTC

    Yeah, fork on windows, and 5.10, guaranteed to have bugs

    Much better idea to use threads on windows, but not with 5.10, guaranteed to have bugs, much better to upgrade perl :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2014-07-25 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls