List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:March 28 1999 6:30pm
Subject:Forking Processes
View as plain text  
>>>>> "Jonathan" == Jonathan A Zdziarski <jonz@stripped> writes:

Jonathan> Hi,
Jonathan> I'm writing a search engine in PERL right now...it runs great and fast
Jonathan> too...except for one thing.  The program that goes out and fetches the web
Jonathan> pages is currently doing it in sequential order (waiting for #304 to
Jonathan> finish before doing #305).  I would like to program it to fork off into up
Jonathan> to 30 or 40 processes to handle this (using all the proper SQL transaction
Jonathan> code, etc), however I get the errors...

Jonathan> DBD::mysql::st execute failed: Lost connection to MySQL server during
Jonathan> query at ./spider.pl line 157, <GEN0> chunk 32.

Jonathan> when I do this.  I'm trying to determine the possible reasons for this.
Jonathan> One question would be, if I form a connection before forking, can all
Jonathan> processes use the same $DBH handle (speaking perl here) or do I need to
Jonathan> rather re-connect in each instance with its own handle?  If that's not the
Jonathan> problem, what else could be causing it?

Jonathan> Thank you,

Hi!

Sorry, you can't open a connection and then fork without running into
trouble!

fork first and open the MySQL connections after that!

Regards,
Monty
Thread
Forking ProcessesJonathan A. Zdziarski28 Mar
  • Forking ProcessesMichael Widenius29 Mar