Fix infinite recursion issue when can't connect
Summary: There's an issue with folly's delayedUnsafe(), where it drops your executor and effectively runs all futures inline, in this case instead of scheduling tasks for the future, it grows the stack indefinitely. This fixes the issue by using the safe delayed(), which preserves the executor, so the jobs get shceduled on a different thread as intended. Reviewed By: LeeHowes Differential Revision: D8575956 fbshipit-source-id: c5b2ced43a70505c51883281f202ac947ae6723f
This commit is contained in:
committed by
Facebook Github Bot
parent
f520486c2d
commit
992c032fe7
@@ -99,7 +99,7 @@ SonarWebSocketImpl::~SonarWebSocketImpl() {
|
||||
void SonarWebSocketImpl::start() {
|
||||
folly::makeFuture()
|
||||
.via(worker_->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(worker_->getEventBase())
|
||||
.delayedUnsafe(std::chrono::seconds(reconnectIntervalSeconds))
|
||||
.delayed(std::chrono::seconds(reconnectIntervalSeconds))
|
||||
.then([this]() { startSync(); });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user