Skip to content

[Robustness] Manager ServiceCommands.cs — _serviceLocks semaphores never removed or disposed #531

@Christophe-Rogiers

Description

@Christophe-Rogiers

Severity: Warning

File: src/Servy.Manager/Services/ServiceCommands.cs, lines 30, 666

Description:
_serviceLocks is a ConcurrentDictionary<string, SemaphoreSlim>. Each SemaphoreSlim is IDisposable. Semaphores are added via GetOrAdd but never removed — not when a service is removed, not on shutdown.

In long-running sessions with frequent service adds/removes, this is a slow accumulation of undisposed kernel objects.

Design decision needed:
Should semaphores be removed when a service is uninstalled/removed? Should ServiceCommands implement IDisposable to dispose all semaphores on shutdown? The choice depends on whether semaphore re-creation has measurable cost vs. the leak risk.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions