You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When saving or autosaving a file, if the save is kicked off, then the file is edited before the save completes, the system believes the file is saved (you can close the file with no warnings), however the latest edits are not saved.
This is quite a rare condition when saving normally, but I managed to reproduce easily in jupyterlab with autosave turned down.
This means that you could close a file, believing it is up to date, only to find that it has not been fully saved.
The impact should be quite low to users because:
You need to be editing a file during a save operation, then close the file without further edits
Unless copy/pasting, you should at most lose a few characters unless your system is under heavy CPU load
I also had a look at some other issues, and it may possibly be related to this: #6184
Reproduce
First identified in jupyter lab, however as per their bug report process, ended up reproducing it on jupyter notebook directly.
I managed to reproduce it in jupyter lab without imposing any artificial CPU load, however it's very hard to reproduce it without the load in jupyter notebook.
Dockerfile:
FROM python:3
RUN pip install jupyter
CMD ["jupyter", "notebook", "--ServerApp.allow_origin='*'", "--ServerApp.token=''", "--allow-root", "--ServerApp.ip=0.0.0.0", "--ServerApp.port=8888"]
Test.sh (executable):
#!/usr/bin/env bash
docker build . -tlabi
docker rm -f labc
docker run -d -p 8888:8888 --name labc labi
echo "Now:
- open http://localhost:8888/
- Create a new python file (add some content and save it)
- Now press enter to limit the CPU of this box to make the bug more visible...
"
read
docker update --cpus 0.01 labc
echo "
CPU limited.
Now:
- Type a string of characters into the file (e.g. 123456789). Hit Ctrl+S then quickly add a char or two more.
- Close the file (you should get no warning of unsaved data)
- Open the file <-- BUG: Content is not correct and missing some characters
NOTE: close file/open file can just be a reload of the page
"
Once you have the above files setup, you can just run ./test.sh
To reproduce in jupyterlab:
Dockerfile:
FROM python:3
RUN pip install jupyterlab
CMD ["jupyter", "lab", "--core-mode", "--ServerApp.allow_origin='*'", "--ServerApp.token=''", "--allow-root", "--ServerApp.ip=0.0.0.0", "--ServerApp.port=8888"]
test.sh;
#!/usr/bin/env bash
docker build . -tlabi
docker rm -f labc
docker run -d -p 8888:8888 --name labc labi
echo "Now:
- open http://localhost:8888/lab
- goto settings -> Settings Editor -> Document Manager
- Ensure Autosave is checked and interval is short (e.g. 3s)
- Open new python file
- Now press enter to limit the CPU of this box to make the bug more visible...
"
read
docker update --cpus 0.01 labc
echo "
CPU limited.
Now:
- Slowly type a string of characters into the python files (e.g. 123456789). Stop when autosave kicks in and the modified cirle disappears
- Close the file
- Open the file <-- BUG: Content is not correct and missing some characters
NOTE: You can get the same bug if you disable autosave, type the characters, then type Ctrl+S and some more characters until the save icon disappears.
"
Expected behavior
When saving a file, the state of the file at save time is known.
e.g.:
In the examples above, I should be warned about unmodified files before closing as the new content has not actually been saved.
Context
I've reproduced this in AWS sagemaker, but also locally on this setup:
Thanks
I've not dug into the codebases, and I'm probably quite ignorant to the whole jupyter architecture and repo structure, I just assumed lab was an abstraction over other repos including this one.
Jupyter_server would be where the actual save happens, but I assume this is a client/fronted issue.
If you think it should be raised in jupyterlab I can re-raise there and close this off.
Hi @BaukJ. Thank you for creating this issue. As discussed, it should be tracked in JupyterLab repo. I have already created a duplicate issue in JupyterLab repo, let's use it to continue the discussion and track this problem jupyterlab/jupyterlab#17365
Description
When saving or autosaving a file, if the save is kicked off, then the file is edited before the save completes, the system believes the file is saved (you can close the file with no warnings), however the latest edits are not saved.
This is quite a rare condition when saving normally, but I managed to reproduce easily in jupyterlab with autosave turned down.
This means that you could close a file, believing it is up to date, only to find that it has not been fully saved.
The impact should be quite low to users because:
While being a small bug, it could have big implications for things like: jupyterlab/jupyterlab#16892
I also had a look at some other issues, and it may possibly be related to this: #6184
Reproduce
First identified in jupyter lab, however as per their bug report process, ended up reproducing it on jupyter notebook directly.
I managed to reproduce it in jupyter lab without imposing any artificial CPU load, however it's very hard to reproduce it without the load in jupyter notebook.
Dockerfile:
Test.sh (executable):
Once you have the above files setup, you can just run
./test.sh
To reproduce in jupyterlab:
Dockerfile:
test.sh;
Expected behavior
When saving a file, the state of the file at save time is known.
e.g.:
In the examples above, I should be warned about unmodified files before closing as the new content has not actually been saved.
Context
I've reproduced this in AWS sagemaker, but also locally on this setup:
WIndows 11,
WSL,
Ubuntu 24.04
Docker 26.1.3
Jupyter notebook version: 7.3.2
Browser version: Chrome 133.0.6943.127
Troubleshoot Output
Command Line Output
The text was updated successfully, but these errors were encountered: