From 85e6bf6d517e795e6e897c418ce383cfed88145a Mon Sep 17 00:00:00 2001 From: John Knox Date: Mon, 9 Jul 2018 07:46:06 -0700 Subject: [PATCH] Stop using delayedUnsafe Summary: Having another attempt at removing this. It's unsafe because it in some cases executes the .then() task in the timekeeper thread, rather than the executor the original future is using. When that default executor is an InlineExecutor, for example, you can get stack overflow. I tried to remove this use before, but having the same thread used for both the sonar client itself and rsocket, meant that they entered a deadlock trying to connect. Now that I've separated those jobs into separate threads, they can execute independently. Reviewed By: danielbuechele Differential Revision: D8748356 fbshipit-source-id: a1029ece2c7006ad7642cbf8aa59e692c76b19b2 --- xplat/Sonar/SonarWebSocketImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xplat/Sonar/SonarWebSocketImpl.cpp b/xplat/Sonar/SonarWebSocketImpl.cpp index 9f06fa221..b10de40a3 100644 --- a/xplat/Sonar/SonarWebSocketImpl.cpp +++ b/xplat/Sonar/SonarWebSocketImpl.cpp @@ -99,7 +99,7 @@ SonarWebSocketImpl::~SonarWebSocketImpl() { void SonarWebSocketImpl::start() { folly::makeFuture() .via(sonarEventBase_->getEventBase()) - .delayedUnsafe(std::chrono::milliseconds(0)) + .delayed(std::chrono::milliseconds(0)) .then([this]() { startSync(); }); } @@ -185,7 +185,7 @@ void SonarWebSocketImpl::connectSecurely() { void SonarWebSocketImpl::reconnect() { folly::makeFuture() .via(sonarEventBase_->getEventBase()) - .delayedUnsafe(std::chrono::seconds(reconnectIntervalSeconds)) + .delayed(std::chrono::seconds(reconnectIntervalSeconds)) .then([this]() { startSync(); }); }