azure-functions-java-opentelemetry:1.1.0 swallows function exceptions, causing Service Bus messages to be completed instead of retried
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 79/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- azure, java
調査の方向性
Start by reading OpenTelemetryInvocationMiddleware.java and trace how invoke() handles telemetry setup failures versus exceptions from chain.doNext(context). Then inspect the middleware tests and add the suggested regression case with an iterator-backed chain, confirming the business exception reaches the caller. Done means downstream execution occurs once and its failure is not swallowed or replaced.
索引モデルが issue の本文から書いたものです。
説明
Summary
With com.microsoft.azure.functions:azure-functions-java-opentelemetry:1.1.0 enabled, a Java Azure Function triggered by a Service Bus topic subscription reports Succeeded even when the function throws an exception.
Consequently, the failed message is completed rather than retried and never reaches the subscription’s dead-letter queue.
Removing the dependency restores the expected behavior: failed invocations, retries, and eventual dead-lettering.
Environment
Java: 17
Azure Functions Java Gradle plugin: 1.17.0
Azure Functions extension bundle: [4.*, 5.0.0)
Spring Boot: 3.5.6
azure-functions-java-opentelemetry: 1.1.0
opentelemetry-api: 1.49.0
Trigger: Service Bus topic subscription
Observed during local execution on Windows using Azure Functions Core Tools
Application Insights Java agent enabled
Steps to reproduce
Configure a Java Azure Function with a Service Bus topic trigger.
Include azure-functions-java-opentelemetry:1.1.0 and configure the telemetry agent.
Make the function synchronously throw a RuntimeException during message processing.
Send a test message to the topic.
Observe the function execution result and subscription delivery behavior.
Remove the telemetry integration dependency, clean-build, repackage, restart, and repeat with a new test message.
Expected behavior
The exception should propagate to the Java worker:
The invocation should be reported as Failed.
The message should be redelivered according to Service Bus delivery semantics.
Repeated processing failures should eventually move it to the subscription DLQ after exceeding MaxDeliveryCount.
Telemetry instrumentation should not change the function’s success/failure outcome.
Actual behavior
With the dependency enabled, the application logs a processing failure and rethrows the exception, but the host reports:
Executed 'Functions.ForgetUser'
(Succeeded, Id=822181d0-a0e0-40ee-aa1e-f8cba1408ed5, Duration=917ms)
No subsequent delivery was observed for that message, and it did not appear in the DLQ.
After removing the telemetry dependencies and rebuilding, retries and eventual dead-lettering worked.
Suspected root cause
In OpenTelemetryInvocationMiddleware.invoke():
chain.doNext(context) executes the function.
An inner catch (Throwable) records the exception, marks the span as failed, and rethrows it.
The outer catch (Exception spanCreationException) also catches this business-processing exception.
Instead of propagating it, the outer catch calls chain.doNext(context) again.
The Java worker’s InvocationChain uses an iterator. Once the downstream middleware has been consumed, the second doNext() call returns without invoking anything or rethrowing the original exception.
The middleware therefore returns normally, causing the invocation to be reported as successful.
Source: OpenTelemetryInvocationMiddleware.java
Impact
This can cause failed business processing to be silently acknowledged. Service Bus retries and dead-letter handling are bypassed, potentially leaving work permanently unprocessed unless messages can be replayed independently.
Suggested fix
Separate telemetry initialization failure handling from downstream function execution:
Invoke the downstream chain exactly once.
Always propagate exceptions from downstream execution.
Ensure failures while recording exceptions or closing spans do not suppress or replace the original processing exception.
Add a regression test using an iterator-backed middleware chain that verifies a thrown business exception reaches the caller.
Request
Could the maintainers confirm this defect and advise whether a patch release or supported workaround is planned?
- 主要言語
- Java
- スター
- 4
- フォーク
- 22
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/azure-functions-java-additions のほかの issue
-
OTel Java agent does not appear to load in Function Worker under the Flex Consumption hosting planオープンarea:java-functions
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
Migrate to Junit5オープンarea:java-functions
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
Separate class to another artifact not used by function customer再び着手できるかも @kaibocai が 1527 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンarea:java-functions
Azure/azure-functions-java-additions#12 · コメント 1 件 · 担当者 1 名 ·
Azure/azure-functions-java-additions の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
finos/rune-common#819 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue storege-module
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
sdlc-pro/spring-lens#647 ·
メンテナーはふだん 1 日以内に返信
-
lang-java needs-triage package:jni package:jni_flutter package:jnigen
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
valkey-io/valkey-glide#7975 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信