-
Notifications
You must be signed in to change notification settings - Fork 151
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
sqlite3.OperationalError: database is locked #52
Comments
Is home on NFS? We've seen some issues with sqlite and NFS. Moving the |
Yeah, home is on NFS. I renamed the file to It seems like |
|
I now have lines that look like
in my JupyterHub config but I'm still getting the same error in the logs. This is pretty puzzling to me since it seems like the issue is happening on db initialization. Any pointers? |
That needs to be configured for the individual notebook servers, not the hub. |
Works! Thanks @takluyver . Do we know more about this other than "NFS causes problems"? |
The SQLite FAQ says:
I don't know any more than that. |
Okay, thanks for the info. I'll close this issue, try to work around it, and wait for the changes in 4.2. |
@takluyver Can you elaborate on how to do this please? |
Another option is to clear the notebook output: https://gist.github.com/damianavila/5305869 |
Hi, where to set this configure? Can you tell me, thanks? |
Facing the same issue. @SamLau95 @takluyver can you please elaborate how to set this configuration option? |
I figured out how to do it:
Hope this help... Here the references that helped me figure out how to do it: |
The SQLite database should not be used on NFS. SQLite uses reader/writer locks to control access to the database. This locking mechanism might not work correctly if the database file is kept on an NFS filesystem. This is because fcntl() file locking is broken on many NFS implementations. Therefore, you should avoid putting SQLite database files on NFS since it will not handle well multiple processes which might try to access the file at the same time. so ideally we should use PostgreSQL for production. But can anyone help me how to change backend database in configuration for jupyterhub? |
This issue has been mentioned on Jupyter Community Forum. There might be relevant details there: |
Actually I found a workaround for this issue. The issue is caused by the sqlite db is not compatible with NFS drive. One way is to replace the database from sqlite to postgre for the singleuser notebook but I haven't figured it out how to do that (btw, you can point the hub database to postgres, which is suggested by the official doc, by adding to hub.db.type and hub.db.url.). The other way, which is the workaround I am using, is to relocate the nbsignature.db file to your k8s cluster local disk. This can be done by modifying the configuration files inside of the jhub image. The below are the steps for this.
Note: By default, in the deployment.yaml in the helm package, only the files under /home and /share directories are stored via PVC, which is NFS in my case. Whatever files beyond this scope will be stored in the local disk during the lifetime of the pod. For this signature db file, given the size is relatively small and the nature that it is only for the duration of a single session, I think it should be fine to just store it in the local disk, instead of the postgres database. Hopefully it will be helpful for anyone has the same issue as me. Reference: |
I've deployed a JupyterHub instance and I'm running into a
sqlite3.OperationalError: database is locked
fromnbformat/sign.py
whenever I try to open a notebook. I can open theuser/samlau95/tree
URL, but clicking a notebook or trying to create a new notebook hangs for ~45 seconds until it fails with a 504 Gateway error.Later, the container running the notebook server will output:
I can verify that the database is locked:
And that the process is the notebook server:
This is running on Ubuntu 16.04 using the setup in https://github.com/data-8/jupyterhub-deploy which has been successfully deployed multiple times. This is the first time I'm deploying this on Ubuntu 16.04 (we've used 14.04 before) so perhaps this is related?
Here are the versions of packages installed:
Any pointers on why this might be breaking? Happy to give more info.
The text was updated successfully, but these errors were encountered: