Skip to content

A worker won't pause if it's busy spilling #6182

Closed

Description

@crusaderky

Simplified code:

class WorkerMemoryManager:
    def __init__(self):
        pc = PeriodicCallback(self.memory_monitor, 200)
        worker.periodic_callbacks["memory_monitor"] = pc

    async def memory_monitor(self):
        if self._memory_monitoring:
            return
        self._memory_monitoring = True
        self._maybe_pause_or_unpause()
        await self._maybe_spill()
        self._memory_monitoring = False

If the file system is particularly slow, the spilling may take more than 200ms. This means that the worker may jump from 70% (spill threshold) to 95% (terminate threshold) while ignoring the pause threshold (80%).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions