Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not send package via outdated session #1559

Conversation

niall-shaw
Copy link
Contributor

We found an edge-case where a websocket transport session would be closed/unavailable on the client agent side, but mediator still thinks it is available (due to client being offline).
When client returns back online and initiates a flow via mediator, the mediator will attempt to send the package to the now outdated websocket, instead of the newest / current session.

This PR fixes the problem, but is there any reason why a single connection may need multiple open WebSocket transport sessions?

@niall-shaw niall-shaw requested a review from a team as a code owner August 29, 2023 14:15
return Object.values(this.transportSessionTable).filter(
(session) => session?.connectionId === connectionId && session.type === 'WebSocket'
)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can limit it to one session per type and connection id? That way we don't have to add web socket specific logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'm happy with that also. Bug was only found in WebSocket, that's why I made it this way, but happy to change :)

@niall-shaw
Copy link
Contributor Author

FYI - this bug was found using AFJ 0.3.3, so perhaps it is not relevant anymore, but I can't see why it wouldn't be.

@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2023

Codecov Report

Merging #1559 (e741b6a) into main (c0d9304) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1559   +/-   ##
=======================================
  Coverage   85.73%   85.73%           
=======================================
  Files         950      950           
  Lines       22745    22753    +8     
  Branches     3978     3981    +3     
=======================================
+ Hits        19500    19508    +8     
  Misses       3060     3060           
  Partials      185      185           
Files Changed Coverage Δ
packages/core/src/agent/TransportService.ts 96.55% <100.00%> (+1.31%) ⬆️

@niall-shaw
Copy link
Contributor Author

@TimoGlastra - adjusted for any type

@niall-shaw niall-shaw changed the title fix: do not send package via outdated socket session fix: do not send package via outdated session Aug 29, 2023
@TimoGlastra TimoGlastra merged commit de6a735 into openwallet-foundation:main Aug 30, 2023
8 checks passed
ericvergnaud pushed a commit to Pocket-Developers/aries-framework-javascript that referenced this pull request Sep 15, 2023
genaris pushed a commit to genaris/credo-ts that referenced this pull request Sep 22, 2023
auer-martin pushed a commit to auer-martin/aries-framework-javascript that referenced this pull request Nov 15, 2023
auer-martin pushed a commit to auer-martin/aries-framework-javascript that referenced this pull request Dec 4, 2023
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.

4 participants