aries-cloudagent-python icon indicating copy to clipboard operation
aries-cloudagent-python copied to clipboard

[Bug] [Connection] OOB record deletion fails with ProfileSessionInactiveError

Open AlexanderShenshin opened this issue 2 years ago • 1 comments

While testing OOB webhook notifications for connection process, I noticed that OOB "deleted" event is not present after connection becomes active, but "done" event is in place (single use invitation).

It appears that OOB record deletion fails with ProfileSessionInactiveError:

  File "/usr/src/app/aries_cloudagent/core/oob_processor.py", line 66, in clean_finished_oob_record
    await oob_record.delete_record(session)
  File "/usr/src/app/aries_cloudagent/protocols/out_of_band/v1_0/models/oob_record.py", line 133, in delete_record
    await super().delete_record(session)
  File "/usr/src/app/aries_cloudagent/messaging/models/base_record.py", line 407, in delete_record
    storage = session.inject(BaseStorage)
  File "/usr/src/app/aries_cloudagent/core/profile.py", line 264, in inject
    raise ProfileSessionInactiveError()
aries_cloudagent.core.error.ProfileSessionInactiveError

Steps to reproduce

  • Setup
    • Add error logging here: https://github.com/hyperledger/aries-cloudagent-python/blob/main/aries_cloudagent/core/oob_processor.py#L67
    • Setup some webhook in ACA-Py to receive agent notifications
  • Create OOB invitation without attachments (works with any handshake protocol)
  • Receive invitation with some agent (for example, Aries Bifold app)
  • Wait until connection protocol completes
  • Check agent notifications -> "done" event is present, "deleted" event is not
  • Check ACA-Py logs -> ProfileSessionInactiveError is raised

This was initially reproduced on 0.10.4 release and then confirmed on a latest one - 0.11.0.

ACA-Py config
label: ACA-Py-Mediator

# Admin
admin: [0.0.0.0, 3000]
admin-insecure-mode: true

# Transport
inbound-transport:
- [http, 0.0.0.0, 3001]
- [ws, 0.0.0.0, 3002]
outbound-transport: http
endpoint:
- REDACTED
- REDACTED

# Wallet
wallet-type: askar
wallet-name: aca-py.wallet
wallet-key: REDACTED
wallet-storage-type: postgres_storage
wallet-storage-config: "{\"url\":\"host.docker.internal:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}"
wallet-storage-creds: REDACTED
wallet-allow-insecure-seed: true
auto-provision: true
seed: a1d491549aef4f3e887bab3dcaa1095a

# Ledger
genesis-url: http://test.bcovrin.vonx.io/genesis

# Mediation
open-mediation: true
enable-undelivered-queue: true

# Load toolbox plugin
plugin:
- acapy_plugin_qa
- acapy_plugin_pickup

# Connections
auto-accept-requests: true
auto-ping-connection: true
connections-invite: true
invite-label: "Mediator"
invite-multi-use: true
webhook-url: REDACTED

log-level: DEBUG

AlexanderShenshin avatar Dec 17 '23 19:12 AlexanderShenshin

@AlexanderShenshin Despite one of the steps saying Wait until connection protocol completes it sounds like you might be closing the profile session (maybe by exiting a with structure) before the deleted event arrives. Maybe add an await asyncio.sleep(5) upon receiving the done event to see if that's a possibility?

Ennovate-com avatar Dec 20 '23 16:12 Ennovate-com

Closing as stale. Reopen if this is still a problem.

jamshale avatar Aug 15 '24 18:08 jamshale