Crow icon indicating copy to clipboard operation
Crow copied to clipboard

Easily produced 'Worker Crash' with many simple concurrent http requests

Open lemire opened this issue 1 year ago • 3 comments

It is fairly easy to get 'Worker Crash' by stressing the server with, say, 10,000 simultaneous requests. The exact error is:

[Error ]: Worker Crash: An uncaught exception occured: remote endpoint: Transport endpoint is not connected

I have a simple demonstration.

Use a simpler server:

#include "crow.h"
int main() {
  crow::SimpleApp app;
  app.loglevel(crow::LogLevel::Warning);
  CROW_ROUTE(app, "/simple")([](){
    return "Hello world";
  });
  app.port(18080).multithreaded().run();
}

Then just issue a massive number of requests...

bombardier -c 10000 http://localhost:18080/simple

I am not getting similar failures with all other frameworks on the same system.

I am not claiming that it is a bug. This might very well be the desired/expected result as I am definitively stressing the server... and it is fine to have failed requests when under stress.

Feel free to close this issue if you think that there is no concern.

This might be related to https://github.com/CrowCpp/Crow/issues/549

lemire avatar Apr 07 '24 05:04 lemire

Is there any news or progress on this issue? I also can easily provoke this issue when using WebSockets and just connect to them in quick succession (manually by refreshing the page with F5 in the browser even).

Interestingly it only occurs using Linux, under Windows the exact same code performs flawlessly since a couple of years.

After the uncaught exception pops up, the connection handle is in an invalid state (neither onclose nor onerror are called) and a segmentation fault comes up as soon as the next ws message is to be sent.

dc2 avatar Jun 04 '25 18:06 dc2

Sorry, I did not had the time to look deeper into it.

gittiver avatar Jun 04 '25 21:06 gittiver

Thanks for your quick response! If I find the time, I'll try and create a minimal example that triggers this issue.

dc2 avatar Jun 05 '25 10:06 dc2