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

Multiuse invitations: Agent unable to respond to messages #3233

Open
antoncuranz opened this issue Sep 15, 2024 · 0 comments
Open

Multiuse invitations: Agent unable to respond to messages #3233

antoncuranz opened this issue Sep 15, 2024 · 0 comments

Comments

@antoncuranz
Copy link

Hello, I recently encountered a bug concerning the use of multiuse invitations:

Let's consider the following scenario involving two Agents, Alice and Bob:

Alice creates a multi-use invitation and sends it to Bob.

After the connection was established, Alice has two connection entries:
1: An active one representing the just established connection to Bob
2: A second one in state „invitation“ for the multi-use invitation

Bob only has one active connection to Alice.

If Bob now sends a message (e.g. a discover-features v2.0 query) to Alice, Alice’s agent complains that the connection is not active and does not reply.

I only used public DIDs for the connections (did:sov:xyz).

As far as I understand, this is due to the connection caching in connections/base_manager.py:
https://github.com/hyperledger/aries-cloudagent-python/blob/2d2106ed4253f3ad84148c6fb72fba5833154455/aries_cloudagent/connections/base_manager.py#L969-L990
In find_inbound_connection, Alice caches the invitation connection while connecting to Bob.
Once the connection is established, the cache still returns the same result even though there is now an active connection.

I applied a quick fix by only caching the connection if it is not in state "invitation“, which solves this problem.

if connection.state != ConnRecord.State.INVITATION:
    await entry.set_result(cache_val, 3600)

But it would probably be better if the cache entry is updated as soon as the connection is established.

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

No branches or pull requests

1 participant