question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autosaves are created for unmodified files and not removed on close with split Editor panes

See original GitHub issue

Problem Description

I can confirm that with the latest master, I’m still getting the Recover from autosave for files that were either saved or never unmodified when I closed Spyder (via the normal close button), with a clean autosave directory and not other Spyders open before or currently. All the files I have open have autosaves created 1 minute after startup even if I’ve never touched Spyder, and they don’t get removed when I close Spyder again. This happens consistently, every time with every file I either have open on startup or open subsequently, regardless of whether I view, modify, etc. it.

I finally reproduced it starting from a clean --safe-mode Spyder instance by opening a two-pane layout (“horizontal split”) and a few files and waiting 1 minute; it seems to be the two pane layout that triggers it, as it does not happen with only one pane open. I’ve tested enabling/disabling code style, docstring style analysis, projects, and more, and none of them have an effect on whether it happens or not, just the two pane layout.

I also thought they should be removed by spyder-ide/spyder#8733 anyway, but apparently that handles it by merely removing the autosave when the “Don’t save” button on the “Unsaved changes” dialog when closing the file is clicked, rather than when the file is actually closed (e.g. by the user, closing Spyder, switching projects, etc), and thus was not robust against any bugs (like that one) that might result in an autosave file being created for a reason other than an actual modification.

What steps reproduce the problem?

  1. Open a clean copy of Spyder master
  2. Select “Split panes horizontally”
  3. Open a file
  4. Wait 60 seconds

Versions

  • Spyder version: master as of post time (c90e2aea)
  • Python version: 3.7.2
  • Qt version: 5.9.7
  • PyQt version: 5.9.2
  • Operating System name/version: Windows 8.1 x64

Dependencies

pygments >=2.0    :  2.3.1 (OK)
qdarkstyle >=2.6.4:  2.6.5 (OK)
sphinx >=0.6.6    :  1.8.4 (OK)
pyls >=0.19.0     :  0.21.5 (OK)
nbconvert >=4.0   :  5.4.0 (OK)
pandas >=0.13.1   :  0.24.2 (OK)
numpy >=1.7       :  1.15.4 (OK)
sympy >=0.7.3     :  1.3 (OK)
cython >=0.21     :  0.29.4 (OK)
qtconsole >=4.2.0 :  4.4.3 (OK)
IPython >=4.0     :  7.2.0 (OK)
matplotlib >=2.0.0:  3.0.2 (OK)
pylint >=0.25     :  2.2.2 (OK)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
jitseniesencommented, May 20, 2019

One bug is that when cloning an editor (e.g. because it appears in multiple panes), .set_as_clone() calls .setDocument() here. This emits the textChanged signal which eventually leads to an autosave.

Another issue is that the autosave name mapping is stored on the EditorStack level and thus not synchronized between the different panes.

I have some ideas on how to fix this; I need to try out some things but I expect to have a PR ready this week.

0reactions
CAM-Gerlachcommented, May 20, 2019

Fantastic @jitseniesen ! Looks like the former issue is the ultimate culprit, while the latter made the problem more difficult to detect and fix in PR #9327 (otherwise it would have been basically a one-line fix).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mitigate Spyder wiping users' files with more robust atomic ...
Yes, we should certainly implement that as well, but it doesn't cover the window where the file is saved after Spyder has deleted...
Read more >
Auto-saving files upon changes with Visual Studio Code
You can go to menu File and choose Auto Save. Enter image description here.
Read more >
Save a copy before editing to prevent changing the original file
Tip: Did you make unwanted changes before saving a copy? No worries! You can go back to the original file, select the document...
Read more >
Chapter 4. Using Buffers, Windows, and Frames - O'Reilly
Here we'll discuss creating horizontal windows, finding a file in a new window, and deleting windows. Creating Horizontal Windows. The most commonly used...
Read more >
Trimming clips in Adobe Premiere Pro
Discover the ease of editing clips in Premiere Pro: how you can quickly set In and Out points, trim clips in the Timeline,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found