Skip to content

fix: worker exit event calls deployReject after deploy promise already resolved #114

@tarone-saloni

Description

@tarone-saloni

Problem Statement

In [src/utils/deploy.ts:91-105](vscode webview://0k2o3q5pemedv2o17kkm6c5bfcfgp9ugqjmtbdqdf2rd9vese775/src/utils/deploy.ts#L91-L105), the exit event handler always calls deployReject, even after a successful deployment where deployResolve() has already been called. Calling deployReject on an already-settled promise is a no-op, but the comment on line 102 confirms there's a deeper problem: if the process exits while a function is being invoked, the pending invoke promise in the InvokeQueue is never resolved or rejected, leaving the HTTP response permanently hanging.

Steps to reproduce:

Deploy an application successfully.
Invoke a function that takes a long time.
Kill the worker process during the invocation.
The HTTP request hangs forever with no response.

Expected behaviour

Pending invoke callbacks should be rejected with a meaningful error when the worker process exits unexpectedly.

Relevant code

// deploy.ts:91-105
proc.on('exit', code => {
deployReject(new Error(Deployment '${resource.id}' process exited...));
// TODO: How to implement the exit properly? We cannot reject easily
// the promise from the call if the process exits during the call.
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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