Skip to content

Avoid logging unnecessary stacktraces when shutdown is happening #326

@BulkBeing

Description

@BulkBeing

When a map pod is deleted, it logs below critical errors with stack traces:

2026-03-04 02:45:22 CRITICAL UDFError, re-raising the error
Traceback (most recent call last):
  File "/opt/venv/lib/python3.11/site-packages/pynumaflow/mapstreamer/servicer/async_servicer.py", line 52, in MapFn
    async for msg in global_result_queue.read_iterator():
  File "/opt/venv/lib/python3.11/site-packages/pynumaflow/shared/asynciter.py", line 20, in read_iterator
    item = await self._queue.get()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/queues.py", line 158, in get
    await getter
asyncio.exceptions.CancelledError

<-- above error 3 more times -->

2026-03-04 02:45:22 CRITICAL
[2026-03-04T02:45:22+0000] CRITICAL [] module=server:
[2026-03-04T02:45:22+0000] INFO [] module=server: Killing process: Got exception UDF_EXECUTION_ERROR(udf): CancelledError()
2026-03-04 02:45:22 INFO     Killing process: Got exception UDF_EXECUTION_ERROR(udf): CancelledError()
/app/entry.sh: line 38:     7 Killed                  python -m "$EVENT_DRIVEN_APP_MODULE" "$UDF_NAME"

This is confusing for the user as this is a normal shutdown and there was no UDF exceptions. We need to catch these exceptions.

Metadata

Metadata

Assignees

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