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

esqlite return "error = 21" #87

Closed
Zabrane opened this issue Nov 30, 2023 · 4 comments
Closed

esqlite return "error = 21" #87

Zabrane opened this issue Nov 30, 2023 · 4 comments

Comments

@Zabrane
Copy link

Zabrane commented Nov 30, 2023

Hi @mmzeeman

We switched to the latest esqlite version yesterday (we were previously using 0.8.6 for years) and we started getting the following error:
esqlite_error_21

This happens sporadically and under almost no load (not even during concurrent writes).
Do you have any idea what can lead to this?
Many thanks

. Erlang 26.1.2
. rebar 3.22.0 on Erlang/OTP 26 Erts 14.0.2
. OS: macOS Sonoma | Ubuntu 22.04 LTS
@mmzeeman
Copy link
Owner

Could it be SQLITE_MISUSE?

#define SQLITE_MISUSE      21   /* Library used incorrectly */

That can happen when a connection is shared between multiple processes/threads. Or that a query was already done or errored earlier.

Before 0.8 every connection had its own associated os level thread. It looks like you were already using the never version which uses dirty schedulers.

The later releases have been small fixes, and sqlite version updates.

@mmzeeman
Copy link
Owner

With version > 0.8 you must be really sure to serialize requests to SQLite. The plus side is that connections are now much more light weight.

@Zabrane
Copy link
Author

Zabrane commented Nov 30, 2023

@mmzeeman thanks a lot, that was it. The new version is much faster and the process who opens the DB originally closes it earlier than before.
Keep up the work ;-)

@Zabrane Zabrane closed this as completed Nov 30, 2023
@mmzeeman
Copy link
Owner

👍

Thanks for your reply... It is always nice to hear from people using this library.

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