Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^5: ithreads picks fight with LWP::Agent; everybody loses (Works for me!)

by BrowserUk (Patriarch)
on Feb 27, 2008 at 07:52 UTC ( [id://670532]=note: print w/replies, xml ) Need Help??


in reply to Re^4: ithreads picks fight with LWP::Agent; everybody loses (Works for me!)
in thread ithreads picks fight with LWP::Agent; everybody loses

(had to set stack size to 4*4096, and s/uleep/usleep/)

Sorry about the uleep, I changed it in the browser from the Win32::Sleep I used here.

I'm surprised you needed to increase the stack size? Your threads don't do much that would consume stack. Or is that a requirement of a 64-bit processor?

The main change I made in that version, beyond the logging, was to bypass perl's cleanup. It is usually during this phase that the mysterious, and for the most part inconsequential, "free to wrong pool" errors usually occur. Hence the reason you have to wait so long.

The other change was to use shared variables. I suspect that it is this that is the cause of the premature segfault. You could try omitting them and see if bypassing the cleanup with POSIX::_exit(); helps.

The problem here is that if you join the threads, the cleanup is triggered early and the problem will arise.

If you detach them, your main thread has nothing to wait on. That's what I used the shared vars and monitor thread to achieve.

Generally, I don't expect that iThreads have been exercised much on 64-bit builds.

Finally, I wouldn't recommend threads or forks for this type of usage. Both are to heavy for this purpose. An IO::Select or a LWP::Parallel will use far less resources for too much greater effort. Best of all, they are more likely to work in your environment.


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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found