Skip to content

empty-catch: sdks/typescript/pmxt/server-manager.ts:383 — comment-only catch masks unexpected error in liveness check #1786

Description

@realfishsam

Violation

            try {
                process.kill(info.pid, 0); // throws if dead
                // Still alive — force kill
                try {
                    process.kill(info.pid, 'SIGKILL');
                    await new Promise(resolve => setTimeout(resolve, 200));
                } catch {
                    // Ignore — SIGKILL may race with natural exit
                }
            } catch {
                // Process is dead — good
            }

Location

sdks/typescript/pmxt/server-manager.ts:374-385

Why It Matters

The outer process.kill(info.pid, 0) liveness check throws ESRCH when dead, but can also throw EPERM if the process exists but is owned by a different user. Both are silently treated as "process is dead — good" with zero logging, which could mask a permission problem preventing the kill manager from ever properly cleaning up a stuck sidecar it doesn't have rights to signal.

Suggested Fix

            } catch (e: any) {
                if (e?.code !== 'ESRCH') {
                    logger.debug('server-manager: unexpected error checking process liveness', { pid: info.pid, error: String(e) });
                }
            }

Found by automated code hygiene audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    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