[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

net::telnet and broken pipe

Mark Probert

6/1/2005 8:20:00 PM


Hi ..

I am getting a consistent broken pipe error on my threaded telnet application
and I am not sure of why.

The error is

.. backtrace:
/usr/local/lib/ruby/1.8/net/telnet.rb:601:
in `syswrite'./bin/sercoll.rb:249:
in `join'./bin/sercoll.rb:249:
in `run_t'./bin/sercoll.rb:249:
in `each'./bin/sercoll.rb:249:
in `run_t'./bin/sercoll.rb:328:
in `run'./bin/sercoll.rb:565

Which is pointing to the following code in telnet.rb

def write(string)
length = string.length
while 0 < length
IO::select(nil, [@sock])
@dumplog.log_dump('>', string[-length..-1]) if @options.has_key? ("Dump_log")
length -= @sock.syswrite(string[-length..-1]) ### line 601
end
end

and the following in my code:

def run_t
threads = []
@nodes.each do |ip_addr|
threads << Thread.new(ip_addr) do |nd|
nn, ip, usr, pwd = nd.split(/:/)
GC.start
### wrapper around telnet
collect(usr, pwd, ip, nn, trc, log)
end
end
threads.each { |thr| thr.join } ### line 249
end

The problem seems to be related to the number of threads that I am running
(there is logic to limit threads to 20 and to do the threading in batches..
this problem only occurs if this logic is implemented, however, there is
nothing to indicate that that the logic is broken, just the broken pipe in
the thread join).

$ ruby -v
ruby 1.8.2 (2004-12-25) [sparc-solaris2.8]

Anyone have any thoughts or ideas on how to proceed?

--
-mark. (probertm at acm dot org)