Skip to content

Commit

Permalink
If accepting_requests_ is not set Terminate() returns without doing a…
Browse files Browse the repository at this point in the history
…nything.

This is a problem because based on the usage the executor is usually just calling the function in the same thread. Hence when event_base_dispatch is called the thread hangs and never sets accepting_requests.

Moving this above allows for all usage behavior.

PiperOrigin-RevId: 610492923
  • Loading branch information
tensorflower-gardener authored and tensorflow-copybara committed Feb 26, 2024
1 parent 47e84b8 commit c45fe14
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ bool EvHTTPServer::StartAcceptingRequests() {
ResolveEphemeralPort(ev_listener_, &port_);
}

accepting_requests_.Notify();

IncOps();
server_options_->executor()->Schedule([this]() {
NET_LOG(INFO, "Entering the event loop ...");
Expand All @@ -252,8 +254,6 @@ bool EvHTTPServer::StartAcceptingRequests() {
DecOps();
});

accepting_requests_.Notify();

return true;
}

Expand Down

0 comments on commit c45fe14

Please sign in to comment.