Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: panic: COND_DESTROY(6)

by BrowserUk (Pope)
on Jan 27, 2012 at 09:09 UTC ( #950289=note: print w/ replies, xml ) Need Help??


in reply to Re^2: panic: COND_DESTROY(6)
in thread panic: COND_DESTROY(6)

But i don't use semaphores, only locks (i'm locking Object-InsideOut type object). I assume that perlish locks are implemented using low level semaphores?

Yes. A condition variable is a C struct containing a count of the threads waiting, and a semaphore handle:

typedef struct win32_cond { LONG waiters; HANDLE sem; } perl_cond;

When a condition variable is garbage collected (DESTROYed), the semaphore handle is closed, then the memory for the struct is freed. The panic you are seeing is occurring when the attempt to close the semaphore handle fails. The only way I can see this happening is if there is a second attempt to DESTROY a condition variable that has previously been destroyed.

That would put the root cause of problem outside of the realms of your code firmly in the auspices of Perl/threads::shared. But that doesn't help you solve or work around your problem; nor does it give the maintainers any clue as to the circumstances under which the bug is occurring.

The only long-term viable way forward that I see, is for you to remove as much of the proprietary code and dependencies from the code as you can, whilst retaining the flow that causes the bug to occur, and then post that. Odds are that this would allow us to find a workaround that you could fold back into your proprietary code; and give the maintainers a testcase on which to base a future fix.

Looking at the change history for threads::shared, there were changes relating to shared object destruction in the latest build (which you are using), and earlier in version 1.33. My first step would be to downgrade thread::shared on your installation to version 1.32 and see if that 'fixes' the problem.

But for a long term fix, you should really consider trying to come up with a cut-down testcase for the problem, that you have permission to publish. (The smaller the better!).


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.

The start of some sanity?


Comment on Re^3: panic: COND_DESTROY(6)
Download Code
Re^4: panic: COND_DESTROY(6)
by menth0l (Monk) on Jan 27, 2012 at 11:33 UTC
    Thanks for shedding some light on semaphore case.

    I'd really like to create a test case but there's a few obstacles that i'd have to overcome in order to do this. First of all the app is pretty large. In minimal version there are at least 4 threads involved:
    1. thread hosting rpc server
    2. thread preparing load balancing for sql data related to rpc request
    3. thread that sends request with data definition to remote host
    4. thread keeping track of available hosts
    I can't pinpoint which thread is to blame (i can't guess it neither from log nor from the message itself).
    Second of all, the app is tied to local sql database and i can't see any sane way to simulate that in a script.

    I know about the threads::shared bug that was fixed (i reported it to J.D. Hedden ;) but downgrading seems to me like "out of the frying pan, into the fire" - type situation :) But i guess You are right - maybe i could spot this problem more easily with this.

    Although i'm still in a deep dark wood some light can be seen ;) Thanks to You i know it's something related to locks. I'll try to mess around with the code which uses lock the most and test, test, test.... Maybe i create a bug report after all.
      I can't pinpoint which thread is to blame (i can't guess it neither from log nor from the message itself).

      Do you have the ability to build your own Perl and run that in a production-like environment?

      Adding some useful extra information to the specific error message would be quite easy. If you can, and want some suggestions ...


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      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.

      The start of some sanity?

        Ability, yes. Knowledge to do so... not really. As i said: i'm using ActiveState installation so until now i didn't mess with the perl itself.

        But if it's not that hard then maybe i could give it a chance. So, what do i do? :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2014-07-13 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (249 votes), past polls