haskell-cryptography / HsOpenSSL

OpenSSL binding for Haskell
http://hackage.haskell.org/package/HsOpenSSL
Creative Commons Zero v1.0 Universal
22 stars 33 forks source link

SSL_shutdown:shutdown while in init #68

Closed kamek-pf closed 2 years ago

kamek-pf commented 2 years ago

Hi,

I'm getting the following errors several times a week from one of our services:

error:140E0197:SSL routines:SSL_shutdown:shutdown while in init

It's using the cql-io package to talk to a Keyspaces instance on AWS.

I went through the OpenSSL issues and apparently, this might happen when calling shutdown before a handshake has been established.

Now, given the current bindings, is it even be possible to get into this situation here ? I can't tell if this is an actual bug or if HsOpenSSL is used incorrectly by cql-io.

I'd appreciate any pointers so I can get started on a fix !

vshabanov commented 2 years ago

With a quick search I found cql-io uses SSL_shutdown at https://gitlab.com/twittner/cql-io/-/blob/develop/src/lib/Database/CQL/IO/Connection/Socket.hs#L86

Quite probably it may run shutdown too early on a non-handshaked connection. So you might have to look more closely at cql-io.

kamek-pf commented 2 years ago

Sounds good, thanks for your input :)