Repository navigation
v2.26.3
Patch release.
Fixed: a pull consumer run (pullConsumer()->handle(), finite or infinite) no longer ends when its read meets an -ERR the server keeps the connection open for (#209). That covers:
maximum subscriptions exceeded, for example when your application subscribes beyond the subscription limit, a Key/Value watch does, or a firstrequest()sets up its reply inboxInvalid Publish Subject- a
Permissions Violationsuch as... for Publish with Reply of ...
Such an -ERR answers some other SUB or PUB on the connection, never the run's own. It used to end the run, an infinite one included, with ConnectionException: Server sent error frame: ..., an error that names neither the consumer nor what it answered, so the run had to be started again. The run now reports it to the errorListener and the logger (NATS connection error: Server sent error frame: ...) and goes on, keeping its partial batch.
Who should upgrade: anyone running pull consumers on a connection that can reach its subscription limit, or that publishes with reply subjects it may lack permission for. There are no API changes.
Before upgrading
- Watch the error listener, not
handle(), for these errors. Code that restarted a run afterhandle()threw thatConnectionExceptionfor such an-ERRwon't see it there any more. - A rejected reply inbox still ends the run. If the server rejects the run's own reply inbox,
handle()still fails, now always with theJetStreamExceptionthat names the inbox, also when the run's own read is the one that meets the-ERR. - Other failures keep their rules. Another subscription's handler failure under
handlerErrorsFailOperations, an overflow underslowConsumerErrorsFailOperationsand a fatal-ERRstill end the run, including when they arrive in the same chunk as such an-ERR. - Other operations are unchanged. Requests, fetches, batched Direct Get, queue polls and your own reads still fail on such an
-ERR.
Quality gates
- PHPStan level 8.
- 3519 unit tests (with data sets) on PHP 8.2 to 8.5, 159 live integration tests and 49 Behat scenarios. All runnable examples pass.
codecov/patch100%: every changed line is covered. Total coverage 99.04%.- Infection covered MSI 92.72% (90% floor enforced in CI). It skipped 4917 of the 8817 mutants it generated as too slow, so the score does not include them. No mutant escaped in the changed lines.
- New
PullConsumerServerErrorTest, 27 cases, 21 of which fail on 2.26.2, andOperationServerErrorReportingTest, 17 cases. - Seven broken variants of the fix were tried, and each fails at least one case. Two were caught only after additions beyond the issue: a log-level assertion, and a row checking that the pull consumer's read delivers no other subscription's leftovers.
The full record is in the CHANGELOG.