Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use thread local storage for caching instances of ServerProxy #1732

Merged
merged 1 commit into from
Oct 3, 2019

Conversation

johnfettig
Copy link
Contributor

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

@dirk-thomas dirk-thomas changed the base branch from kinetic-devel to melodic-devel August 12, 2019 20:56
@dirk-thomas
Copy link
Member

I retargeted the patch to the melodic-devel branch. Please rebase your changes to apply cleanly.

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: ros#1523
@johnfettig johnfettig force-pushed the xmlrpc_threading_bug branch from 5736a2c to cfddbdd Compare August 16, 2019 02:54
@johnfettig
Copy link
Contributor Author

@dirk-thomas please let me know if any further action is required to have this merged.

@dirk-thomas
Copy link
Member

Thank you for the patch.

@dirk-thomas dirk-thomas merged commit be797b9 into ros:melodic-devel Oct 3, 2019
dirk-thomas pushed a commit that referenced this pull request Aug 4, 2020
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
dirk-thomas pushed a commit that referenced this pull request Aug 4, 2020
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
dirk-thomas pushed a commit that referenced this pull request Aug 4, 2020
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants