Skip to content

Getting an error socket.send() raised an exception. #1354

@stanlyjohn2

Description

@stanlyjohn2
def queue_consumer():
    print("Running Queue Consumer")
    while True:
        with config.connected_set_lock:
            connected_websockets = config.connected.copy()
        with config.data_queue_lock:
            try:
                while not config.data_queue.empty():
                    data = config.data_queue.get()
                    websockets.broadcast(
                        connected_websockets, json.dumps(data))
            except queue.Empty:
                print("queue empty")
            except Exception as e:
                # Handle the exception
                print(f"Exception occurred during broadcast: {e}")
        print("Waiting for interval", INTERVAL)
        sleep(INTERVAL)

For the above code, it is running fine for few hours, but after that, getting an error "socket.send() raised an exception." continously. And it is not printing the broadcast exception, which we are trying to catch in the above code. Why this might be happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions