Skip to content

worker.terminate() does not force code to halt. #4134

@paperclover

Description

@paperclover

What version of Bun is running?

any release after #4114

What platform is your computer?

No response

What steps can reproduce the bug?

In #4114, there is one skipped test which is basically trying to terminate a worker like

while(1) {}

The .terminate() will never actually happen as it only is handled in the web_worker.zig event loop. We need to half the current JS execution.

I tried doing this (read VMTraps.h, i exposed some code on zig VM struct to send these) but it either did not work or segfaulted. The workaround only unrefs the worker, which if there is no extra work on the main thread or message listeners, this will be enough to let the main thread die on it's own, but that's not a real solution.

We need to properly kill the JS execution and then emit the close event on the worker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnode.jsCompatibility with Node.js APIs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions