f1amingo commented on PR #1405: URL: https://github.com/apache/rocketmq-clients/pull/1405#issuecomment-6309904666
Moving the promise creation earlier fixes the lost Settings callback race, but introduces an unhandled rejection window. `firstSettingsPromise` is created before `await this.updateRoutes()`, but is only awaited after route updates finish. If a status-only telemetry error arrives while another topic’s route query or retry backoff is pending, `onUnknownCommand()` rejects this promise before a rejection handler is attached. Under Node.js’s default unhandled-rejection behavior, this can terminate the process even if the caller handles `startup()` rejection. I reproduced this timing in a minimal script on Node.js v24.18.0 (exit code 1), not against a live cluster. Could we attach a handler immediately after creating the promise? ```ts void firstSettingsPromise?.catch(() => undefined); ``` Keeping the later `await firstSettingsPromise` preserves error propagation to the caller. A regression test covering a telemetry error before route updates complete would also help. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
