-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Metrics-scraper: SQLite usage is not thread safe #9452
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
Comments
We have meet this issue too,this issue is expected to be fixed. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
We have also meet this issue |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Uh oh!
There was an error while loading. Please reload this page.
What happened?
When metrics-scraper runs
UpdateDatabase()
orCullDatabase()
at the exact time a client is querying metrics it will receive adatabase is locked (5) (SQLITE_BUSY)
error and abort.This results in
UpdateDatabase()
orCullDatabase()
not closing the transaction correctly. Any future attempts to open a (new) transaction will result in aSQL logic error: cannot start a transaction within a transaction (1)
error.This effectively renders metrics-scraper unusable and results in kubernetes-dashboard only showing outdated metrics or not showing metrics at all.
What did you expect to happen?
Expected it to handle multiple concurrent queries correctly.
How can we reproduce it (as minimally and precisely as possible)?
git clone https://github.com/codesenberg/bombardier.git cd bombardier go build ./bombardier -c 1 -d 5s http://localhost:8000/api/v1/dashboard/namespaces/[path to some metric that actually exists]
Anything else we need to know?
A good solution would be to update
database.go
to close transactions correctly in case of errors.A great solution would be to also make SQLite thread safe as describe in mattn/go-sqlite3 #209. This would allow clients to query metrics while
UpdateDatabase()
orCullDatabase()
are active.Until this bug is fixed a possible workaround is to use the
--db-file
parameter to get SQLite to use a shared cache. This can be done using the helmfile'svalues.yaml
:What browsers are you seeing the problem on?
Chrome, Safari, Microsoft Edge, Firefox, Others
Kubernetes Dashboard version
7.5.0
Kubernetes version
v1.30.3
Dev environment
$ go version
go version go1.22.6 linux/amd64
$ node --version
v22.4.1
The text was updated successfully, but these errors were encountered: