Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Mar 19, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

TheKevJames and others added 20 commits March 19, 2025 15:38
Clean up our general approach to logging:
* include an `exc_message` extra wherever an exception is relevant to
  the log, to allow for message-level aggregation (eg. grouping errors
  by raised exception)
* avoid using string templates in exception messages, to make
  aggregation easier (`message` is always a constant string for any
  given error case, so it can be alerted on)
* downgrade application callback exceptions to a warning, since that can
  be a normal part of user flows -- if users want it logged at the error
  level, they can always do that themselves, we shouldn't be enforcing
  it
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
updates:
- https://github.com/asottile/reorder_python_importshttps://github.com/asottile/reorder-python-imports
- [github.com/pre-commit/mirrors-mypy: v1.14.1 → v1.15.0](pre-commit/mirrors-mypy@v1.14.1...v1.15.0)
- https://github.com/pre-commit/mirrors-autopep8https://github.com/hhatto/autopep8
- [github.com/hhatto/autopep8: v2.0.4 → v2.3.2](hhatto/autopep8@v2.0.4...v2.3.2)
- [github.com/python-jsonschema/check-jsonschema: 0.31.0 → 0.31.3](python-jsonschema/check-jsonschema@0.31.0...0.31.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
We have seen unhandled exceptions making their way to the root unhandled
exception handler of the event loop in our application that uses pubsub
subscribe(), as in the below Traceback. Whilst our application catches
the relevant aiohttp errors when awaiting the subscribe() call, this
exception remained unhandled. This is because subscribe was ignoring the
tasks returned from the calls to asyncio.wait(), meaning any exception
results on these tasks would not be handled and the tasks would get
deleted when subscribe() returned.

Fix this by gathering the results of all worker tasks before returning
from subscribe(). Given that we're about to raise
asyncio.CancelledError() and return, there's no point in raising the
internal errors here, so just log them.

```
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gcloud/aio/pubsub/subscriber.py", line 403, in producer
    new_messages = await asyncio.shield(pull_task)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gcloud/aio/pubsub/subscriber.py", line 426, in producer
    new_messages += await asyncio.wait_for(pull_task, 5)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/tasks.py", line 479, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gcloud/aio/pubsub/subscriber_client.py", line 157, in pull
    resp = await s.post(
           ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gcloud/aio/auth/session.py", line 190, in post
    resp = await self.session.post(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/aiohttp/client.py", line 560, in _request
    await resp.start(conn)
  File "/usr/lib/python3/dist-packages/aiohttp/client_reqrep.py", line 899, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/aiohttp/streams.py", line 616, in read
    await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
```

Co-Authored-By: Kevin James <KevinJames@thekev.in>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Ensures that we use the emulated host when calling `get_signed_url()`
while making use of the GCS emulator.

Closes #828
Added missing `metadata_` when making subsequent posts to the
`rewriteTo` API, as part of `aio.storage.Storage.copy`. This is
necessary when copying large files, as multiple internal posts are
advised.
The current Content-Range header is invalid, add the unit value.

Closes #860
…le (#831)

Added support for type 'impersonated_service_account' with fields 'source_credentials' and
'service_account_impersonation_url' which gcloud will use when you login with the flag
--impersonate-service-account
@pull pull bot added the ⤵️ pull label Mar 19, 2025
@pull pull bot merged commit 6be6ca6 into tj-python:master Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants