Skip to content

Uncaught exception in debug logging #32874

@janikdotzel

Description

@janikdotzel

Description

When debug logging is enabled for Akka Remoting and log-received-messages=on or log-sent-messages=on, an exception thrown by a message's toString() method is not caught.

Problem

The debug logging statements pass objects directly to log.debug(). If the message's toString() method throws an exception (e.g. NullPointerException due to a null field in the message), this exception propagates up.

Reproduction Steps

  1. Enable debug logging for Akka Remoting
  2. Set akka.remote.artery.log-received-messages = on or akka.remote.artery.log-sent-messages = on
  3. Send a message where toString() throws an exception (e.g. a case class with a null field that causes NPE during string conversion)

Code Locations

(There might be more locations)

Expected Behavior

Exceptions thrown during debug logging should be caught and handled gracefully. A warning could be logged instead indicating that the message could not be logged due to a toString() failure.

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