iOS: Use separate thread for network connection
Summary: We currently give sonar one event base from java / obj-c code to use for scheduling tasks. This causes a problem, because we schedule reconnect tasks on the event base, and then these tasks interact with rsocket which schedules it's own tasks. The problem is that we're passing rsocket the same event base. So the reconnect code executes and blocks waiting for rsocket to connect. But rsocket can never connect because it never executes because that thread is blocked, so we get deadlock. Fixing it by giving both processes their own event base / thread. Reviewed By: danielbuechele Differential Revision: D8748355 fbshipit-source-id: b0ad2172087f0103180677438f427c831db7f42c
This commit is contained in:
committed by
Facebook Github Bot
parent
cebc409da6
commit
09c9aad32d
@@ -23,6 +23,7 @@ using WrapperPlugin = facebook::sonar::SonarCppWrapperPlugin;
|
|||||||
@implementation SonarClient {
|
@implementation SonarClient {
|
||||||
facebook::sonar::SonarClient *_cppClient;
|
facebook::sonar::SonarClient *_cppClient;
|
||||||
folly::ScopedEventBaseThread sonarThread;
|
folly::ScopedEventBaseThread sonarThread;
|
||||||
|
folly::ScopedEventBaseThread connectionThread;
|
||||||
#if !TARGET_OS_SIMULATOR
|
#if !TARGET_OS_SIMULATOR
|
||||||
// SKPortForwardingServer *_server;
|
// SKPortForwardingServer *_server;
|
||||||
#endif
|
#endif
|
||||||
@@ -70,7 +71,7 @@ using WrapperPlugin = facebook::sonar::SonarCppWrapperPlugin;
|
|||||||
[privateAppDirectory UTF8String],
|
[privateAppDirectory UTF8String],
|
||||||
},
|
},
|
||||||
sonarThread.getEventBase(),
|
sonarThread.getEventBase(),
|
||||||
sonarThread.getEventBase()
|
connectionThread.getEventBase()
|
||||||
});
|
});
|
||||||
_cppClient = facebook::sonar::SonarClient::instance();
|
_cppClient = facebook::sonar::SonarClient::instance();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user