problem reconnecting an ssl client, the ssl ruby daemon hang

Discussion in 'Ruby' started by jkevinlb@gmail.com, May 16, 2007.

  1. Guest

    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::pKey::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::Digest::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
    , May 16, 2007
    #1
    1. Advertising

  2. On Thu, May 17, 2007 at 01:35:04AM +0900, 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.
    Brian Candler, May 16, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marius
    Replies:
    0
    Views:
    692
    Marius
    Nov 5, 2003
  2. Sameer

    Reconnecting Chat Client

    Sameer, Mar 3, 2005, in forum: Java
    Replies:
    0
    Views:
    388
    Sameer
    Mar 3, 2005
  3. John Nagle
    Replies:
    1
    Views:
    1,104
    John Nagle
    Feb 3, 2008
  4. Jean-Paul Calderone
    Replies:
    0
    Views:
    455
    Jean-Paul Calderone
    Mar 20, 2009
  5. Replies:
    2
    Views:
    94
    Tore Aursand
    Dec 12, 2003
Loading...

Share This Page