thread error
hi listers: now i have a question is abort thread i have a main process that have ssh a remote host and everything is ok! but when i use thread it have a error like that - Thread 1 terminated abnormally: DBD::mysql::db do failed: handle 2 is owned by thread 1182010 not current thread 1e3fa20 (handles can't be shared between threads and your driver may need a CLONE method added) at 。。 --- how can i do that? --
Re: thread error
Hi, On Mon, 15 Oct 2012 19:48:46 +0800 xiyoulaoyuanjia wrote: > hi listers: > now i have a question is abort thread > i have a main process that have ssh a remote host and everything is > ok! but when i use thread it have a error like that > - > Thread 1 terminated abnormally: DBD::mysql::db do failed: handle 2 is > owned by thread 1182010 not current thread 1e3fa20 (handles can't be > shared between threads and your driver may need a CLONE method added) > at 。。 > --- The error pretty much speaks for itself. You initialised a database handle in one thread and are using it in another, which DBD::mysql does not allow. You should also reconsider using thread in Perl. See: rindolf: threads.pm is evil, please explain what you're trying to write so we can help you find a better way (see http://www.perlmonks.org/index.pl?node_id=288022 for details on "evil") Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ The Case for File Swapping - http://shlom.in/file-swap Knuth is not God! God has already released TeX version 4.0. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Fw: thread error
Please reply to the list. Regards, Shlomi Fish Begin forwarded message: Date: Mon, 15 Oct 2012 21:20:02 +0800 From: xiyoulaoyuanjia To: Shlomi Fish Subject: Re: thread error is there a way for some threads using the same *Net::SSH::Perl* connection 2012/10/15 Shlomi Fish > Hi, > > On Mon, 15 Oct 2012 19:48:46 +0800 > xiyoulaoyuanjia wrote: > > > hi listers: > > now i have a question is abort thread > > i have a main process that have ssh a remote host and everything is > > ok! but when i use thread it have a error like that > > - > > Thread 1 terminated abnormally: DBD::mysql::db do failed: handle 2 > > is owned by thread 1182010 not current thread 1e3fa20 (handles > > can't be shared between threads and your driver may need a CLONE > > method added) at 。。 > > --- > > The error pretty much speaks for itself. You initialised a database > handle in one thread and are using it in another, which DBD::mysql > does not allow. > > You should also reconsider using thread in Perl. See: > > rindolf: threads.pm is evil, please explain what you're > trying to write so we can help you find a better way (see > http://www.perlmonks.org/index.pl?node_id=288022 for details on > "evil") > > Regards, > > Shlomi Fish > > -- > - > Shlomi Fish http://www.shlomifish.org/ > The Case for File Swapping - http://shlom.in/file-swap > > Knuth is not God! God has already released TeX version 4.0. > > Please reply to list if it's a mailing list post - > http://shlom.in/reply . > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > > -- 继续上路。。 you can follow me at twitter @xiyoulaoyuanjia -- - Shlomi Fish http://www.shlomifish.org/ The Case for File Swapping - http://shlom.in/file-swap All Chuck Norris has to do is *look* at Perl code and it interprets itself out of fear and respect. — DrForr Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Learning CPAN
Hi Danny, On 5 October 2012 03:03, Danny Gratzer wrote: > However I feel like I'm missing most of Perl with CPAN, sure I > know the basic modules but is there any mailing list or website that > regularly features useful modules? > https://metacpan.org/module/Task::Kensho is a good if not the best place to start if you want to see what are good modules to consider learning/using and there are enough there to keep you learning for quite a while! https://metacpan.org/recent shows a list of modules that have just been added or updated - and also has an RSS feed on that page. Not all modules will be great - but they will be recent :) I hope you find the huge number of modules on CPAN as useful rather than daunting - as mentioned elsewhere if in doubt see if you can find a local http://www.pm.org/ group or join #perl-help on irc.perl.org Also keep an eye on what is being discussed and posted about on http://blogs.perl.org/ - and other blog aggregators (more at http://www.perl.org/community.html ) Enjoy your journey into Perl Leo
Parallel::ForkManager and Net::OpenSSH to handle timeout
I am using Parallel::ForkManager to run multiple ssh sessions on various remote hosts. It is working fine. Sometimes I have a problem: problem is in Net::OpenSSH module that, for whatever reason, when far end does not respond the module does not close the SSH connection (i.e. timeout is not working). and, i am running ssh sessions inside forkmanager forked sessions. so i am wondering if there is anything I can use from forkmanager to terminate a child session based on some timeout value? I read Parallel::ForkManager documentation, but to me it looks like i can not. is there anyone more experienced on this, who can help? basic logic: foreach $host (@hostlist) { my $pm->start($host) and next; my $ssh = Net::OpenSSH->new($host, master_opts => [-o => 'StrictHostKeyChecking=no', -o => 'ConnectTimeout 30'], ); ...then some useful work thru ssh ... undef $ssh; $pm->finish; } ty. Rajeev