Summary
ToBinding.SkipRuntime_ServiceDefinition__unsubscribe and SkipRuntime_ServiceDefinition__shutdown in @skipruntime/core crash with a TypeError when this.handles.get(skservice) returns undefined.
Additionally, abortFork() can throw inside a catch block, swallowing the original exception.
Location
@skipruntime/core — dist/src/index.js, class ToBinding (around line 792+)
How to reproduce
- Start a Skip service with a Postgres external service
- Trigger a scenario where the service handle is cleaned up before
unsubscribe or shutdown is called (e.g. a connection error or rapid restart)
- The runtime crashes with
TypeError: Cannot read properties of undefined (reading 'unsubscribe') or (reading 'shutdown')
For the abortFork issue:
- Trigger a fork initialization failure (e.g. the external service errors during
subscribe)
- The catch block calls
this.abortFork() which itself throws
- The original error is lost; only the cleanup error propagates
Expected behavior
unsubscribe should be a no-op if the service handle no longer exists
shutdown should resolve gracefully if the service handle no longer exists
abortFork() failures during error cleanup should not mask the original exception
Workaround
// unsubscribe — add null guard
SkipRuntime_ServiceDefinition__unsubscribe(skservice, external, instance) {
const service = this.handles.get(skservice);
if (service == null) return;
service.unsubscribe(external, instance);
}
// shutdown — add null guard, return resolved promise
SkipRuntime_ServiceDefinition__shutdown(skservice) {
const service = this.handles.get(skservice);
if (service == null) return this.handles.register(Promise.resolve());
return this.handles.register(service.shutdown());
}
// abortFork — wrap in try-catch
catch (ex) {
this.setFork(uuid);
try { this.abortFork(); } catch (_) { /* cleanup failure, ignore */ }
throw ex;
}
Version
@skipruntime/core@0.0.19
Summary
ToBinding.SkipRuntime_ServiceDefinition__unsubscribeandSkipRuntime_ServiceDefinition__shutdownin@skipruntime/corecrash with aTypeErrorwhenthis.handles.get(skservice)returnsundefined.Additionally,
abortFork()can throw inside acatchblock, swallowing the original exception.Location
@skipruntime/core—dist/src/index.js, classToBinding(around line 792+)How to reproduce
unsubscribeorshutdownis called (e.g. a connection error or rapid restart)TypeError: Cannot read properties of undefined (reading 'unsubscribe')or(reading 'shutdown')For the
abortForkissue:subscribe)this.abortFork()which itself throwsExpected behavior
unsubscribeshould be a no-op if the service handle no longer existsshutdownshould resolve gracefully if the service handle no longer existsabortFork()failures during error cleanup should not mask the original exceptionWorkaround
Version
@skipruntime/core@0.0.19