Skip to content

Killing ongoing rayon task #1014

@DarkFenX

Description

@DarkFenX

I am writing a synchronous computational library (which does not use rayon by itself), with an option to have HTTP interface on top of it. HTTP interface uses axum/tokio, but as soon as there is any CPU-heavy request to handle, it spawns a rayon task (using tokio-rayon crate so far, as far as I understood from #679, there is no built-in functionality for that so far).

The load depends on what comes in a request, and it's hard to predict by just looking at arguments. My HTTP server is configured with tower timeouts, so that too heavy tasks are killed.

The issue is, so far all i can do in an error handler is to return HTTP error code, while rayon will keep processing it, sometimes until the bitter kill signal. Are there workarounds, which do not involve me spamming my library with channel arguments throughout all its functions, and adding checkpoints where the lib checks for messages and decide if it should stop processing and return an error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions