From: Ben Gribaudo Date: 2005-04-14T23:31:18+09:00 Subject: EINTR Error Causing Failure in E-mail Sending Script Hello, The corporation I work for runs a paid mailing list powered by a Ruby 1.8.2 script running on a dual-processor Intel Pentium II Debian Woody R4 server (kernal 2.4.19*)*. Occasionally, we encounter a "Errno::EINTR Interrupted system call" exception coming from /usr/lib/ruby/1.8/net/protocol.rb:197:in `sysread'. This is the method of our application's code that calls the Ruby library method which sometimes results in the error. def mail(message) Net::SMTP.start("localhost", 25) do |smtp| smtp.sendmail(message.to_s, message.from.address, message.to.address) end end Some digging in the ruby-talk archives and on Google (found http://www.delorie.com/gnu/docs/glibc/libc_498.html) make me think that this error may be related to a threading/multi-tasking issue. (Note that our mailer app does not create multiple threads but is run on a multi-processor server.) The impression I received from the ruby-talk archives on how to resolve this issue is to catch the Errno::EINTR exception and retry the block until the the code succeeds. Like: def mail(message) begin Net::SMTP.start("localhost", 25) do |smtp| smtp.sendmail(message.to_s, message.from.address, message.to.address) end rescue Errno::EINTR retry end end Does this sound like a wise* and re*asonable solution? Can any of you shed more light as to why we encounter the EINTR error? Is it a threading/signal handling issue in Ruby or something we are doing in our application or ... ? Thank you, Ben Gribaudo