pistache: Unit test client_multiple_requests_disconnects_handled is failed

Hello,

I have run unit tests on the latest souce and got the following error:

12: [ RUN      ] http_server_test.client_multiple_requests_disconnects_handled
12: Trying to run server...
12: INITING
12: Server address: localhost:38919
12: [server] Sent: 127.0.0.1
12: [server] Sent: 127.0.0.1
12: [server] Sent: 127.0.0.1
12: Response code is OK
12: Response code is OK
12: Response code is OK
12: resolves: 3, rejects: 0, timeout: 1, wait: 6
12: /home/hyperxor/code/pistache/tests/http_server_test.cc:475: Failure
12: Value of: CLIENT_REQUEST_SIZE
12:   Actual: 3
12: Expected: counter
12: Which is: 0
12: [  FAILED  ] http_server_test.client_multiple_requests_disconnects_handled (1003 ms)

It seems it happened after this #838 pull request.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 23 (21 by maintainers)

Commits related to this issue

Most upvoted comments

Has anyone attempted to reproduce the problem under valgrind, specifically “helgrind” [1]? Or compile the code with TSAN [2] ?

[1] https://valgrind.org/docs/manual/hg-manual.html [2] https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual

I faced this issue quite often. Thread sanitizer report:

WARNING: ThreadSanitizer: data race (pid=3415914)
  Write of size 8 at 0x7ba800000468 by thread T3 (mutexes: write M0):
    #0 close <null> 
    #1 Pistache::Http::Experimental::Connection::close() src/client/client.cc:624:9 
    #2 Pistache::Http::Experimental::ConnectionPool::shutdown() src/client/client.cc:881:27 
    #3 Pistache::Http::Experimental::Client::shutdown() src/client/client.cc:993:14 
    #4 clientLogicFunc(unsigned long, std::string const&, int, int) tests/http_server_test.cc:241:12 

  Previous read of size 8 at 0x7ba800000468 by thread T7:
    #0 recv <null> 
    #1 Pistache::Http::Experimental::Transport::handleIncoming(std::shared_ptr<Pistache::Http::Experimental::Connection>) src/client/client.cc:499:35 
    #2 Pistache::Http::Experimental::Transport::handleReadableEntry(Pistache::Aio::FdSet::Entry const&) src/client/client.cc:420:17 
    #3 Pistache::Http::Experimental::Transport::onReady(Pistache::Aio::FdSet const&) src/client/client.cc:255:17 
    #4 Pistache::Aio::SyncImpl::handleFds(std::vector<Pistache::Polling::Event>) const src/common/reactor.cc:205:34 
    #5 Pistache::Aio::SyncImpl::runOnce() src/common/reactor.cc:165:21 
    #6 Pistache::Aio::SyncImpl::run() src/common/reactor.cc:177:17 
    #7 Pistache::Aio::AsyncImpl::Worker::run()::'lambda'()::operator()() const src/common/reactor.cc:515:27 

I’ve ran the tests with the thread sanitizer (with both GCC and Clang) and it reports data races in 19 tests, specifically async_test, router_test, cookie_test_3, http_server_test, http_client_test, request_size_test, streaming_test, and threadname_test. The logs are almost 8000 lines long, but if somebody wants to take a look I’ve uploaded them here (Clang) and here (GCC)