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

Fixes #403 v2 : yield infinite lock #413

Merged
merged 3 commits into from
Jun 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion rosbridge_server/src/rosbridge_server/websocket_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,14 @@ def prewrite_message(self, message, binary):
# Use a try block because the log decorator doesn't cooperate with @coroutine.
try:
with self._write_lock:
yield self.write_message(message, binary)
future = self.write_message(message, binary)

# When closing, self.write_message() return None even if it's an undocument output.
# Consider it as WebSocketClosedError
if future is None:
raise WebSocketClosedError

yield future
except WebSocketClosedError:
rospy.logwarn_throttle(1, 'WebSocketClosedError: Tried to write to a closed websocket')
raise
Expand Down