Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Coro + LWP freezes

by elgato (Novice)
on Aug 25, 2012 at 17:29 UTC ( #989741=perlquestion: print w/ replies, xml ) Need Help??
elgato has asked for the wisdom of the Perl Monks concerning the following question:

Hi, guys. I try to make async https requests with Coro + Coro::LWP + LWP::UserAgent my code looks like:
my @requests; while ( ... ) { push @requests, ...; if (scalar @requests % 3 == 0) { &doRequests(\@requests); } } sub doRequests { my $requests = shift; my @coro = map { async { # here we get LWP::UserAgent object and to request } } @$requests; }
The question is, my code should run all the time, but after running for a few hours or even hour it freezes. No CPU usage, no activity at all, like it's sleeping. This runs perl 5.16.1, latest Core, LWP. I'm wondering how to get know what is the reason for that freeze, how to know where it stopped? PS: i'm querying https host, if that matters. Addon: running strace gives this as last lines berofe freeze:
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 nanosleep({1211417888, 0}, {1211354002, 168413065}) = ? ERESTART_RESTA +RTBLOCK (To be restarted) --- SIGWINCH (Window changed) @ 0 (0) --- restart_syscall(<... resuming interrupted call ...>) = ? ERESTART_REST +ARTBLOCK (To be restarted) --- SIGWINCH (Window changed) @ 0 (0) --- restart_syscall(<... resuming interrupted call ...>
What does this mean?

Comment on Coro + LWP freezes
Select or Download Code
Re: Coro + LWP freezes (*trace)
by tye (Cardinal) on Aug 25, 2012 at 21:08 UTC
      Here what i get with perl-stacktrace:
      root@elgato:/etc# perl-stacktrace 9366 [Thread debugging using libthread_db enabled] 0x00007f7ba19bd500 in __nanosleep_nocancel () at ../sysdeps/unix/sysca +ll-template.S:82 82 ../sysdeps/unix/syscall-template.S: No such file or directory. in ../sysdeps/unix/syscall-template.S /tmp/3c5eHcBTdw.gdb:1761: Error in sourced command file: Cannot access memory at address 0x1
      What does that mean?

        It might be that App::Stacktrace doesn't work with Coro. Or it might just be some other reason it doesn't work in your particular environment.

        The documentation for App::Stacktrace immediately mentions three options. If one were actually curious about what was going on, every one of those three options looks like something one would try.

        - tye        

Re: Coro + LWP freezes
by philiprbrenan (Monk) on Aug 25, 2012 at 23:54 UTC

    Does @requests ever get emptied?

      of course, i form @requests array and undef it after requests finished.
Re: Coro + LWP freezes
by Corion (Pope) on Aug 25, 2012 at 23:55 UTC

    In addition to tye's suggestion, if you reproducibly get a "hung" process, you can try AnyEvent::Debug to look at what parts of it are hung.

    Of course, if the process gets hung in (say) the SSLeay libraries, it won't serve the AnyEvent::Debug shell either, but if you're maybe deadlocking somewhere, it might help.

      How would i know it that s SSLeay hanging everything?

        That's just an example. I think it is the most likely candidate for causing trouble if you are actually doing https requests.

        Maybe you can switch to using http URLs for further diagnosis?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://989741]
Approved by ww
Front-paged by bulk88
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2014-12-29 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (187 votes), past polls