Skip to content

Stop allocating an Exception on Channel shutdown #10524

@slandelle

Description

@slandelle

What version of gRPC-Java are you using?

The latest

What is your environment?

Not relevant

What did you expect to see?

Not an Exception being allocated every time a Channel gets closed.

What did you see instead?

ClientTransportLifecycleManager#notifyShutdown calls Status#asException that allocates an Exception for the sake of being able to track where notifyShutdown was called from. To my understanding, this is a debugging feature, nothing in gRPC's logic requires it.

This generates a lot of allocations when allocation lots of channels for load testing purpose.

Could it be possible to deactivate this feature with a System property? And possibly deactivate it by default if it's indeed only used for debugging and changing it is not considered a breaking change.

Steps to reproduce the bug

Not relevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions