8000 2 consecutive calls to CloudLoggingHandler.close throws an exception · Issue #989 · googleapis/python-logging · GitHub
[go: up one dir, main page]

Skip to content
2 consecutive calls to CloudLoggingHandler.close throws an exception #989
Closed
@otorreno

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()

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

    0