Skip to content

(Orleans 9.1.2) Stateless woker grain potential thread pool tasks leak? #9634

@vrecluse

Description

@vrecluse

I'm using Orleans 9.1.2 in production environment, monitoring metrics counter dotnet.thread_pool.work_item.count.
After time elapsed, the counter grows faster and faster per minute.
This phenomenon disapeared after setting StatelessWorkerOptions.RemoveIdleWorkers to false, or remove all stateless workers.
Maybe it's related to the following code which been added after Orleans 9?

        if (strategy.RemoveIdleWorkers && options.RemoveIdleWorkers)
        {
            _minIdleCyclesBeforeRemoval = options.MinIdleCyclesBeforeRemoval > 0 ? options.MinIdleCyclesBeforeRemoval : 1;
            _inspectionTimer = new Timer(
                static state => ((StatelessWorkerGrainContext)state!).EnqueueWorkItem(WorkItemType.CollectIdleWorkers, CollectIdleWorkersSentinel),
                this,
                options.IdleWorkersInspectionPeriod,
                options.IdleWorkersInspectionPeriod);
        }

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