Change SonarInitConfig to take two EventBases

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.

This is the first step which just changes the interface to pass two event bases.
The consumers will be changed to pass in different threads next.

Reviewed By: danielbuechele

Differential Revision: D8748350

fbshipit-source-id: 481d6f23644f28fd0f1c786252605287019c999c
This commit is contained in:
John Knox
2018-07-09 07:45:59 -07:00
committed by Facebook Github Bot
parent 7ed154c510
commit cebc409da6
7 changed files with 25 additions and 14 deletions

View File

@@ -24,6 +24,7 @@ public final class AndroidSonarClient {
final Context app = context.getApplicationContext();
SonarClientImpl.init(
sSonarThread.getEventBase(),
sSonarThread.getEventBase(),
getServerHost(app),
"Android",

View File

@@ -29,7 +29,8 @@ class SonarClientImpl implements SonarClient {
}
public static native void init(
EventBase eventBase,
EventBase callbackWorker,
EventBase connectionWorker,
String host,
String os,
String device,

View File

@@ -268,7 +268,8 @@ class JSonarClient : public jni::HybridClass<JSonarClient> {
static void init(
jni::alias_ref<jclass>,
JEventBase* jEventBase,
JEventBase* callbackWorker,
JEventBase* connectionWorker,
const std::string host,
const std::string os,
const std::string device,
@@ -287,7 +288,8 @@ class JSonarClient : public jni::HybridClass<JSonarClient> {
std::move(appId),
std::move(privateAppDirectory)
},
jEventBase->eventBase(),
callbackWorker->eventBase(),
connectionWorker->eventBase()
});
}