When logging a lot the supervisor seems to have issues

Received the following error:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 281): TimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?

STR:
Spam the console with a lot of logging.

This went as far as crashing the supervisor completely.

Version:
Supervisor: 9.14.6
balenaOS: 2.33.0+rev1

Hi, would you be able to post a project with a minimal reproduction of this issue?

@torben This is a bug that I’ve experienced on and off for a while, but never was able to correlate a cause and effect. Being able to reproduce this by spamming a lot of logs will be amazingly helpful, so thanks for that!

I’m going to work on this asap, after finishing up a few of my ongoing tasks. I’ve created an issue to track this here: https://github.com/balena-io/balena-supervisor/issues/987

1 Like

I’ve had this bug on the radar for so long I actually just dropped everything… :man_shrugging:

Managed to reproduce fairly well, and added a small in-memory cache in front of the db which seemed to solve the issue (at least when it occurs from this situation - we have actually seen this before the supervisor starting saving the last reported timestamp).

Added the code to a PR here: https://github.com/balena-io/balena-supervisor/pull/988

1 Like

Hey @torben , the PR cameron put up has now been merged in supervisor 9.15.6 which is included in balenaOS v2.37.0, this OS version should make it into production in the next week or two.