bcgov / greenlight

A demonstration of the verifiable organization network showing a new restaurant gathering the permits necessary to open.
Apache License 2.0
34 stars 45 forks source link

`Casting error to ErrorCode: Wallet not found: Storage not found` - on agent start-up #156

Closed WadeBarnes closed 5 years ago

WadeBarnes commented 5 years ago

This issue is most prevalent in dFlow due to the number of agents contained in the project, however the cause was identified during a debugging session with Ontario's onbis-x-agent were multiple instances were being spun up to perform an initial data load.

The issue occurs when there are a number of agents spinning up at the same time and connecting to the same wallet. The number of connections opened by the multiple agents exceeds the max connections of the database. New connections then fail, with the stated error, until previous ones are released. The other side affect of this is that the health check on the database container starts to fail because it can't connect due to the lack of available connections. As a result the database container will stop receiving requests, altogether, for a period of time.

Before we just go upping the number of connections on the wallet database we should have a look into the postgresql wallet plug-in's connection management.