zaphoyd / websocketpp

C++ websocket client/server library
http://www.zaphoyd.com/websocketpp
Other
7.05k stars 1.97k forks source link

websocketpp::connection<websocketpp::config::asio_tls_client>::~connection(segment fault) #968

Open GGWellP opened 3 years ago

GGWellP commented 3 years ago

Hi, version is 0.8.1

====================== I organize my manager Class like:

class WebSocketClient
{
public:
    using ws_connection_tls_ptr = std::shared_ptr<websocketpp::connection<websocketpp::config::asio_tls_client>>;
    class Connection
    {
    private:
        ws_connection_tls_ptr ws_con_tls_ptr_;
    }
private:
    using ws_client_tls = websocketpp::client<websocketpp::config::asio_client>;
    std::shared_ptr<ws_client_tls> ws_client_tls_ptr_;
    std::map<ws_connection_tls_ptr, ConnectionPtr, std::owner_less<ws_connection_tls_ptr>> con_tls_map_;
}

================= Procedure:

  1. Start a WebSocketServer to Handle TLS Connections(Just echo message which it received)
  2. Start a WebSocketClient and Create a connection to WebSocketServer
  3. Send message in WebSocketClient.(ps: I can see the message in Server's OnMessage and Client's OnMessage)
  4. Then I Stop my WebSocketClient and it Quit
  5. I got Segmentation fault(core dump)

Here is what I got when I gdb:

unlink(av, p, bck, fwd)
#0 in malloc_consolidate at malloc.c
#1 in _int_free at malloc.c
#2 in CRYPTO_free()
#3 in ssl_buf_freelist_free()
#4 in SSL_CTX_free()
#5 in boost::asio::ssl::context::~context()
.......
#16 in websocketpp::connection<websocketpp::config::asio_tls_client>::~connection
.......
#31 in std::map<ws_connection_tls_ptr, ConnectionPtr, std::owner_less<ws_connection_tls_ptr>>::~map()
#32 in WebSocketClient::~WebSocketClient()

================================

I have no idea what happened, thanks anyway!

LocutusOfBorg commented 2 years ago

Hello, do you have openssl 3?