Hello,

I'm using perl58.dll (version 5.8.4, build 810) in a c++ application with several threads that runs on win2000SP4. Every thread creates a perl interpreter that runs a perl script from an arbitrary file. After a while I'm experiencing a deadlock. I can see that I have a thread that is stack in the function _alloc_osfhnd (Microsoft function from the msvcrt.dll that is called from the _open function).

I found this link http://bugs.mysql.com/bug.php?id=12071 that describes a Microsoft bug in _alloc_osfhnd that might cause this deadlock.

I can also see that in the perl source win32.c there's an implementation to the function _alloc_osfhnd with the following description, but I'm not sure it has something to do with my problem.

/* * we fake up some parts of the CRT that aren't exported by MSVCRT.dll + * this lets sockets work on Win9X with GCC and should fix the problem +s * with perl95.exe * -- BKS, 1-23-2000 */
Has anyone experienced this problem before?
Is it really a Microsoft bug that affects perl?
Can another version of perl solve the problem?
Can another version of OS solve the problem?

I attached my relevant code below,
Thanks in advance,
Lily.

__declspec(dllexport) long CFTPerlUserExitInstanceRun(char *FileName,char *FuncName,struct P +erlParmInfo *ParmsVec,unsigned int ParmsVecSize,char* pReason,int *pC +ount,int *pUserExitRc, int *pPerlParseRc) { long lRc = 0; int count = -1; PerlInterpreter* my_perl = NULL; char *embedding[] = { "", FileName}; while (true) { my_perl = perl_alloc(); if (my_perl == NULL) { lRc = -1; break; } EnterCriticalSection(&g_ParserCS); try { PERL_SET_CONTEXT(my_perl); PL_perl_destruct_level = 1; perl_construct(my_perl); *pPerlParseRc = perl_parse(my_perl, xs_init, 2, embedding , N +ULL); lRc = *pPerlParseRc; LeaveCriticalSection(&g_ParserCS); } catch(...) { LeaveCriticalSection(&g_ParserCS); lRc = -6; break; } if (lRc != 0) { lRc = -2; break; } dSP; ENTER; SAVETMPS; PUSHMARK(SP); // Here I push parameters into the stack… PUTBACK; try { count = call_pv(FuncName, _EVAL|G_SCALAR); } catch(...) { lRc = -3; } SPAGAIN; // Check the eval first if (SvTRUE(ERRSV)) { STRLEN n_a; strncpy(pReason, SvPV(ERRSV, n_a), MAX_PERL_REASON_LENGTH-1); lRc = -4; POPs ; } else { if (count != 1) { *pCount = count; lRc = -5; } else { *pUserExitRc = POPi; } } PUTBACK ; FREETMPS ; LEAVE ; break; } if (my_perl != NULL) { EnterCriticalSection(&g_ParserCS); try { PL_perl_destruct_level = 1; perl_destruct(my_perl); LeaveCriticalSection(&g_ParserCS); } catch(...) { LeaveCriticalSection(&g_ParserCS); lRc = -7; } perl_free(my_perl); } return lRc; }

In reply to perl on windows - possible bug? by lily

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.