Skip to content

Fixed graceful disposal on SIGTERM shutdown in message processors - #306

Merged
oskardudycz merged 2 commits into
event-driven-io:mainfrom
Bazze:fix/sigterm-close-missing-connection-context
Feb 23, 2026
Merged

Fixed graceful disposal on SIGTERM shutdown in message processors#306
oskardudycz merged 2 commits into
event-driven-io:mainfrom
Bazze:fix/sigterm-close-missing-connection-context

Conversation

@Bazze

@Bazze Bazze commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

I discovered something that I think is a bug (?). The processor's shutdown handler was calling close({}) instead of close(startOptions), losing the connection context. This caused postgreSQLProcessingScope to throw "missing connection string" when a processor was terminated via SIGTERM.

I had below error when my local docker container restarted on file changes.

[...]/node_modules/@event-driven-io/emmett-postgresql/src/eventStore/consumers/postgreSQLProcessor.ts:238
      throw new EmmettError(
            ^
_EmmettError: PostgreSQL processor 'reactor:tenant-bootstrap' is missing connection string. Ensure that you passed it through options
    at processingScope ([..]/node_modules/@event-driven-io/emmett-postgresql/src/eventStore/consumers/postgreSQLProcessor.ts:238:13)
    at close ([...]/node_modules/@event-driven-io/emmett/src/processors/processors.ts:416:13)
    at process.<anonymous> (/[...]/node_modules/@event-driven-io/emmett/src/processors/processors.ts:435:38)
    at process.emit (node:events:520:35)
    at process.emit (/app/node_modules/tsx/dist/suppress-warnings.cjs:1:472) {
  errorCode: 500
}

The processor's shutdown handler was calling close({}) instead of
close(startOptions), losing the connection context. This caused
postgreSQLProcessingScope to throw "missing connection string" when
a processor was terminated via SIGTERM.
@oskardudycz

Copy link
Copy Markdown
Collaborator

@Bazze, I think there's something odd happening in the PostgreSQL processor as well. The processor shouldn't require those options; it should just clean up what it has active. As this is fixing the issue for now, I'm going to merge it and later try to improve it. Thanks a lot for doing that. 👍

@oskardudycz oskardudycz added bug Something isn't working PostgreSQL processors labels Feb 23, 2026
@oskardudycz oskardudycz added this to the 0.43.0 milestone Feb 23, 2026
@oskardudycz
oskardudycz merged commit 2d1c421 into event-driven-io:main Feb 23, 2026
1 check passed
@oskardudycz oskardudycz changed the title fix: pass connection context to onClose on SIGTERM shutdown Fixed graceful disposal on SIGTERM shutdown in message processors Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PostgreSQL processors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants