-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Pool<Sqlite> is broken in many ways #3080
Comments
SqlitePoolOptions::connect, connect_lazy, and connect_lazy_with also seem to be exhibiting strange behavior in that regardless of the combination of connection numbers some connections always drop requests. Ill take another look at the code and add their behavior to the example repo. Seeing as this is the case, it also means there's no documented way to guarantee that that all the connections start with the supplied |
You are initializing the pools on different runtime then using them. |
That's only the case for the statics. Commenting out the statics, their usages,a and the lazylock feature entirely does not change the behavior of the broken lazy and maxgtmin cases which remain broken despite being spawned on the main thread. Likewise, Initiating the working case in a static context with the same method currently used does not break it. |
sqlx SQLite is somewhat buggy, as seen by: launchbadge/sqlx#2099 Wrapping every query with a transaction is supposed to mitigate. Also, see launchbadge/sqlx#3080, which need to be made on the application using tower-sessions
I had a look at your repro. pool.set_connect_options(connection_options); There should be either a hard error, warning or similar for this. Could you update the title of this issue? |
I apologize for the vague title, but there are lots of overlapping issues here which necessitated it.
This seems to be partly comorbid with #2099, but there are new issues highlighted here so I made a new issue.
In essence, the majority of
PoolOptions
that a user will pass to aPool<Sqlite>
are nonfunctional and will cause runtime errors.connect_lazy
will also cause the same errors.Bug Description
In summary of the linked repository:
max_connections
!=min_connections
, calls toquery!()
will intermittently fail with the error "table not found".max_connections
==min_connections
, calls succeed as expectedmax_connections
== 1, calls will succeed whethermin_connections
== 0 or 1.max_connections
!=min_connections
does not alter the rate of successful queries unlessmax_connections
==min_connections
, in which case all calls are successfulPoolOptions
setsmax_connections
to 10, andmin_connections
to 0, and so is unusabe.connect_lazy
is always completely broken, no matter the combination of connection numbers; every call to a pool started with.connect_lazy()
will fail with table not found error.Minimal Reproduction
https://github.com/Jeremiah-Griffin/slqite_pool_error_reproduction/tree/e47075e7db043891e87a9a27fcc3fc65bbc1c7d7/sqlx_bug_reproduce
Info
rustc --version
: stable 1.76 & 1.78 nightlyMitigations
PoolOptions
.Pool<Sqlite>
withconnect_lazy
. If a pool is needed in a sync context, spawn an OS thread, start an executor on it, and spawn the pool asynchronously. The thread may be killed thereafter.max_connections
> 1, ensuremin_connections
andmax_connections
are always equalAddenda
LazyLock
withlazy_static
yields no change in behavior, nor does switching to the stable compiler.The text was updated successfully, but these errors were encountered: