[openssl-users] Crash in SSL_do_handshake: s->method->ssl_renegotiate_check(s)

Michael Clark michael at metaparadigm.com
Sun Apr 5 03:03:42 UTC 2015

On 5/4/15 7:35 am, Michael Clark wrote:
> On 5/4/15 7:32 am, Graham Leggett wrote:
>> On 04 Apr 2015, at 9:46 PM, Michael Clark <michael at metaparadigm.com> wrote:
>>> I am having an issue where the server crashes on subsequent connections
>>> *if* I close the connection file descriptor. See the note in
>>> openssl_async_echo_server.cc on line 239. If I leak a file descriptor
>>> and the next connection uses a new fd then the server works fine. Does
>>> openssl have an internal map of file descriptors? Am I freeing the
>>> connection correctly?
>> In the past when I have built async SSL code, I’ve used memory pools from the Apache Portable runtime (APR) to make sure that all the created resources get properly cleaned up when connections are closed.
>> You need to make sure everything you create is properly released when done. If you don’t, you either leak or crash.
> Yes however this is a case where I am closing the fd, and calling
> SSL_free on the ssl object. i.e. cleaning up, then I get the crash. When
> I leak the fd, it works fine.
> Note this is on OS X. Just discovered I am not getting POLLHUP on Linux,
> rather POLLIN and read returning 0.
> Still debugging...

Apologies all. It wasn't a TLS bug rather I had neglected to remove a
connection from an fd->connection map.

Now works on Darwin/OSX: https://github.com/michaeljclark/async_tls_test

Just working through poll peculiarities on Linux. Thanks.

More information about the openssl-users mailing list