Skip to content

HA Crash due to Firestore/gRPC thread spawning #109

Description

@Simonfitzgerald

Problem
Recently, Home Assistant experiences total system instability and crashes due to complete memory exhaustion (MemoryError / std::bad_alloc). The log shows a continuous storm of background threads being spawned by google.api_core.bidi and grpc following an authentication drop.

With Googles help analysing the logs it believes the cause is related to the Evnex plugin and provided the following information. I apologise in advance if AI's analysis is incorrect and happy to provide complete logs if required.

The Network Drops:
The loop begins with a series of ReadTimeout exceptions coming directly from the integration coordinator:
File "/config/custom_components/evnex/coordinator.py", line 65, in _async_update_data
charge_points = await self.client.get_org_charge_points(org.id)
...
httpcore.ReadTimeout

Note the credentials are good as the Evnex appears to work well from a UI point of view.

The gRPC Auth Collapse:
Right after the timeout, the underlying Firestore connection drops to an unauthenticated status and fails with a strict permission block:
status = StatusCode.UNAUTHENTICATED
details = "Missing or invalid authentication."
...
RuntimeError: Error 7: Missing or insufficient permissions.

the client recursively tries to reopen the bidirectional stream (bidi.py, watch.py). It spawns a massive cluster of background processes until the OS hits a ceiling, leading to:

RuntimeError: can't start new thread
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc

Home Assistant Core (Running Python 3.14 environment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions