csullivan commented on pull request #6216:
URL: https://github.com/apache/incubator-tvm/pull/6216#issuecomment-670140359
@tqchen I added a counter to the RPCProcessor loop:
```
class RPCProcessor extends Thread {
private String host;
private int port;
private String key;
private boolean running = false;
private long startTime;
private ConnectTrackerServerProcessor currProcessor;
private boolean first = true;
+ private int counter = 0;
@Override public void run() {
RPCWatchdog watchdog = new RPCWatchdog();
watchdog.start();
while (true) {
synchronized (this) {
currProcessor = null;
while (!running) {
try {
this.wait();
} catch (InterruptedException e) {
}
}
try {
currProcessor = new ConnectTrackerServerProcessor(host, port,
key, watchdog);
} catch (Throwable e) {
e.printStackTrace();
// kill if creating a new processor failed
+ System.err.println("Creating a new processor failed, exiting");
System.exit(0);
}
}
+ System.err.println("RPCProcessor infinite loop: " + counter);
+ counter += 1;
if (currProcessor != null)
currProcessor.run();
watchdog.finishTimeout();
}
}
```
In the logs I see that after the watchdog wakes up and calls finish, the
counter is reset. Seems to give evidence that the thread is exiting as expected.
```
...
08-06 14:42:31.157 24737 24761 W System.err: Connection from
/192.168.1.10:60626
08-06 14:42:31.158 24737 24762 W System.err: waiting for timeout: 10000
08-06 14:42:31.160 24737 24761 W System.err: starting server loop...
08-06 14:42:31.192 24737 24761 W System.err: Load module from
/data/user/0/org.apache.tvm.tvmrpc/cache/tvm4j_rpc_7111901762916576085/tmp_func_19a48fccba43c2c0.so
08-06 14:42:31.809 24737 24761 W System.err: done server loop...
08-06 14:42:31.809 24737 24761 W System.err: Finish serving
/192.168.1.10:60626
08-06 14:42:31.812 24737 24762 W System.err: watchdog woken up, ok...
08-06 14:42:31.812 24737 24761 W System.err: using port: 5001
08-06 14:42:31.812 24737 24761 W System.err: RPCProcessor infinite loop: 7
<---
08-06 14:42:31.812 24737 24761 W System.err: currProcessor.run()
08-06 14:42:31.922 24737 24761 W System.err: registered with tracker...
08-06 14:42:31.922 24737 24761 W System.err: waiting for requests...
08-06 14:42:31.923 24737 24761 W System.err:
matchKey:android:0.16312182579570966
08-06 14:42:31.923 24737 24761 W System.err: key:
client:android:0.16312182579570966 -timeout=10
08-06 14:42:31.924 24737 24761 W System.err: alloted timeout: 10
08-06 14:42:31.924 24737 24761 W System.err: Connection from
/192.168.1.10:60628
08-06 14:42:31.924 24737 24762 W System.err: waiting for timeout: 10000
08-06 14:42:31.925 24737 24761 W System.err: starting server loop...
08-06 14:42:32.001 24737 24761 W System.err: Load module from
/data/user/0/org.apache.tvm.tvmrpc/cache/tvm4j_rpc_1859845163597930021/tmp_func_d08fd3eb029d7c7.so
08-06 14:42:41.925 24737 24762 W System.err: watchdog woke up! <---
08-06 14:42:41.925 24737 24762 W System.err: terminating... <--- calls
finish()
08-06 14:42:41.926 24737 24813 W System.err: Deleting
/data/user/0/org.apache.tvm.tvmrpc/cache/tvm4j6272654684694666821
08-06 14:42:41.983 24511 24511 W System.err: MainActivity onResume...
08-06 14:42:46.987 24511 24511 W System.err: relaunching RPC activity...
08-06 14:42:46.987 24511 24511 W System.err: updating preferences...
08-06 14:42:47.048 24818 24818 W System.err: rpc activity onCreate...
08-06 14:42:47.049 24818 24842 W System.err: using port: 5001
08-06 14:42:47.049 24818 24842 W System.err: RPCProcessor infinite loop: 0
<---
...
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]