Skip to content

Schedulers.from(Executor) used by ObserveOn can block underlying Executor indefinitely. #4630

Closed
@devsr

Description

@devsr

I'm having a problem with the Schedulers.from(Executor) wrapper when the Executor is singled threaded and the resulting Scheduler is used with the ObserveOn operator.

A fast producer and a slow subscriber (either with backpressure or callstack blocking) creates a situation where the ObserveOn operator never yields the Executor's thread and nothing submitted directly to the Executor can run.

I think the fundamental problem is in the implementation of rx.internal.schedulers.ExecutorScheduler.ExecutorSchedulerWorker in the run() method. The method will continue looping if more scheduler tasks are available instead of resubmitting itself to the Executor and allowing other executor tasks to run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions