WebOfTrust / keria

KERI Agent in the cloud
https://keria.readthedocs.io/en/latest/
Apache License 2.0
17 stars 26 forks source link

Handling socket errors in recursive functions #214

Closed rodolfomiranda closed 3 months ago

rodolfomiranda commented 3 months ago

I was dealing with a problem when creating an AID where one of AID is down when collecting receipts. That situation may cause a socket error in a call to socket.getaddrinfo form hio, raising an error. The error code is dependent on the operating system, it can be caused for several reasons for example a problem in domain name resolution.

That error is propagated back to keripy and keria where the exception is not being handled.

In my case, keria crashed in line 442 of the following function that treats receipts with witnesses. https://github.com/WebOfTrust/keria/blob/c38a54be390543cfb5e3dfc4afc59dbe87efd991/src/keria/app/agenting.py#L430-L444

Note that it's a recursive function that can make the keria process to crash as a whole. I can create a PR to handle the exception there and safeguard the process by doing nothing but logging the error. I want to receive feedback for that approach. Other option may be to handle on the receiptor function in keripy

https://github.com/WebOfTrust/keripy/blob/543057e2d30712477b114f64c158dbf1564149fa/src/keri/app/agenting.py#L40

rodolfomiranda commented 3 months ago

Fixed in keripy PR #273