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

Disable propagateCreateError by default #3132

Closed
wants to merge 1 commit into from

Conversation

guerrerocarlos
Copy link

@guerrerocarlos guerrerocarlos commented Apr 10, 2019

The attribute propagateCreateError should be set to false by default to prevent unexpected Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call? error.

Explanation:

The propagateCreateError is set to true by default in Knex and throws a TimeoutError if the first create connection to the database fails, preventing tarn (the connection pool manager) from re-connecting automatically.

The solution is to set propagateCreateError to false thus enabling knex to automatically reconnect on create connection failure, instead of throwing the error, and only throwing it when the acquireTimeoutMillis has passed, as defined by tarn

Related issues:

#1381 #1382 #1655 #2445 strapi/strapi#2790 #1875 #1909 #2302 #2141 #1264

@elhigu
Copy link
Member

elhigu commented Apr 11, 2019

Propagating the error is the correct and intentional functionality. If you think there is a problem, please add bug report with reproduction case.

If that error is coming before acquireTimeoutMillis has passed, then problem is elsewhere.

That propagateCreateError parameter was originally added to tarn, because I needed it for knex to be able to get errors immediately if there is connection error to the database.

Acquire timeout is waited only in that case if pool is full and we need to wait for free connection slots.

@elhigu elhigu closed this Apr 11, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants