Skip to content
This repository was archived by the owner on Aug 13, 2026. It is now read-only.
This repository was archived by the owner on Aug 13, 2026. It is now read-only.

2 consecutive calls to CloudLoggingHandler.close throws an exception #989

Description

@otorreno

There was a recent release (3.12.0) that included the changes introduced in #917. The newly introduced close method seems to be called by AppEngine Python runtime at shutdown, so if you would call it explicitly before the runtime does it, then the close function throws an exception because transport is None.

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • Python version: 3.12.10
  • google-cloud-logging version: 3.12.0

Steps to reproduce

  1. Call client.flush_handlers and then client.close explicitly
  2. When GAE terminates the gunicorn worker, it reports the error

Stack trace

 Traceback (most recent call last):
  File "/layers/google.python.runtime/python/lib/python3.12/logging/__init__.py", line 2265, in shutdown
    h.close()
  File "/layers/google.python.pip/pip/lib/python3.12/site-packages/google/cloud/logging_v2/handlers/handlers.py", line 248, in close
    h.close()
  File "/layers/google.python.pip/pip/lib/python3.12/site-packages/google/cloud/logging_v2/handlers/handlers.py", line 248, in close
    self.transport.close()

Activity

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

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/python-logging API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions