diff --git a/.gitignore b/.gitignore index 214e176..0029459 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ test_install builds build-linux vcpkg_installed +.DS_Store diff --git a/libraries/http_server/http_server/http_ctx.hh b/libraries/http_server/http_server/http_ctx.hh index a233e8a..e5e1826 100644 --- a/libraries/http_server/http_server/http_ctx.hh +++ b/libraries/http_server/http_server/http_ctx.hh @@ -816,7 +816,14 @@ template auto make_http_processor(F handler) { ctx.flush_responses(); } } -catch (const std::runtime_error& e) { +catch (fiber_exception&) { + // Used internally (e.g. idle timeout, EPOLLRDHUP) to unwind the fiber via + // boost::context's exception-forwarding protocol. Must propagate to the + // callcc entry point in tcp_server.hh, which returns the continuation + // carried by the exception. Swallowing it here leaves boost::context's + // bookkeeping inconsistent and later crashes with a forced_unwind. + throw; +} catch (const std::runtime_error& e) { std::cerr << "Error: " << e.what() << std::endl; return; } catch (...) { diff --git a/single_headers/lithium.hh b/single_headers/lithium.hh index 5bcfaa8..1e8b3a0 100644 --- a/single_headers/lithium.hh +++ b/single_headers/lithium.hh @@ -10415,7 +10415,14 @@ template auto make_http_processor(F handler) { ctx.flush_responses(); } } -catch (const std::runtime_error& e) { +catch (fiber_exception&) { + // Used internally (e.g. idle timeout, EPOLLRDHUP) to unwind the fiber via + // boost::context's exception-forwarding protocol. Must propagate to the + // callcc entry point in tcp_server.hh, which returns the continuation + // carried by the exception. Swallowing it here leaves boost::context's + // bookkeeping inconsistent and later crashes with a forced_unwind. + throw; +} catch (const std::runtime_error& e) { std::cerr << "Error: " << e.what() << std::endl; return; } catch (...) { diff --git a/single_headers/lithium_http_server.hh b/single_headers/lithium_http_server.hh index 5d7acc3..ddb7ef7 100644 --- a/single_headers/lithium_http_server.hh +++ b/single_headers/lithium_http_server.hh @@ -7206,7 +7206,14 @@ template auto make_http_processor(F handler) { ctx.flush_responses(); } } -catch (const std::runtime_error& e) { +catch (fiber_exception&) { + // Used internally (e.g. idle timeout, EPOLLRDHUP) to unwind the fiber via + // boost::context's exception-forwarding protocol. Must propagate to the + // callcc entry point in tcp_server.hh, which returns the continuation + // carried by the exception. Swallowing it here leaves boost::context's + // bookkeeping inconsistent and later crashes with a forced_unwind. + throw; +} catch (const std::runtime_error& e) { std::cerr << "Error: " << e.what() << std::endl; return; } catch (...) { diff --git a/vcpkg b/vcpkg index c2a21b7..cd61e1e 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit c2a21b787cc505d5960d0292d30fd14306b07dd4 +Subproject commit cd61e1e26a038e82d6550a3ebbe0fbbfe7da78e3