Skip to content

Fix exception handling and stale trace context in distributed tracing#267

Merged
torosent merged 3 commits intofeature/distributed-tracing-otelfrom
copilot/sub-pr-266
Mar 3, 2026
Merged

Fix exception handling and stale trace context in distributed tracing#267
torosent merged 3 commits intofeature/distributed-tracing-otelfrom
copilot/sub-pr-266

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Three correctness issues in the distributed tracing implementation identified during review.

Changes

  • DurableTaskGrpcWorker.java: Replace catch (Throwable e) { throw e; } with explicit Error rethrow + RuntimeException wrap — preserves Error type identity and avoids ambiguous re-throw semantics.

  • TaskOrchestrationExecutor.java: Explicitly set parentTraceContext = null when ExecutionStartedEvent has no parent trace context. Previously, a stale context from a prior execution could leak into activities/sub-orchestrations during continue-as-new or replay.

  • OrchestrationRunner.java: Narrow catch from Throwable to Exception (prevents wrapping Errors like OutOfMemoryError); move orchestrationScope.close() to finally to guarantee cleanup.

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes are added to the CHANGELOG.md
  • I have added all required tests (Unit tests, E2E tests)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: torosent <17064840+torosent@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • rt.services.visualstudio.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add distributed tracing support with OpenTelemetry Fix exception handling and stale trace context in distributed tracing Mar 3, 2026
@torosent torosent marked this pull request as ready for review March 3, 2026 20:27
@torosent torosent requested a review from a team as a code owner March 3, 2026 20:27
@torosent torosent merged commit 9691eb1 into feature/distributed-tracing-otel Mar 3, 2026
@torosent torosent deleted the copilot/sub-pr-266 branch March 3, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants