Skip to content

LEAK: ByteBuf.release() was not called before it's garbage-collected #9563

Closed
@natraj09

Description

@natraj09

What version of gRPC-Java are you using?

1.49.1

What is your environment?

JDK 17 , linux

What did you expect to see?

NO LEAK DETECTION message

What did you see instead?

 message:  LEAK: ByteBuf.release() was not called before it's garbage-collected. See https://netty.io/wiki/reference-counted-objects.html for more information.
Recent access records: 

Here's the complete exception trace.
leak_record.txt

Steps to reproduce the bug

We have a gRPC service which calls another gRPC service
We found the leak detection message few mins after server starts up and requests are sent to the service.
I turned on the leak detection to paranoid by setting -Dio.grpc.netty.shaded.io.leakDetection.level=paranoid. We immediately started to see lot of LEAK message.

We suspected its something to do with setting a deadline

Here's a sample snippet

ServingProto.Response response;
    try {
      response =
          this.client
              .withDeadlineAfter(deadlineInMs, TimeUnit.MILLISECONDS)
              .getX(request);
    } catch (StatusRuntimeException e) {
      logger.error("Error", e);
      return Y(request);
    }

We removed the deadline and with paranoid settings, we dont see any error message anymore.

Is there anything wrong with the way the deadline is handled in the above scenario or is this a bug?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions