Skip to content

Potential memory leak related to grpc health probe #2975

@djh-ivy

Description

@djh-ivy

Hey folks I have a very simple grpc health endpoint (https://github.com/grpc-ecosystem/grpc-health-probe) and can observe a memory leak coinciding with the regular health check probes using up roughly half a GB every twelve hours in my specific deployment setting.

In fact I could reproduce it with something along the lines of

while true; do sleep 0.001; grpc_health_probe -addr localhost:50051; done

where I can reproduce the memory leak very quickly.

The solution I have found was to tune the grpc options and to add

'grpc.max_connection_idle_ms': 10000, // Close idle connections after 10s
'grpc.max_connection_age_ms': 30000, // Force connection close after 30s

I wanted to raise this here since I have seen multiple folks run into memory leaks and it was hard to find a workaround.

See

Env: Linux, Node v22, @grpc/[email protected]

I believe a memory leak here is unfortunate even if it turns out it's the client disconnecting in wrong ways. Hope this helps.

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