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

Race condition: connection pool maximum can be exceeded #7

Open
hoylen opened this issue Jun 21, 2018 · 7 comments
Open

Race condition: connection pool maximum can be exceeded #7

hoylen opened this issue Jun 21, 2018 · 7 comments
Assignees

Comments

@hoylen
Copy link

hoylen commented Jun 21, 2018

More connections than the maximum number for the pool can be created, if too many connections are requested all at once at the start.

The "start" being when the connections are first being established, or are being re-established after they have timed out.

The cause seems to be the Future returned by the call to _createConnection (in line 97 of connection_pool_impl.dart) is not being waited upon. If the application program keeps asking for connections/transactions without yielding, the new connections don't get added to the _pool list (line 109) and therefore the test to see if the maximum number of connections has already been created (line 95) incorrectly allows more connections to be created.

Program that demonstrates the race condition: pool-filling-test.txt

@tejainece tejainece self-assigned this Feb 15, 2019
@tejainece
Copy link
Contributor

I will fix this.

@hoylen
Copy link
Author

hoylen commented Feb 15, 2019

From what I can tell, sqljocky5 v2.2.0 (unfortunately) no longer supports connection pooling.
So is this relevant anymore?

@tejainece
Copy link
Contributor

Pooling is moved to https://pub.dartlang.org/packages/conn_pool

@hoylen
Copy link
Author

hoylen commented Feb 15, 2019

The sqljocky5 documentation doesn't mention it anywhere.

Also, the README for conn_pool only talks about PostgreSQL: how does it work with MySQL/MariaDB and sqljocky5? Need some more documentation on how it is used.

@tejainece
Copy link
Contributor

It is a database agnostic connection pool. One has to implement ConnectionManager for a specific database.

@tejainece
Copy link
Contributor

@hoylen
Copy link
Author

hoylen commented Feb 15, 2019

An exercise for the reader :-)

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

No branches or pull requests

2 participants