You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "TimurRakhmatullin86 (via GitHub)" <gi...@apache.org> on 2026/07/09 17:19:37 UTC

[PR] Fix AwaitMessageTrigger crash on tombstone messages when apply_function is unset [airflow]

TimurRakhmatullin86 opened a new pull request, #69665:
URL: https://github.com/apache/airflow/pull/69665

   When `AwaitMessageTrigger` is used without an `apply_function` (supported since #55437), the trigger calls `message.value().decode("utf-8")` on every polled message. For a tombstone message — `value()` is `None`, a routine occurrence on log-compacted topics where a null value is the deletion marker — this raises `AttributeError: 'NoneType' object has no attribute 'decode'`, crashing the trigger and failing the deferred task.
   
   This PR treats a tombstone the same way as any other non-matching message: no event is emitted, the offset is committed (when `commit_offset=True`, matching the existing non-matching path so the tombstone is not re-read forever after a restart), and the trigger keeps polling.
   
   Why skip rather than emit: the trigger's contract is already truthiness-based (`if event:`), so a `None` payload cannot be yielded on this path today, and a `TriggerEvent(None)` would carry no usable payload downstream. Users who need to react to tombstones can already do so via `apply_function`, which receives the raw message (including `value() is None`) and can map it to any truthy payload. Surfacing tombstones from the no-`apply_function` convenience path would be a separate opt-in feature; crashing on them is a bug.
   
   Tests:
   * `test_trigger_run_tombstone_message_keeps_polling` — regression test: `poll()` returns a null-value message; asserts the trigger neither raises nor yields and commits the tombstone offset. Fails on `main` with the exact `AttributeError` above.
   * `test_trigger_run_without_apply_function_yields_message_value` — asserts the happy path still yields the decoded payload.
   * `MockedMessage` now has a `value()` method: the `apply_function=None` case of `test_trigger_run_good` previously passed for the wrong reason — the mock lacked `value()`, so the task finished via this same `AttributeError`, satisfying `task.done() is True`.
   
   No behavior change for non-null messages or when `apply_function` is set. Empty (`b""`) payloads were already treated as non-events by the `if event:` check — unchanged.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix AwaitMessageTrigger crash on tombstone messages when apply_function is unset [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #69665:
URL: https://github.com/apache/airflow/pull/69665


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org