Skip to content

us_listen_socket_close crashes with memory error #237

Description

@hb27

Hi,

I followed the suggestion from ReadMe in order for the loop to exit gracefully.
However, after calling us_listen_socket_close(), the application exited the Exception thrown: read access violation. ls->s.context->**loop** was 0xFFFFFFFFFFFFFFB7.
This happens the next line after the call to the bsd_close_socket(us_poll_fd((struct us_poll_t *) &ls->s)) inside context.c.

I am using v0.8.8 with uWebSockets v20.71.0.
Visual studio 2022 Debug Mode with Vcpkg and Windows 11.

Thank you,

The code:

` us_listen_socket_t* socket;

std::thread t([&]()
    {
        std::this_thread::sleep_for(std::chrono::seconds(15));
        us_listen_socket_close(0, socket);
    });

uWS::App().get("/*", fileHandler)
    .listen(80, [&](auto* listen_socket) {
    if (listen_socket) {
        std::cout << "Listening on port " << 80 << '\n';
        socket = listen_socket;
    }
    else
    {
        std::cout << "server failed to launch";
    }
        }).run();`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions