Skip to content

Memory leak when logging exception telemetry #292

@jgogstad

Description

@jgogstad

The WebRequestTrackingFilter uses ThreadLocal to store state. This state is not cleaned up in a finally-clause, but it's cleaned up on this line. That line is never reached if chain.doFilter throws an exception since the exception handling rethrows the exception.

By the way, wouldn't the rethrow make it impossible to correlate the exception with the request? Since no telemetry in sent with request information? How does that correlation work?

By the way2: It's good practice to have classes not marked with final and use protected for fields and methods when writing libraries. When bugs such as these occur, it is much easier for clients to deal with them. With the code as it stands now, I'm left with forking the project and releasing an in-house version with a fix, or copy all the code into my code base.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions