|Perl Monk, Perl Meditation|
Re^26: Perl crash during perl_cloneby BrowserUk (Pope)
|on Nov 10, 2010 at 08:08 UTC||Need Help??|
Do you think I should still be worried about going ahead with this as the right solution? So far my testing hasnt shown any negative/unexpected results.
Honestly, I am uncomfortable with expressing an opinion on that.
I am unaware of anyone else doing anything like this--sharing an interpreter context between multiple concurrent C-threads--so you are on bleeding edge without a backup or safety net.
You're running code I've never seen, on a platform I don't use. To run even theoretically correctly requires the use of mutexes. I've use platform dependant mutexes, you'll have to use something else. The only mechanism I'm aware of on your platform is pthreads cond_vars. At best I find these confusing to use; at worst down right flaky. They seem to be (akin to) "level triggered" rather than "edge triggered" interrupts, with all the ramifications that implies. You will have to code those and I cannot help you. Even if you posted your implementation, I couldn't judge it one way or another.
Whilst my implementation runs properly on my platform for as long as I care to leave it running, when it terminates it produces errors:
This is almost certainly because I have not coded a mechanism to terminate the C-threads, hence they attempt to call back when the perl thread is undergoing global destruction, and errors occur. But "Modification of a read-only value attempted ..." is a weird error to receive? Is that indicative of a coding error within the XS? Would it behave differently on your system (as with Perl_sv_dump)? I'm simply not qualified to answer that.
Also, you've never really explained why you need to use coderefs rather than qualified subnames? They have geven me less trouble on my system. They don't require me to mess around with mortality--which has to be a good thing :)
I haven't been able to exercise, much less test, your real code on your real platform, so any opinion I expressed would be a wild-assed guess, and frankly irresponsible. I'm not enamoured with that idea.
Finally, I'm not party to the criticality of your systems or data; or whether you are subsequently going to start selling your code as part of a package to run air traffic control systems, heart-beat monitors or similar. I cannot make that call for you. I do know that I would want to soak test this in a testbed environment for a good long while before declaring it production ready.
And if the system and data involved are in any way critical; multiple, distinct, realistic testbeds for considerably longer!
The the last partial code I posted contained several errors, so here is the full thing with the corrections:
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.