Skip to content

Non-idempotent stop operations in StopServices #4817

@e-gineer

Description

@e-gineer

Description

While StopServices() has logic to handle when no service is running (returns ServiceNotRunning), the state file removal in the defer at line 169 always attempts os.Remove(). This could cause errors or warnings if called multiple times in quick succession, though the error is currently ignored.

Severity

MEDIUM - Idempotency issue

Test Reference

Test: TestStopServices_Idempotent in pkg/db/db_local/stop_services_test.go:45 (skipped - requires DB)

Suggested Fix

Consider using os.RemoveAll() or checking file existence before removal.

Related Code

  • pkg/db/db_local/stop_services.go:163-186

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleNo recent activity has been detected on this issue/PR and it will be closed

    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