When I cause an error inside received_message, it gets silenced and the socket gets closed
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- networking
Research direction
Start with the minimal reproduction in the issue and trace how ws4py.websocket.WebSocket handles exceptions from received_message. Check the error and socket-close path when make_error() raises; done means the behavior is observable and covered by a regression test or documented outcome.
Written by the indexing model from the issue text.
Description
I have an error in one of my larger programs that occurs somewhere in received_message or in a function that is called inside of that function. The error is pretty hard to pin down because when it happens it just gets silenced so I can't figure out where it is, and also the socket gets closed. I wrote a smaller program to simulate this and got the same results. Here's the smaller program:
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from ws4py.websocket import WebSocket
cherrypy.config.update({'server.socket_port': 80, 'server.socket_host': '0.0.0.0'})
WebSocketPlugin(cherrypy.engine).subscribe()
cherrypy.tools.websocket = WebSocketTool()
def make_error():
this_makes_an_error()
class EchoWebSocket(WebSocket):
def closed(self, code, reason=None):
print 'socket closed'
def received_message(self, msg):
make_error()
self.send(msg.data, msg.is_binary) # echo
class Root(object):
@cherrypy.expose
def index(self):
return 'some HTML with a websocket javascript connection'
@cherrypy.expose
def ws(self):
# you can access the class instance through
handler = cherrypy.request.ws_handler
if __name__ == '__main__':
cherrypy.quickstart(Root(), '/', config={'/ws': {'tools.websocket.on': True, 'tools.websocket.handler_cls': EchoWebSocket}})```
When I send a message into the socket via JavaScript, I see no error in the console, just a "socket closed."
Thanks for your help!
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 285
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Lawouach/WebSocket-for-Python
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Lawouach/WebSocket-for-Python#300 ·
-
This project is not well maintained so be very very very patient!May be free again @Lawouach claimed this 652 days ago, and no pull request is open. Openquestion
Lawouach/WebSocket-for-Python#297 · 2 comments · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
Lawouach/WebSocket-for-Python#296 ·
-
Make the codes python 3 compatibleMay be free again @auvipy claimed this 1058 days ago, and no pull request is open. Open
Lawouach/WebSocket-for-Python#280 · 1 comment · 1 assignee ·
-
Setup new CIMay be free again @auvipy claimed this 1230 days ago, and no pull request is open. Open
Lawouach/WebSocket-for-Python#275 · 1 assignee ·
All issues in Lawouach/WebSocket-for-Python
Similar issues
-
good first issue hacktoberfest
Difficulty 1/5 Under an hour Newbie friendliness 92/100
RogueAlg0/taken#387 · 4 comments ·
Maintainers usually reply within 1 day
-
tool-calling
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
vllm-project/vllm#59838 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
raullenchai/Rapid-MLX#4042 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 92/100
transitmatters/mbta-slow-zone-bot#70 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
open-webui/open-webui#31871 · 1 comment ·
Maintainers usually reply within 1 day