Skip to content

Investigate potential stale WorkerLoop.THREAD_CONTEXT #11502

@colinsurprenant

Description

@colinsurprenant

Per discussion in #11492 (comment) per @yaauie observation:

Note that WorkerLoop.THREAD_CONTEXT is a ThreadLocal, so each java thread can pull its own ruby thread context out. The trouble arises if and when a java thread ever runs multiple ruby threads in the course of its lifetime (which I do not know), since we only populate it with ThreadLocal#withInitial and then use WorkerLoop.THREAD_CONTEXT in to pass a ThreadContext to various ruby internals that then use it to determine interrupt state.

This is the code in question:

public static final ThreadLocal<ThreadContext> THREAD_CONTEXT =
ThreadLocal.withInitial(RubyUtil.RUBY::getCurrentContext);

We should investigate further into this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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