in reply to Re: Thread::Pool::Simple || !
in thread Thread::Pool::Simple || !
I'll combine my response to both BrowserUK and bulk88 together.
BrowserUK, my threads are wrappped as you have shown.
Both - I have not been able to identify the cause of the threads failing. I suspect that I am probably tripping on some unholy synchronization between the OS (RH15 - 2.6.32.308.el5stab099.3 currently), perl's thread implementation (5.12.4 currently)and my code. The failures happen intermittently recurring anywhere from 1 hour to 1 week/month. My guess is that something is going on the the "thread unit of execution" where there is a failure from an eval and that before perl can recover on the next step, the OS steps in and terminates that unit before perl can log or recover. In all honesty, this is a SWAG or maybe a WAG. I have not been successful in findinb the root cause.
Yesterday afternoon, I started an alternative approach. I have added a sub that I call check_threads to my thread management module. This sub checks to see if all of the thread objects registered are still running or joinable, if not, it calls my start_threads sub to add a replacement thread(s). Given my current use of Thread::Queue to feed the threads, the new thread(s) will dequeue and proceed. I will loose the work against the data that the failed thread dequeued. This is acceptable in my case as subsequent executions of the overall process will pick it up.
I'm fairly confident that this approach will get me to the reliability and performance levels that I need. But, I'm not too happy with the overall code. I "feel" like I have had to write too much code and have, in my ignorance, missed a "better" way of getting my work done. With all of my code functioning, I am going through one more refactoring effort primarily to insure supportability of the code. Once in production and when I get a bit of free time, I want to come up with a test scenario, that I can share freely, and throw out here to get more brains looking at it. I want to go back and test it against the models on CPAN that I tried earlier as well as Coro which I deselected because of a preference to not use coroutines. I also want to look at Perl6 and possibly functional languages like Erlang and Haskell.
My gut is still telling me that there is a simpler approach to this than what I have. If there isn't, then I need to spiff up my thread management kit and put it up on CPAN.
Cheers, lbe
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Thread::Pool::Simple || !
by BrowserUk (Patriarch) on Jul 18, 2012 at 15:22 UTC | |
by learnedbyerror (Monk) on Jul 18, 2012 at 19:02 UTC | |
by bulk88 (Priest) on Jul 18, 2012 at 23:10 UTC | |
by BrowserUk (Patriarch) on Jul 18, 2012 at 19:31 UTC | |
by learnedbyerror (Monk) on Jul 18, 2012 at 20:49 UTC | |
by BrowserUk (Patriarch) on Jul 18, 2012 at 21:17 UTC | |
by BrowserUk (Patriarch) on Jul 18, 2012 at 19:21 UTC |