Page MenuHomePhabricator

[server] avoid creating multiple connection pools
ClosedPublic

Authored by kamil on Sep 5 2022, 7:29 AM.
Tags
None
Referenced Files
F2016124: D5050.id16378.diff
Sat, Jun 15, 1:54 AM
Unknown Object (File)
Fri, Jun 14, 6:47 PM
Unknown Object (File)
Fri, May 31, 2:39 AM
Unknown Object (File)
Tue, May 28, 7:16 AM
Unknown Object (File)
Mon, May 27, 3:45 AM
Unknown Object (File)
Mon, May 27, 3:45 AM
Unknown Object (File)
Mon, May 27, 1:50 AM
Unknown Object (File)
May 15 2024, 5:36 AM

Details

Summary

Solves problem described in ENG-1682.

When there are multiple dbQuery at one time also multiple loadPool() can run asynchronously, which lead to problem visible at this debug logs:

image.png (380×1 px, 87 KB)

which means we call mysqlPromise.createPool(options) and assign it to pool when there is an already defined connection, as a result, we override the previous one which is not being closed and cause e.g. scripts not exiting.

Also, each spawned worker has a separate pool connection so this fix should work without additional synchronization.

Test Plan

Run script (e.g. rename-user.js since it begins with multiple asynchronous queries) and check if it will exit adequately.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Sep 5 2022, 7:42 AM
kamil edited the summary of this revision. (Show Details)
kamil edited the test plan for this revision. (Show Details)
kamil added reviewers: atul, ashoat.
This revision is now accepted and ready to land.Sep 6 2022, 12:31 AM

Great catch!! Looks like I introduced this issue in D4097