Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use thread local storage for caching instances of ServerProxy (#1732)
xmlrpc.client.ServerProxy is not thread safe. See https://bugs.python.org/issue6907 The symptom of this bug is exceptions in the publisherUpdate logged in the master.log. For example: [rosmaster.threadpool][ERROR] : Traceback (most recent call last): File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/threadpool.py", line 218, in run result = cmd(*args) File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/master_api.py", line 210, in publisher_update_task ret = xmlrpcapi(api).publisherUpdate('/master', topic, pub_uris) File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/util.py", line 68, in xmlrpcapi close_half_closed_sockets() File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/util.py", line 79, in close_half_closed_sockets state = transport._connection[1].sock.getsockopt(socket.SOL_TCP, socket.TCP_INFO) File "/usr/lib/python2.7/socket.py", line 228, in meth return getattr(self._sock,name)(*args) File "/usr/lib/python2.7/socket.py", line 174, in _dummy raise error(EBADF, 'Bad file descriptor') error: [Errno 9] Bad file descriptor Some subscribers get the update but some do not. For example, the topic is recorded in a rosbag but not received by nodes that depend on it. Issue: #1523
- Loading branch information