Skip to content

test(keychain): cover context-bound OpenSession over an in-process D-Bus link - #668

Merged
Benehiko merged 1 commit into
mainfrom
fix/keychain-session-timeout
Oct 15, 2026
Merged

Benehiko merged 1 commit into
mainfrom
fix/keychain-session-timeout

Conversation

@Benehiko

@Benehiko Benehiko commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Stacked on #697; retarget to main once it merges.

#697 replaces the OpenSession goroutine and select with a single CallWithContext, which removes the leak this PR originally fixed with a pending-session drain in Close. That drain logic is dropped here. What remains is the in-process D-Bus fixture (a fake Secret Service exported over a net.Pipe peer connection) and tests for the new behavior:

  • DH-AES negotiation end to end
  • the session-open timeout returns context.DeadlineExceeded and leaves the connection usable
  • a late success or error reply after a timeout is dropped and does not reach the next call
  • Close right after a timeout disconnects immediately
  • caller cancellation returns context.Canceled
  • an already-cancelled context fails without reaching the backend

The previous head is kept locally as backup/keychain-session-timeout-a1f2272.

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

@Benehiko
Benehiko marked this pull request as ready for review October 15, 2026 12:26

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This incremental review covers commits since 32f63cd5a379.

Assessment: 🟡 NEEDS ATTENTION

The drain-window mechanism correctly defers connection teardown until pending session workers finish, and the goroutine-leak and unbuffered-channel fixes are sound. One concurrency gap was found in the new drain logic: the drainTimer.Stop() return value is not checked, so both the timer goroutine and finishSessionRequest can independently close the connection. A secondary low-severity note covers the timer racing with an in-flight CloseSession call.

Comment thread store/keychain/internal/go-keychain/secretservice/secretservice.go Outdated
Comment thread store/keychain/internal/go-keychain/secretservice/secretservice.go Outdated
Comment thread store/keychain/internal/go-keychain/secretservice/secretservice.go Outdated
Comment thread store/keychain/internal/go-keychain/secretservice/secretservice.go Outdated
@Benehiko
Benehiko force-pushed the fix/keychain-session-timeout branch from a1f2272 to bb2692f Compare October 15, 2026 13:41
@Benehiko Benehiko changed the title fix(keychain): drain timed-out sessions before disconnecting test(keychain): cover context-bound OpenSession over an in-process D-Bus link Oct 15, 2026
@Benehiko
Benehiko changed the base branch from main to refactor/opensession-ctx October 15, 2026 13:41
@joe0BAB
joe0BAB force-pushed the refactor/opensession-ctx branch from abcce0c to 51a3cc4 Compare October 15, 2026 14:00
Base automatically changed from refactor/opensession-ctx to main October 15, 2026 14:16
…Bus link

Exercise OpenSession against an exported fake Secret Service on a net.Pipe peer connection: DH-AES negotiation, the session-open timeout surfacing context.DeadlineExceeded, a late success or error reply after a timeout not reaching the next call, Close disconnecting immediately after a timeout, caller cancellation, and an already-cancelled context never reaching the backend.

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
@Benehiko
Benehiko force-pushed the fix/keychain-session-timeout branch from bb2692f to 07469b0 Compare October 15, 2026 14:29
@Benehiko
Benehiko merged commit 1183f6b into main Oct 15, 2026
23 checks passed
@Benehiko
Benehiko deleted the fix/keychain-session-timeout branch October 15, 2026 14:33
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.

3 participants