Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: PANIC: underlying join failed threded tcp server

by BrowserUk (Patriarch)
on Oct 17, 2012 at 22:51 UTC ( [id://999628]=note: print w/replies, xml ) Need Help??


in reply to Re^2: PANIC: underlying join failed threded tcp server
in thread PANIC: underlying join failed threded tcp server

'The handle is invalid' at rxd.pl line

The handle in question would have to be the thread handle itself; which suggests that it has some how become invalid between beong returned from threads->list(threads::joinable) and your calling join(). Which -- provided there are no other detach() than the one shown commented out -- should not be possible!

As a discovery measure, you could try calling the handle method pprint $join->_handle(); prior to doing the join and see what that yields?

The only other diagnostic measures I can think of, would entail adding some trace into the threads.xs module. If you're up for that, you could try adding:

printf( "thread handle:%x thread-id: %dx\n", thread->handle, GetThread +Id( thread->handle ) );

just before the if(WaitForSingleObject()) call. It might add some info.

You should also add a call to GetLastError() and print out that and teh failing return code within the body of the if, prior to the PANIC.


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.

RIP Neil Armstrong

Replies are listed 'Best First'.
Re^4: PANIC: underlying join failed threded tcp server
by rmahin (Scribe) on Oct 18, 2012 at 01:53 UTC

    Alright adding that print message now.

    As for adding the trace messages to threads.xs, not sure how to go about that. I searched for it in the perl installation folder for it but it was not there. Is it part of the threads.dll?

    Do you think any harm would be caused from doing something like my $val = eval{$join->join()}; as just a way to prevent the server from crashing. We have multiple users issuing commands to another larger server, which randomly picks these smaller servers to issue commands against, so one of them going down is very annoying for them and requires us to constantly monitor them.

    Thanks very much for your response again, you are quite the helpful monk.

      As for adding the trace messages to threads.xs, not sure how to go about that. I searched for it in the perl installation folder for it but it was not there. Is it part of the threads.dll?

      The easiest way would be to grab the latest version of threads from cpan, then build and install it manually. (Once you've checked you can still reproduce the error with the newly built version), you can then modify threads.xs, re-build and install.

      Do you think any harm would be caused from doing something like my $val = eval{$join->join()}; as just a way to prevent the server from crashing.

      If you are not doing anything with the return value from the join, it would probably be an okay temporary workaround. If you're only joining teh thread to make it go away, and it is going away of its own accord, in one sense, job done.

      But in the long term, whatever the cause might just be a symptom of a deeper issue in your code; or in the threads module; or perl itself. As you have a recreatable scenario, it would be silly not to use it to help track down the underlying issue.


      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.

      RIP Neil Armstrong

      p
        Hey thanks for explanation of how to do that. I got what you asked for, and here is the link to a text file of the output from the start to finish https://dl.dropbox.com/u/19686501/serverOutput.txt None of that info is particularly helpful to me at least but if you see something I don't, I'm all ears. Thanks for your patience in me getting back to you. Took a while to recreate this time.
Re^4: PANIC: underlying join failed threded tcp server
by bulk88 (Priest) on Oct 18, 2012 at 00:51 UTC
    Based on BrowserUK's post, this sounds like a race condition.

      Unlikely. The only way to create a race condition with join, would be to attempt to call it concurrently in two threads.

      1. there is no sign of that possibility in the OPs code.
      2. Perl's internal locks would prevent user code generating that situation.

      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.

      RIP Neil Armstrong

      .

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-26 03:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found