From a8c4854f60d72d083bd34b34a9ccccc7353d052c Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Tue, 19 Dec 2023 10:54:11 +0100 Subject: various TSAN/ASAN/LeakAnalyzer fixes (#622) * fix JobQueue test threading issue. The inner job queued with `QueueJob` would reference `I` from inside the captured closure which would subsequently disappear * made sure application exit is thread safe * don't try to access string data out of bounds * keep-alive flag is accessed from multiple threads * fix memory leaks in Zen upstream client code * TSAN fixes for Event --- src/zenhttp/servers/httpparser.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/zenhttp') diff --git a/src/zenhttp/servers/httpparser.h b/src/zenhttp/servers/httpparser.h index 219ac351d..bdbcab4d9 100644 --- a/src/zenhttp/servers/httpparser.h +++ b/src/zenhttp/servers/httpparser.h @@ -9,6 +9,8 @@ ZEN_THIRD_PARTY_INCLUDES_START #include ZEN_THIRD_PARTY_INCLUDES_END +#include + namespace zen { class HttpRequestParserCallbacks @@ -85,7 +87,7 @@ private: int8_t m_ContentTypeHeaderIndex; int8_t m_RangeHeaderIndex; HttpVerb m_RequestVerb; - bool m_KeepAlive = false; + std::atomic_bool m_KeepAlive{false}; bool m_Expect100Continue = false; int m_RequestId = -1; Oid m_SessionId{}; -- cgit v1.2.3 From 7451d3ab8aa7be6405b6bbbe5e17dcb3ea29e766 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Tue, 19 Dec 2023 10:55:11 +0100 Subject: ensure we can build without trace (#619) `xmake config -zentrace=n` would previously not build cleanly --- src/zenhttp/httpshared.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/zenhttp') diff --git a/src/zenhttp/httpshared.cpp b/src/zenhttp/httpshared.cpp index 5421fcba5..ca014bf1c 100644 --- a/src/zenhttp/httpshared.cpp +++ b/src/zenhttp/httpshared.cpp @@ -19,6 +19,10 @@ #include #include +#if ZEN_PLATFORM_WINDOWS +# include +#endif + ZEN_THIRD_PARTY_INCLUDES_START #include ZEN_THIRD_PARTY_INCLUDES_END -- cgit v1.2.3