[solved] Querying rpc tracker returns empty list (Android device)


#1

Hello,

I am following the instructions from android_rpc,
after launching the tracker on my machine

$ python -m tvm.exec.rpc_tracker --port 9090
INFO:RPCTracker:bind to 0.0.0.0:9090

I run the app and enter the address (tried 0.0.0.0 and real ip), tracker port (here 9090), and key (I use android as recommended), then I query the tracker but get an empty list:

Tracker address localhost:9090

Server List
----------------------------
server-address	key
----------------------------
----------------------------

Queue Status
---------------------------
key   total  free  pending
---------------------------
---------------------------

I am running ubuntu 16.04 in a company (internet proxy, etc.).
I can see that the ports 9090 are listening on both machine, I guess I have missed something but that should not be a tvm problem, however, I still need your help.
Thank you.


#2

Is the tracker accessible from the phone (e.g., are they on the same NAT, etc.).


Android_rpc_test.py does not return anything
#3

What port is your RPC server (on Android) listening on? Run the RPC server app and do “netstat -a” from adb shell.
Assume that your tracker (on Linux) listens on 9090, and the RPC server (on a phone) listens on 5001. The server will attempt to connect to the tracker via 9090, so connections to 9090 on the phone need to be forwarded to port 9090 on Linux, and connections to port 5001 on Linux will need to be forwarded to port 5001 on the phone. To make it work, run

adb forward tcp:5001 tcp:5001
adb reverse tcp:9090 tcp:9090

Then start the tracker, then the server app. Now, the query should show that the server is registered with the tracker.


[solved][AutoTVM] Cannot get remote devices from the tracker
#4

Thank you that was the problem.
Now trying to run nnvm/tutorials/deploy_model_on_mali_gpu.py in which I modified the fields related to backend and device connection, I am getting:

TVMError: Check failed: sock.Connect(addr): Connect to 192.168.123.107:9090

Context:
I am running an rpc server on my linux machine binded to 9090.
I am running the android rcp server port 5001 forwarded (fron netstat -a) as previously mentioned, 9090 reverse forwarded as well, I set the key in the app to “android”.
In the script I have set the host to the ip address of the android phone (in settings>status>ip address, only available when wifi is activated, 192.168.123.107 here), and the port to 9090.
I have replaced rpc.connect(host, port) by rpc.connect(host, port, key) where key = "android".
And that’s it.

I can move my question to a new discussion if that makes more sense.
Thank you in advance for your help.


#5

I have just checked and in fact no, there are not on the same NAT. They are connected with USB so forwarding port with local address nay be the solution. Does 0.0.0.0 correspond to localhost or is it better to replace it with ifconfig result?


#6

On some systems 0.0.0.0 is aliased to localhost. You should not set the ip address on the device to 0.0.0.0, as telling it that it itself is the tracker.

You can try port forwarding, but I have not tested that approach.


#7

Thanks for the reply.
Port forwarding seems to work. Strange thing is that it works with localhost address in the phone but not the real address.
I am speaking in term of results of the query_rpc_tracker script, I can see the device in the list with localhost address on the phone but empty list with true address.
I did the port forwarding as mentionned by kparzysz previously.


#8

0.0.0.0 means “any network interface” and when it’s used in a listening socket (i.e. in a server), it will listen at a given port on all TCPv4 interfaces.


#9

After some reconfigurations/compilations and better understanding, port forwarding is working now.
Thanks


#10

i also encounter such issue, the server ip is 192.168.1.23, android ip is:192.168.1.19

After start tracker on server:

python3 -m tvm.exec.rpc_tracker --port 9090

INFO:root:If you are running ROCM/Metal, fork will cause compiler internal error. Try to launch with arg --no-fork
INFO:RPCTracker:bind to 0.0.0.0:9090

run the app, then query the tracker but get the empty list.

and the app error log is:

07-09 15:31:20.940 6189 6205 W System.err: java.net.SocketTimeoutException: failed to connect to /192.168.1.23 (port 9090) from /192.168.1.19 (port 35636) after 6000ms
07-09 15:31:20.940 6189 6205 W System.err: at libcore.io.IoBridge.connectErrno(IoBridge.java:185)
07-09 15:31:20.940 6189 6205 W System.err: at libcore.io.IoBridge.connect(IoBridge.java:130)
07-09 15:31:20.940 6189 6205 W System.err: at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
07-09 15:31:20.940 6189 6205 W System.err: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:356)
07-09 15:31:20.940 6189 6205 W System.err: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
07-09 15:31:20.940 6189 6205 W System.err: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
07-09 15:31:20.940 6189 6205 W System.err: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:357)
07-09 15:31:20.940 6189 6205 W System.err: at java.net.Socket.connect(Socket.java:626)
07-09 15:31:20.940 6189 6205 W System.err: at ml.dmlc.tvm.rpc.ConnectTrackerServerProcessor.connectToTracker(ConnectTrackerServerProcessor.java:196)
07-09 15:31:20.940 6189 6205 W System.err: at ml.dmlc.tvm.rpc.ConnectTrackerServerProcessor.run(ConnectTrackerServerProcessor.java:107)
07-09 15:31:20.940 6189 6205 W System.err: at ml.dmlc.tvm.tvmrpc.RPCProcessor.run(RPCProcessor.java:67)
07-09 15:31:20.941 6189 6205 W System.err: java.net.SocketException: getsockname failed: EBADF (Bad file descriptor)
07-09 15:31:20.941 6189 6205 W System.err: at libcore.io.IoBridge.getLocalInetSocketAddress(IoBridge.java:713)
07-09 15:31:20.941 6189 6205 W System.err: at java.net.Socket.close(Socket.java:1553)
07-09 15:31:20.941 6189 6205 W System.err: at ml.dmlc.tvm.rpc.ConnectTrackerServerProcessor.run(ConnectTrackerServerProcessor.java:184)
07-09 15:31:20.941 6189 6205 W System.err: at ml.dmlc.tvm.tvmrpc.RPCProcessor.run(RPCProcessor.java:67)
07-09 15:31:20.941 6189 6205 W System.err: Caused by: android.system.ErrnoException: getsockname failed: EBADF (Bad file descriptor)
07-09 15:31:20.941 6189 6205 W System.err: at libcore.io.Linux.getsockname(Native Method)
07-09 15:31:20.942 6189 6205 W System.err: at libcore.io.ForwardingOs.getsockname(ForwardingOs.java:103)
07-09 15:31:20.942 6189 6205 W System.err: at libcore.io.IoBridge.getLocalInetSocketAddress(IoBridge.java:700)
07-09 15:31:20.942 6189 6205 W System.err: … 3 more
07-09 15:31:20.943 6189 6205 W System.err: 5001
07-09 15:31:20.943 6189 6205 W System.err: java.net.BindException: bind failed: EADDRINUSE (Address already in use)
07-09 15:31:20.943 6189 6205 W System.err: using port: 5002
07-09 15:31:20.943 6189 6205 W System : ClassLoader referenced unknown path: system/framework/mediatek-cta.jar


#11

According to the log, port 5001 is already in use, so the server is listening on port 5002. You’ll need to change the adb port forwarding accordingly when that happens.