Skip to content

fix(isotp): dispose the owned actor before unsubscribing in the constructor catch - #448

Merged
dborgards merged 1 commit into
mainfrom
fix/isotp-ctor-failure-order-#447
Oct 25, 2026
Merged

dborgards merged 1 commit into
mainfrom
fix/isotp-ctor-failure-order-#447

Conversation

@dborgards

Copy link
Copy Markdown
Owner

What does this change?

The IsoTpChannel constructor catch detached the BackgroundExceptionOccurred handler before disposing an owned actor. It now disposes the owned actor first and unsubscribes afterwards, the order the J1939/J1939-TP constructors use since #446, so a shutdown-timeout report from a failing constructor is not dropped.

No regression test, deliberately, and the reasoning of #446 holds here: a throwing constructor never returns the channel, so nothing can subscribe to its BackgroundExceptionOccurred, and OnActorBackgroundException forwards to that empty subscriber list (RaiseBackgroundException). IProtocolActor can be injected, but an injected actor is not disposed here (_ownsActor), and the owned ProtocolActor is sealed with a plain event, so the order is observable only by reflecting on its delegate field from inside its Dispose -- an invasive seam. No mutation was run for that reason.

Not changed, noticed: IsoTpChannel.Dispose still unsubscribes before disposing the owned actor (with a comment giving its reason), unlike the J1939 Dispose paths. That is outside #447 and left alone.

Type of change

  • feat - new behaviour (minor release)
  • fix / perf - bug or performance fix (patch release)
  • docs / test / refactor / chore / ci - no release
  • Breaking change

Checklist

Closes #447


Generated by Claude Code

…ructor catch

The IsoTpChannel constructor catch detached the BackgroundExceptionOccurred
handler before disposing an owned actor. Dispose the actor first and
unsubscribe afterwards, the order the J1939/J1939-TP constructors use since #446.

Closes #447

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011AJKME1N1ZvnY3yYcPwNoF
@cursor

cursor Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Narrow change to the constructor error path only; aligns with an existing J1939 cleanup pattern and does not alter normal channel lifetime or Dispose behavior.

Overview
Constructor failure cleanup in IsoTpChannel now matches the J1939/J1939-TP pattern (#446): on Subscribe failure, an owned ProtocolActor is disposed before detaching BackgroundExceptionOccurred, so shutdown-timeout reports from actor teardown are not dropped because the handler was removed too early.

IsoTpChannel.Dispose is unchanged (still unsubscribes before disposing the owned actor); that ordering was intentionally left out of this fix.

Reviewed by Cursor Bugbot for commit e7bbd6d. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T09:19:21.726120Z e7bbd6d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@dborgards
dborgards merged commit 5628a06 into main Oct 25, 2026
16 checks passed
@dborgards
dborgards deleted the fix/isotp-ctor-failure-order-#447 branch October 25, 2026 09:39
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.

ISO-TP: constructor failure path unsubscribes before disposing the owned actor

1 participant