-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
When opening a project, ghost instances of unsaved files are opened #12565
Comments
Thanks for the bug report! Unfortunately, without a reproducible example it's unlikely we'll be able to make progress here -- can you please share if you're able to divine a set of reproducible steps? |
I completely understand. Let me at least share a visual of what is going on. As you can see I closed all instances of Untitled1, then at around 40 seconds I closed and reopened the project and they were back there again. Somehow the project seems corrupted. Even if I can just manually stop the reopening of these files I would already be helped a lot, even if it is with some workaround. With the situation as it is now, the project becomes more or less unusable. 2023-01-31_8-43-42.mp4 |
I ended up throwing away the .Ruser.proj folder which of course fixes the issue. Since this will probably impossible to replicate I will just close it |
@BartJanvanRossum I'm glad to hear that clearing out the folder resolved the problem in this case. If you run into the issue again, though, please let us know! |
This also happened to me. I'm not sure what triggered it, I just noticed a few days ago that most my RStudio tabs were duplicates of unsaved tabs, with behaviour exactly as described above. Closed them all manually but they reappeared on RStudio restart, even after I had unchecked 'Restore previously open source documents at startup' and 'Restore RData at startup' and restarted RStudio again.. After finding this issue thread and scratching my head about which file I should remove (I wasn't in an R project..), I seem to have solved it for now, but the only additional actions I took were to Clear Project List on the dropdown menu and quit/reopen RStudio several times... I'm on Mac OS 13.2.1, RStudio 2022.12.0+353. |
@ec363 Thanks for bringing this to our attention! I'll reopen the issue. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions. |
This issue has been automatically closed due to inactivity. |
Hey folks, I think I may have finally gotten to the bottom of this after years of just dealing with it... Essentially, the issue is related to the .Rproj.user folder. If you delete that (I was a bit scared to at first but it appears to be safe to do so...https://stackoverflow.com/questions/57790236/what-is-rproj-user-and-can-i-safely-delete-it), then all your problems will be solved, I think. Or at least they were for me! In terms of why this works, I'm not 100% but I have two, potentially interacting, theories:
I still don't fully hand how it's all (not) working and it may be something approximating one of the theories, both of them, or neither. What might help us get closer to an answer is is @BartJanvanRossum and @ec363 could confirm:
Anyways, we have a workaround but would be great to get a permanent fix for this tricky, hard to reproduce issue! Cheers P.S. Thanks to @nirgrahamuk on Posit Community for pointing me to this thread when I re-raised the issue here https://community.rstudio.com/t/opening-rproject-opens-old-scripts-including-previously-discarded-ones/179687/2 |
Thanks for diving further into this. Answering your questions
For me this is not happening anymore for projects created in recent versions of RStudio, i.e. in versions starting from the one I mentioned in the original post. It happened (and still sometimes happens) in projects that were created in an earlier version and then opened in the latest version of RStudio. The ghost files for me don't seem to be random files. The files that I hadn't saved yet when closing the project are the files that are duplicated. One extra instance of each of these files is added when reopening the project. |
Hi Bart Thanks for getting back to me so quickly. I was already having second thoughts about theory 2 to be honest - so maybe it's nothing to do OneDrives, Dropbox etc. Though the discrepency with the randomness of files is odd. I would say that mine does alightly prefer recent files but often opens up some random ones too. Often files opened are unsaved ones and there are duplicate versions of the same file, causing RStudio to prompt me to 'reload the file from disk'. In terms of what version of RStudio I'm running, it's: RStudio 2023.06.1+524 "Mountain Hydrangea" Release (547dcf8, 2023-07-07) for windows But as you imply, it may be more about what version of RStudio was used to create the project (and hence .Rproj.user folder), than what version of RStudio you are currently running. Perhaps it is resurrecting an old bug in RStudio that has since been fixed. Either way, it's all very occult. Cheers |
Hey guys, I was having the same problem, so I tried to find a directory who stores the RStudio Session. In my case was the following one: Regards |
Hey @mezaronald, Great to have your contribution to this too! Not only does it help reassure me that this hard-to-reproduce issue is real and it's not just me going mad, but it hopefully all of our pieces of information provide enough evidence for the RStudio devs to figure out what's actually going on here! I also have this folder with the same file path structure. It seems to be a temporary folder storing information on the files currently open in RStudio (when I closed one of my RStudio sessions, the folder disappeared). So perhaps there is some interaction between the .Rproj.user folder and the 'session-[alphanumerics]' one which is causing this issue, and deleting one severs the link, solving the problem? I assume that 'session-[alphanumerics]' is created temporarily for projects which you are saving history for, and then the contents gets transferred to .Rproj.user or something? @ronblum would be great if you could give some additional clarity on this please, so that perhaps this can be resolved internally within RStudio, instead of with our workarounds (which may have some risks associatd with them)? Anyways, great to get people talking on this sticky issue, feel like we're making progress together! 🕵️ Cheers |
Hi all, My answers are the same as @BartJanvanRossum 's. Additionally, I too am no longer afflicted with this strange issue, and my memory of it also was the ghost files were duplicates of unsaved files. My only addition would be that I work a lot outside the context of an active Rproject, and I'm certain this issue flared up in one of those sessions. Not sure if this helps! Eszter |
Re-opening for further investigation. |
I regret to report that the problem has resurfaced. Implemented the workaround of deleting the .Rproj.user folder again successfully (@mezaronald's solution didn't work for me - the said folder wasn't even there this time despite having the project open). This time the ghost files were not unsaved files but some saved files I previously had open in the project (despite my settings being set to not re-open/save history). Possibly triggered by opening the same project in two different RStudio sessions, but not sure. Good to see @kevinushey has opened it for reinvestigation though. |
To check once more -- has anyone found a way to reliably reproduce this issue? |
Hi Kevin, No, I haven't been able to create a reproducible example yet unfortunately. Very hard to reproduce and I can't share the project it's affecting because it's confidential. I have a test project that I'll try to bash enough to reproduce the issue and share if I manage it, but no promises sorry. Cheers |
Thanks -- if you're able to reproduce successfully in a project you're able to share, it would be very helpful if you could e-mail me the (zipped or tarred) contents of your |
Same issue here...the Untitled panes resurface even after I closed all of them without saving. MachineMBR Apple M1 Max RStudioRStudio 2023.12.1+402 "Ocean Storm" Release (4da5832, 2024-01-29) for macOS |
Yeah...in some cases I am now getting it even without an RProject open (even with Global Options set not to reopen old files). Though the problem seems worse/more frequent with projects. Still unable to get a reproducible example for you together though, i'm afraid sorry |
Also having the same issue here on Windows, also resolved by deleting the .Rproj.user/ directory. However, in my case it only happens after RStudio crashes. Will try to provide reproducible example when this happens again. |
@balthasars thanks -- but even if I simulate a crash for RStudio with something like:
as invoked from a Command Prompt, I still don't see the ghost tabs. Can you provide any other details; for example, when the crashes are occurring and why? |
Hi Kevin Short of being able to produce a reproducible example, is there a way I can send you some traceback source code showing what RStudio is doing in the background when this happens or something? That might be more achievable. cheers |
@kevinushey |
Thanks -- I'm also curious if it might also depend on what R packages if you loaded in the session, or what kind of data / objects you're using in the session. What packages are you using most commonly? |
So the output of
It's a messy legacy environment where many libraries are loaded using |
Posting my session info in case helpful to find similarities. Maybe others in thread can do same?
|
I think I now got a project that consistently doubles the amount of unsaved files every time it is opened. |
That would be perfect -- thanks! |
This should be it. Link is valid until May 20. |
Thanks! I'm still not able to reproduce using that project, though. When I open the project, I see three untitled documents (Untitled1, Untitled2, Untitled3), each with different contents. However, closing and re-opening the project doesn't trigger any new Untitled documents to be opened. Am I missing any steps? |
No, those are exactly the steps I use to reproduce the problem. If I open the project I get two instances of the three untitled documents, if I then close and reopen I get three instances. I can remove the ghost instances, but then closing and reopening RStudio brings them back again. One thing I did notice this morning was that after upgrading to R4.4 and then upgrading RStudio to a Chocolate Cosmos daily build because of issues related to #14590, the ghost instances didn't appear anymore. Because of the unpredictable nature of this issue I don't think it is a guarantee that it is actually fixed, but my hopes are up (a bit). |
@BartJanvanRossum Fingers crossed that this truly resolves the issue! Also, did you grab build 2024.04.0+735? If not, I would switch to it, since that's the supported build that was just released. |
Somehow I missed the released build. I got 2024.04.0+737. Probably very similar so for now I will stick with this one. |
System details
Steps to reproduce the problem
I cannot reproduce this consistently, it seems to happen for some of my projects, but I don't seem a common factor for these projects. If it happens for a project though, it happens consistently
Start an existing project with that contains an unsaved (Untitled1*) file.
Describe the problem in detail
There are 4 Untitled1* tabs in the source panel. Three of these are 'ghost' tabs. Clicking on them will open the first tab. However these ghost tabs cannot be closed.
Describe the behavior you expected
The Untitled1* file opened once
The text was updated successfully, but these errors were encountered: