我有如下代码。我的问题是它在随机的基础上崩溃,有以下错误:
perl: ath.c:193: _gcry_ath_mutex_lock: Assertion `*lock == ((ath_mutex_t) 0)' failed.比如,如果我运行代码10次,它会崩溃2-3次。怎么修呢?
use warnings;
use strict;
use Net::SSH2;
use threads;
sub gsmExec {
$host = $_[0];
$port = $_[1];
$user = $_[2];
$pass = $_[3];
my $modem = Net::SSH2->new();
print "Trying to connect host $host : $port \n";
if($modem->connect($host,$port)) {
print "connected to host ..\n";
if ($modem->auth_password($user,$password) {
print "Authorized!!";
}
}
}
for(my $j = 1; $j <= $modemCount; $j++){
$thrList[$j] = threads->create(\&gsmExec,'host',22,'user','pass');
}发布于 2015-02-07 16:46:53
这实际上不是一个perl错误--这是Net::SSH库中的一点C代码。
有一些迹象表明,你不是唯一一个遇到这个问题的人:
id=936201
http://lists.gnupg.org/pipermail/gcrypt-devel/2006-January/000910.html
在GnuTLS中可能有一个bug,这使得它不安全。解决办法是:
fork而不是线程。(Parallel::ForkManager非常适合这一点)。Net::OpenSSH::Parallel可能也能做到这一点。https://stackoverflow.com/questions/27953651
复制相似问题