# Cpp\_rpc fail to connect

**URL:** <https://discuss.tvm.apache.org/t/cpp-rpc-fail-to-connect/10324>\
**Category:** Troubleshooting\
**Created:** [June 25, 2021, 1:47pm UTC](https://discuss.tvm.apache.org/t/cpp-rpc-fail-to-connect/10324 "2021-06-25T13:47:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![srkreddy1238](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/srkreddy1238/32/3518_2.png) [@srkreddy1238](https://discuss.tvm.apache.org/u/srkreddy1238)\
**Post date:** [June 25, 2021, 1:47pm UTC](https://discuss.tvm.apache.org/t/cpp-rpc-fail-to-connect/10324/1 "2021-06-25T13:47:33Z")

</div>

Latest version results in below exception

```
python3 -m tvm.exec.rpc_tracker --host=127.0.0.1 --port=9090
INFO:RPCTracker:bind to 127.0.0.1:9091
ERROR:asyncio:Exception in callback BaseAsyncIOLoop._handle_events(10, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(10, 1)>
Traceback (most recent call last):
File "/local/mnt/workspace/sivb/anaconda3/lib/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "/local/mnt/workspace/sivb/anaconda3/lib/python3.8/site-packages/tornado/platform/asyncio.py", 
line 139, in _handle_events
handler_func(fileobj, events)
File "/local/mnt/workspace/sivb/TVM/CI/tvm-bk/python/tvm/rpc/tornado_util.py", line 41, in 
_event_handler
self._event_handler(events)
File "/local/mnt/workspace/sivb/TVM/CI/tvm-bk/python/tvm/rpc/tornado_util.py", line 79, in 
_event_handler
if self._update_read() and (events & self._ioloop.WRITE):
File "/local/mnt/workspace/sivb/TVM/CI/tvm-bk/python/tvm/rpc/tornado_util.py", line 118, in 
_update_read
self.on_message(msg)
File "/local/mnt/workspace/sivb/TVM/CI/tvm-bk/python/tvm/rpc/tracker.py", line 223, in on_message
self.call_handler(json.loads(msg))
File "/local/mnt/workspace/sivb/TVM/CI/tvm-bk/python/tvm/rpc/tracker.py", line 279, in call_handler
if info["addr"][0] is None:
KeyError: 'addr'

```

A bit of debug pointing to [[Bug Fixed] Make query\_rpc\_tracker show the correct device server por… · apache/tvm@0bbaf0e · GitHub](https://github.com/apache/tvm/commit/0bbaf0eb985b0075fdcec8f27ec1b795067d0ea7#diff-e177463bcdc8de3e54fe17bad165e427e431e24b6f6fcdf3be0f8651deaad160)

where the addr is updated for python server but not for cpp\_rpc.

@lmxyy can you check this ?

---

<div class="post-metadata">

**Author:** ![lmxyy](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/lmxyy/32/2673_2.png) [@lmxyy](https://discuss.tvm.apache.org/u/lmxyy)\
**Post date:** [June 25, 2021, 2:12pm UTC](https://discuss.tvm.apache.org/t/cpp-rpc-fail-to-connect/10324/2 "2021-06-25T14:12:36Z")

</div>

Hi, could you elaborate more on this problem? I’ve never met it before during my usage. I think this is caused by the inconsistent TVM version on the tracker and server side.

---

<div class="post-metadata">

**Author:** ![srkreddy1238](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/srkreddy1238/32/3518_2.png) [@srkreddy1238](https://discuss.tvm.apache.org/u/srkreddy1238)\
**Post date:** [June 26, 2021, 6:12am UTC](https://discuss.tvm.apache.org/t/cpp-rpc-fail-to-connect/10324/3 "2021-06-26T06:12:51Z")

</div>

Pls ignore, It happened on one build. Didn’t happen later, I will get back if I come across again.

---

<div class="post-metadata">

**Author:** ![srkreddy1238](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/srkreddy1238/32/3518_2.png) [@srkreddy1238](https://discuss.tvm.apache.org/u/srkreddy1238)\
**Post date:** [June 26, 2021, 6:18am UTC](https://discuss.tvm.apache.org/t/cpp-rpc-fail-to-connect/10324/4 "2021-06-26T06:18:33Z")

</div>

I tried passing `addr` attribute when I got above error and it worked fine for me.

> <https://github.com/apache/tvm/blob/5177729ce3f20b0073c334403136af47b163bb55/apps/cpp_rpc/rpc_tracker_client.h#L82>

Anyway, it’s not happening now.

---

<div class="post-metadata">

**Author:** ![echuraev](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/echuraev/32/2316_2.png) [@echuraev](https://discuss.tvm.apache.org/u/echuraev)\
**Post date:** [June 28, 2021, 7:54am UTC](https://discuss.tvm.apache.org/t/cpp-rpc-fail-to-connect/10324/5 "2021-06-28T07:54:11Z")

</div>

I think this problem is the same as I met for Android RPC: [[RPC] Fix android rpc connection to tracker by echuraev · Pull Request #8327 · apache/tvm · GitHub](https://github.com/apache/tvm/pull/8327) This problem was introduced by this patch: [[Bug Fixed] Make query\_rpc\_tracker show the correct device server por… · apache/tvm@0bbaf0e · GitHub](https://github.com/apache/tvm/commit/0bbaf0eb985b0075fdcec8f27ec1b795067d0ea7)
