Skip to content

Subscriber timeout causes a non-informative AbruptTerminationException #2645

@HonzaSinkora

Description

@HonzaSinkora

The pekko.stream.materializer.subscriber-timeout default setting (mode="cancel") cancels the publisher, which results in a termination exception in the stream, but the reason is not propagated. This is already discussed in akka/akka-core#28926, but it also happens without preMaterialization, e.g. when the system is under heavy load during the materialization.

It's quite hard to debug this, because the exception does not convey enough information, and it happens non-deterministically.

Some ideas:

Adding another option (cancel-and-warn) does not seem right, and it breaks compatibility. So does changing the configuration to have 2 separate settings (cancel-on-timeout, warn-on-timeout). In both cases, public API types would need to change.

This non-informative part actually occurs in FanOutProcessorImpl: When the timeout happens, it cancels instead of failing, and future subscribers are only notified about the abrupt termination. I thought I could fix it there - instead of canceling, it would call fail(), notifying the outputs with an exception that contains the information that there had been a timeout. But this also breaks compatibility - the AbruptTerminationException which is currently thrown explicitly sets cause to null, so I can't call initCause. I'd have to change the signature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions