Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

When I cause an error inside received_message, it gets silenced and the socket gets closed

Đang mở
#234 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
networking

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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!
Ngôn ngữ chính
Python
Star
1.1k
Fork
285
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Lawouach/WebSocket-for-Python

Tất cả issue của Lawouach/WebSocket-for-Python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.