Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > problem reconnecting an ssl client, the ssl ruby daemon hang

Reply
Thread Tools

problem reconnecting an ssl client, the ssl ruby daemon hang

 
 
jkevinlb@gmail.com
Guest
Posts: n/a
 
      05-16-2007
Hi,
I have an Lua SSL client. The first time it connects, all is fine. But
then, I kill the client. Reconnect it. After a few commands, when more
datas are sent:

# /usr/lib/ruby/1.8/openssl/buffering.rb:178: warning: error on stack:
# error:1409F07F:SSL routines:SSL3_WRITE_PENDING:bad write retry
# Exception `OpenSSL::SSL::SSLError' at
# /usr/lib/ruby/1.8/openssl/buffering.rb:178 - SSL_write:: error:
1409F07F:SSL
# routines:SSL3_WRITE_PENDING:bad write retry

It's complety reproductible. Anybody has an idea ?

Thanks, regards.

Leo

-------------

Ruby (pseudo) code I use:

# SSL key and cert
key = OpenSSL:Key::RSA.new 512
cert = OpenSSL::X509::Certificate.new
cert.not_before = Time.now
cert.not_after = Time.now + 3600
cert.public_key = key.public_key
cert.sign key, OpenSSL:igest::SHA1.new

# SSL context
$ctx = OpenSSL::SSL::SSLContext.new
$ctx.key = key
$ctx.cert = cert

tcp_server = TCPserver.new $port
server = OpenSSL::SSL::SSLServer.new tcp_server, $ctx

while true
socket = server.accept

thread.new socket do |so|
while true
begin
send-receive work
rescue
socket.close
end
end
end
end

 
Reply With Quote
 
 
 
 
Brian Candler
Guest
Posts: n/a
 
      05-16-2007
On Thu, May 17, 2007 at 01:35:04AM +0900, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi,
> I have an Lua SSL client. The first time it connects, all is fine. But
> then, I kill the client. Reconnect it. After a few commands, when more
> datas are sent:
>
> # /usr/lib/ruby/1.8/openssl/buffering.rb:178: warning: error on stack:
> # error:1409F07F:SSL routines:SSL3_WRITE_PENDING:bad write retry
> # Exception `OpenSSL::SSL::SSLError' at
> # /usr/lib/ruby/1.8/openssl/buffering.rb:178 - SSL_write:: error:
> 1409F07F:SSL
> # routines:SSL3_WRITE_PENDING:bad write retry
>
> It's complety reproductible. Anybody has an idea ?


Perhaps you need to make a new SSL context for each incoming connection?
After all, each client will start a fresh SSL negotiation.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: PEP 3143: Standard daemon process library (was: Writing awell-behaved daemon) Floris Bruynooghe Python 1 03-24-2009 02:58 PM
Re: PEP 3143: Standard daemon process library (was: Writing awell-behaved daemon) Jean-Paul Calderone Python 0 03-20-2009 01:02 PM
Daemon Win32::Daemon; ph1975@gmail.com Perl Misc 0 09-07-2006 10:58 AM
Reconnecting Chat Client Sameer Java 0 03-03-2005 08:08 PM
Reconnecting to a JMS Queue (J2EE RI) Marius Java 0 11-05-2003 07:39 PM



Advertisments