Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I wrote a Link Checker, to check which Links are dead on a webpage. To get Server informations like Status Code and last modified Date, I used the head function of LWP::simple. Now this takes a lot of time. To speed up the process I’d like to run the processes simultaneous. I used the modul ForkManager and I am very impressed. It’s easy to use and fasten up the program. But it is not reliable. I have run the script multiple times to see the crash happens unregulary. Sometimes after 9 times of executions, then again after the first time, while in between it works fine and correct. The question is why?

The Program crashes with a windows msg opening, saying “Perl Command Line Interpreter has been stop working”.

If I click on show further informations, following Informations get shown:
Problem signature: Problem Event Name: APPCRASH Application Name: perl.exe Application Version: 5.16.3.1604 Application Timestamp: 534c69c3 Fault Module Name: ntdll.dll Fault Module version: 6.1.7601.23864 Fault Module Timestamp: 595fa942 Exception Code: c0000022 Exception offset: 00000000000c8078 OS version: 6.1.7601.2.1.0.272.7 Locale ID: 1031 Additional Information 1: fdd8 Additional Information 2: fdd8457bc7039603b6dc9eb824e5dab9 Additional Information 3: 8044 Additional Information 4: 80447c7063d0a8ad48b87e45c4d37c4f
Though I assume this is an incompatibility problem with lwp::Simple head function, because if I wouldn’t include it in the parallising process, it doesn’t crash so far. But this is also the point in the script, which takes the most time in processing. So I wonder if there is an error in my script or any working alternative? ( I already tried HTTP::Async, which I couldn’t get work at all).


I use ActivePerl 64 bit (v5.16.3 built for MSWindows32-x64-multi-thread) on Windows Server 2008 R2 Standard.

#!d:\perl\bin\perl.exe use LWP::Simple; use strict; use warnings; use Parallel::ForkManager; my $pm= new Parallel::ForkManager(8); #didn’t matter if it’s 1 or 5 o +r whatever else .. crash gets caused anyways foreach my $url ( 'http://us.a1.yimg.com/us.yimg.com/i/ww/m5v9.gif', 'http://hooboy.no-such-host.int/', 'http://www.yahoo.com', 'http://www.ora.com/ask_tim/graphics/asktim_header_main.gif', 'http://www.guardian.co.uk/', 'http://www.pixunlimited.co.uk/siteheaders/Guardian.gif' ) { $pm->start and next; my ($type, $length, $mod) = head($url); unless (defined $type) { print "$url is done \n"; ## I obviously reduced the output msgs $pm->finish; next; } if ($mod) { print "$url is done \n"; $pm->finish; } else { print "$url is done \n"; $pm->finish; } $pm->finish; } $pm->wait_all_children;
Thanks for your time.

In reply to Crash with ForkManager on Windows by amitsq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-24 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found