In chat client application, to reconnect to the server it keep uses move assignment operation to re-initialize the websocket_client instance. On repeatedly connecting and disconnecting, the move assignment constructor leads to call to abort() function in msvcp120_app.dll.
I have not investigated it in detail. We have test for move constructor which we needto modify to make repeated invocation and investigate to see the real cause of bug. I have opened this bug to make sure this does not fall off the shelf.
Following code is the effective repro code:
-----------------------------------------------------
```
websocket_client m_ws_client(CHAT_SERVER_URL);
// Repeat the below lines in 4-5 times, it will lead to call to abort()
m_ws_client.connect().wait();
// Send / receive messages here
m_ws_client.close().then([=](task<void> close_task) {
close_task.get();
m_ws_client = websocket_client(CHAT_SERVER_URL);
}).wait();
```
Comments: Example code that works fine: ``` websocket_client m_ws_client; int i = 0; while (true) { // Repeat the below lines in 4-5 times, it will lead to call to abort() m_ws_client.connect(CHAT_SERVER_URL).wait(); // Send / receive messages here websocket_outgoing_message wom; wom.set_utf8_message("Hello, world!"); m_ws_client.send(wom).wait(); m_ws_client.close().then([&](task<void> close_task) { close_task.get(); m_ws_client = websocket_client{}; }).wait(); ++i; } ```
I have not investigated it in detail. We have test for move constructor which we needto modify to make repeated invocation and investigate to see the real cause of bug. I have opened this bug to make sure this does not fall off the shelf.
Following code is the effective repro code:
-----------------------------------------------------
```
websocket_client m_ws_client(CHAT_SERVER_URL);
// Repeat the below lines in 4-5 times, it will lead to call to abort()
m_ws_client.connect().wait();
// Send / receive messages here
m_ws_client.close().then([=](task<void> close_task) {
close_task.get();
m_ws_client = websocket_client(CHAT_SERVER_URL);
}).wait();
```
Comments: Example code that works fine: ``` websocket_client m_ws_client; int i = 0; while (true) { // Repeat the below lines in 4-5 times, it will lead to call to abort() m_ws_client.connect(CHAT_SERVER_URL).wait(); // Send / receive messages here websocket_outgoing_message wom; wom.set_utf8_message("Hello, world!"); m_ws_client.send(wom).wait(); m_ws_client.close().then([&](task<void> close_task) { close_task.get(); m_ws_client = websocket_client{}; }).wait(); ++i; } ```