Skip to content

Improve the internal suspension mechanism to be less prone to deadlocks #5266

Open
@MDoerner

Description

@MDoerner

As observed in issue #5053, our internal parser suspension mechanics intended to guarantee that an action is performed while no parse is running is rather prone to deadlocks. In particular, if a suspension is requested from the UI thread and cannot suspend immediately, either because another action is currently executed under suspension or a parse is running, running into the lock will block the UI thread. This is especially problematic because some actions have to be pushed to the UI thread and be waited for in the parsing process.

I see several ways we can go here.

One way is to reimplement the outer logic of the parse coordinator to use async tasks and an actual queue for parse requests and suspensions without overall locks. This will probably not be straight forward and include some hidden complexity and some gotchas.

Another possibility is to always push suspension requests onto a background thread. This will prevent blocking the UI thread but if an action needs to run on the UI thread, it will have to start a new task on the UI thread from within the suspension and wait for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    development-issueIssues encountered while developing RD, not in RD itselfdifficulty-03-duckInvolves more challenging problems and/or developing within and revising the internals API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions