Summary
The Python ServerManager.ensure_server_running() calls _kill_orphan_sidecars() before spawning a new sidecar. TypeScript has no equivalent step.
Python (sdks/python/pmxt/server_manager.py, lines 111–117):
# Step 3: Kill orphan sidecars so the new one can bind the default port
self._kill_orphan_sidecars()
# Step 4: Start server via launcher
self._start_server_via_launcher()
_kill_orphan_sidecars (lines 259–298) uses pgrep -f 'pmxt.*bundled[.]js' on POSIX and wmic on Windows to enumerate and SIGTERM every orphaned sidecar process, then waits 500 ms before the new spawn.
TypeScript (sdks/typescript/pmxt/server-manager.ts, doEnsureServerRunning, lines 177–237):
No orphan-killing step exists. The sequence goes:
- (optional) kill old server if
PMXT_ALWAYS_RESTART
- Check
isServerRunning
- (optional) kill old server if version mismatch
- Spawn via
pmxt-ensure-server
waitForServer
Impact
On machines where a previous Node/Python process exited without stopping its detached sidecar, the TypeScript SDK may fail to start a new sidecar because the orphan occupies the default port (3847). The Python SDK recovers from this automatically; the TypeScript SDK does not, leaving users with port-in-use errors that are hard to diagnose.
Expected behaviour
Both SDKs should either (a) kill orphan processes before spawning, or (b) consistently rely on pmxt-ensure-server itself to handle port conflicts.
Files
| SDK |
File |
Lines |
| Python |
sdks/python/pmxt/server_manager.py |
111, 259–298 |
| TypeScript |
sdks/typescript/pmxt/server-manager.ts |
177–237 |
Summary
The Python
ServerManager.ensure_server_running()calls_kill_orphan_sidecars()before spawning a new sidecar. TypeScript has no equivalent step.Python (
sdks/python/pmxt/server_manager.py, lines 111–117):_kill_orphan_sidecars(lines 259–298) usespgrep -f 'pmxt.*bundled[.]js'on POSIX andwmicon Windows to enumerate and SIGTERM every orphaned sidecar process, then waits 500 ms before the new spawn.TypeScript (
sdks/typescript/pmxt/server-manager.ts,doEnsureServerRunning, lines 177–237):No orphan-killing step exists. The sequence goes:
PMXT_ALWAYS_RESTARTisServerRunningpmxt-ensure-serverwaitForServerImpact
On machines where a previous Node/Python process exited without stopping its detached sidecar, the TypeScript SDK may fail to start a new sidecar because the orphan occupies the default port (3847). The Python SDK recovers from this automatically; the TypeScript SDK does not, leaving users with port-in-use errors that are hard to diagnose.
Expected behaviour
Both SDKs should either (a) kill orphan processes before spawning, or (b) consistently rely on
pmxt-ensure-serveritself to handle port conflicts.Files
sdks/python/pmxt/server_manager.pysdks/typescript/pmxt/server-manager.ts