crow icon indicating copy to clipboard operation
crow copied to clipboard

crash on close websocket in onmessage()/onopen() function

Open chengjianxi opened this issue 6 years ago • 2 comments

crash on close websocket in onmessage()/onopen() function.

        CROW_ROUTE(app, "/")
		.websocket()
		.onopen([&](crow::websocket::connection& conn) {
		CROW_LOG_INFO << "new websocket connection";
		std::lock_guard<std::mutex> _(mtx);
	
		conn.close();
        })
		.onmessage([&](crow::websocket::connection& conn, const std::string& data, bool is_binary) {
		std::lock_guard<std::mutex> _(mtx);

		conn.close();
	});

I got error _Left is 0xDDDDDDDD。

                                    adaptor_.close();
                                    close_connection_ = true;
                                    if (!is_close_handler_called_)
                                    {
                                        if (close_handler_)
                                            close_handler_(*this, fragment_);
                                        is_close_handler_called_ = true;
                                    }
                                    check_destroy();
                                }
                            }
                            break;
                        case 0x9: // Ping
                            {
                                send_pong(fragment_);
                            }
                            break;
                        case 0xA: // Pong
                            {
                                pong_received_ = true;
                            }
                            break;
                    }

                    fragment_.clear();
                }

break on websocekt.h line 451, fragment_.clear(); because class Connection already delete , but called fragment_.clear();

chengjianxi avatar Jan 23 '18 08:01 chengjianxi

I'm using VS 2015 on Windows.

chengjianxi avatar Jan 24 '18 01:01 chengjianxi

This problem also happened in MacOS, Apple LLVM version 9.1.0 (clang-902.0.39.2).

Lw-Cui avatar Aug 05 '18 09:08 Lw-Cui