Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Crash at perl_parse() function

by prabakar.bhatt (Novice)
on Jul 03, 2020 at 15:39 UTC ( [id://11118876]=perlquestion: print w/replies, xml ) Need Help??

prabakar.bhatt has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Crash at perl_parse() function
by marto (Cardinal) on Jul 03, 2020 at 16:04 UTC
Re: Crash at perl_parse() function
by bliako (Monsignor) on Jul 05, 2020 at 11:56 UTC

    prabakar.bhatt, first of all, I don't understand what's the thinking processes of anyone asking for help with so little information - as if someone sends an SOS with only Latitude and needs to be asked a second time to send their Longitude as well. Perhaps you want to test us for the priesthood at Delphi? May be so, but I find it very irritating to beg the person with a problem for more information to solve his problem. That said, and after reading your response to perlfan's and dave_the_m's questions ...

    See Maintaining multiple interpreter instances

    It is not clear to me if what's crashing is 3rd-party code (marto mentioned HP's), in which case I will assume that code is correct and the problem may be with how your perl libraries were compiled (and btw make sure it's the correct libraries it is linking to! Re: site perl vs perlbrew perl etc.etc.). This could be the problem especially if with the same 3rd-party code, previously you got no crash.

    On the other hand, if what's crashing is your own C++ program which embeds a perl interpreter, then you must both check above point AND ALSO how you spawn the thread, embed and clean-up afterwards. Or if you attempt to use other thread's interpreters. Or if one perl interpreter unsuspectfully cleans up other interpreter's space. That can be tricky to get right even without threads. So again read the documentation I mentioned above which states how you should compile the perl libraries in the first place.

    Additionally and for both cases above: since what's crashing is strchr(), can this be an issue of unicode strings and incorrect length? That means, the Perl content, i.e. script to your embeded interpreters may be to blame. So, perhaps try it with minimal Perl scripts and without unicode if any at all which btw can be user-supplied (unicode) input.

    I don't know if you are in a position to run all these under a debugger. But if you are then checking what are the args to the crashing strchr() will give you a good hint.

    bw, bliako

Re: Crash at perl_parse() function
by Anonymous Monk on Jul 03, 2020 at 15:56 UTC
Re: Crash at perl_parse() function
by perlfan (Vicar) on Jul 06, 2020 at 00:57 UTC
    I saw your response below. I don't know anything about perl internals or embedding, but I know a little about threads. And I know generally perl is not "thread safe". If you're initializing something regarding perl in your main thread, then using it in the child threads, this is likely a bad idea. Also the sharing of anything among child threads or with the main thread should occur well outside the purvue of anything touching the embedded perl bits. If you keep things isolated in each thread, I don't see why you can't have isolated perl instances embedded there and using shared variables (outside of perl) to communicate (again outside of perl). But it'd get complicated quickly.
Re: Crash at perl_parse() function
by perlfan (Vicar) on Jul 04, 2020 at 07:21 UTC
    >new thread

    Thread or fork?

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11118876]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-19 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found