Skip to content
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

R starts twice when opening Rstudio #6907

Open
3 of 4 tasks
szimmer opened this issue May 18, 2020 · 31 comments
Open
3 of 4 tasks

R starts twice when opening Rstudio #6907

szimmer opened this issue May 18, 2020 · 31 comments
Assignees
Milestone

Comments

@szimmer
Copy link

@szimmer szimmer commented May 18, 2020

System details

RStudio Edition : Desktop
RStudio Version : 1.2.5042 and 1.3.958
OS Version      :  Windows 10 (64 bit)
R Version       : 4.0.0

Steps to reproduce the problem

  1. Open Rstudio

Describe the problem in detail

R starts twice when opening Rstudio. I've tried re-installing Rstudio and installing a preview version. I always see the start-up text twice

R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.


R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

This doesn't happen when opening the standard RGui from CRAN.

Discussed on Rstudio community as well: https://community.rstudio.com/t/r-starts-twice-when-opening-rstudio/66535

Describe the behavior you expected

I expect to only see the start-up message for R once.

@jmcphers
Copy link
Member

@jmcphers jmcphers commented May 18, 2020

See #3439, #4085. We have occasional reports of this but have never been able to reliably reproduce in-house.

@jmcphers
Copy link
Member

@jmcphers jmcphers commented May 18, 2020

Also, for what it's worth, this isn't R starting twice but just the banner printing twice -- R is only starting once, so this is totally harmless!

@R-Hannibal R-Hannibal removed their assignment May 19, 2020
@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 20, 2020

I believe this should be fixed via 874cf92 (rstudio/rstudio-pro#1675 in Pro repository)

@tentacles-from-outer-space

I still have this issue. R-4.0.2 and RStudio Desktop 1.3.1073 on Win10. It happens on old rstudio projects (but not on new created ones).

If I close all open files then banner is duplicated rarely, when some files are open then duplicated always.

Event logs for "no files open" scenario looks the same (graph) regardless of whether banner is duplicated or not. But in details the third get_events call one return list with ids 11-12 vs 1-12 (duplicated from first get_events).

@R-Hannibal
Copy link

@R-Hannibal R-Hannibal commented Aug 18, 2020

@tentacles-from-outer-space - thanks for checking in and letting us know that this issue is still impacting you.

The ticket that @kevinushey mentioned as potentially fixing this issue (it has not been verified yet, but the thought is that it will fix it) is currently live in our daily build of the upcoming 1.4 release (available for download HERE). If you get the chance will you let us know if the issue is still present in that build?

@tentacles-from-outer-space
Copy link

@tentacles-from-outer-space tentacles-from-outer-space commented Aug 19, 2020

Well, on 1.4.722 still happens. For my old project definitely less often (like one out of ten? almost never), but seems like it loading faster. But I got another old project on a network share, which loads slower (reading times?) and duplicate banner every time.

I got event logs (help->diagnostic->request log), but they are hard to anonymize, so I prefer to share it via private message (in case I missed something).

@stale
Copy link

@stale stale bot commented Feb 5, 2021

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.

@stale stale bot added the stale Issues which have been closed automatically due to inactivitiy. label Feb 5, 2021
@jmcphers
Copy link
Member

@jmcphers jmcphers commented Feb 10, 2021

Closing since we can't reproduce this and don't have any other leads.

@tentacles-from-outer-space

I checked this with newest version (1.4.1103) and it is still happening. I was able to reproduce it by makinnng project on network share (to slow down access time) and under heavy load (top cpu usage).
Not deterministic enough.

@helske
Copy link

@helske helske commented Feb 16, 2021

I noticed this for the first time today as well, with the version 1.4.1548. Happened multiple times after closing and starting Rstudio, and then it dissappeared.

@sclewis23
Copy link

@sclewis23 sclewis23 commented Jul 2, 2021

I'm also seeing this on RStudio server v 1.4.1106-5, only with R versions 4.0.0 and above. If I open a session with R version 3.6.3 no issue. Also notice loading wheels in the Environment and Files panes when second R banner is waiting to be loaded.
In the diagnostic logs, i'm noticing client_init is being called twice in the R4.0.2 vs R3.6.3 only once.

@kevinushey kevinushey reopened this Jul 15, 2021
@stale stale bot removed the stale Issues which have been closed automatically due to inactivitiy. label Jul 15, 2021
@kevinushey kevinushey added this to the Ghost Orchid (Q3 2021) milestone Jul 15, 2021
@kevinushey kevinushey self-assigned this Jul 15, 2021
@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Jul 15, 2021

Also reported in Pro ticket #63358.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Jul 15, 2021

It seems like this happens when:

  1. We receive an initial get_events RPC response, containing the R banner as output;
  2. A subsequent get_events RPC call gets canceled for some reason;
  3. The following get_events RPC then re-requests the last set of events, and so any associated console output is then duplicated.

The underlying question, I think, is why that subsequent get_events RPC is being canceled.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Jul 16, 2021

I have some hints as to why this is happening, at least on master. Basically, the "ep" field on async_completion RPCs is not sent. If the most recent RPC happens to be an async completion RPC, then this will trigger a restart of the get_events stream.

If this happens during startup, this will imply the initial set of events via get_events will be re-retrieved and replayed, leading to the console banner being duplicated.

The solution, I think, is to mark "ep" = "false" on async completions here:

json::Object value;
value["handle"] = asyncHandle;
value["response"] = jsonRpcResponse.getRawResponse();
ClientEvent evt(client_events::kAsyncCompletion, value);
module_context::enqueClientEvent(evt);

And here:

json::Object value;
value["handle"] = asyncHandle;
value["response"] = response.getRawResponse();
ClientEvent evt(client_events::kAsyncCompletion, value);
enqueClientEvent(evt);

I think now that we're using async RPCs by default, this is going to be a lot more common with 1.5 in high-latency environments, so I think it's worth fixing for 1.5.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Jul 16, 2021

For posterity, an example where we get a seemingly spurious cancellation of get_events:

Screen Shot 2021-07-15 at 5 22 09 PM

@sjackson1997
Copy link

@sjackson1997 sjackson1997 commented Jul 30, 2021

I currently have the "banner" showing up three times when I open RStudio, and I came here seeking answers. I'm running RStudio 1.4.1717 on Windows 10 64-bit, with R 4.1.0 "Camp Pontanezen". I've noticed the banner sometimes repeats just once or not at all. Since previous posters indicate this isn't a real problem, I feel better -- just need the reassurance nothing is wrong.

image

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Jul 30, 2021

@sjackson1997, would you be willing to test the latest daily builds to see if the issue is resolved there?

@sjackson1997
Copy link

@sjackson1997 sjackson1997 commented Jul 30, 2021

@kevinushey Sure, I'll give it a shot. I do real work on this machine, so hopefully I can keep current version installed in parallel (?). Sorry for the newb question. I just usually avoid daily builds, but I want to help and contribute, so I'm willing to try.

@ronblum
Copy link
Contributor

@ronblum ronblum commented Aug 2, 2021

@sjackson1997 That's a valid concern! You can get an installer-less build at https://dailies.rstudio.com/rstudio/oss/windows/xcopy/ which when unzipped contains a copy of RStudio Desktop which you can use for testing, without installing over your current version of RStudio.

If you want to be extra safe, you can create a backup of your current state using the directories listed in https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-Desktop-s-State . (The instructions are for resetting your current state, but it includes the relevant directories to back up.)

@sjackson1997
Copy link

@sjackson1997 sjackson1997 commented Aug 10, 2021

So far, when I've run a daily build, I've not see the issue repeated using the same computer as my "stable" build which has the issue. I haven't run it much, though, because I'm usually doing regular work.

@ronblum
Copy link
Contributor

@ronblum ronblum commented Aug 12, 2021

@sjackson1997 That's good to hear! I'll mark this issue as closed, then. If you run into any more issues, please let us know.

@ronblum ronblum closed this as completed Aug 12, 2021
@ronblum ronblum removed the test label Aug 12, 2021
@tentacles-from-outer-space

I still run into this issue

image

@tentacles-from-outer-space

And on server pro
image

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Dec 2, 2021

@tentacles-from-outer-space -- the next time the issue occurs, can you please use Help -> Diagnostics -> Request Log and send a screenshot of the output you see? My expectation is you'll see something similar to #6907 (comment).

@tentacles-from-outer-space
Copy link

@tentacles-from-outer-space tentacles-from-outer-space commented Dec 7, 2021

On R-4.0.5 and

RStudio 2021.09.0+351.pro6 "Ghost Orchid" Release (50423e45af21f7b8d57c1937d66cceade58de01a, 2021-09-23) for CentOS 7
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

image

I cannot test on this server but on another I didn't seen it with R-4.1.2

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Dec 7, 2021

@tentacles-from-outer-space, thank you -- this is helpful. It looks like, for some reason, the client_init event is being sent twice, even though (as far as I can see) the initial client_init event request was successfully sent.

There is also an (apparently spurious?) cancellation of the first get_events call which has been implicated in other incantations of this issue. We'll have to investigate further.

@tentacles-from-outer-space
Copy link

@tentacles-from-outer-space tentacles-from-outer-space commented Dec 8, 2021

And for newest environment.

RStudio 2021.09.1+372.pro1 "Ghost Orchid" Release (8d64c2e021020e42f0637b056ee9ee5375df9d0e, 2021-11-08) for CentOS 7
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

[edit]: i open new document before log request so I supposed it is messed up

image

image

log.txt

@BartJanvanRossum
Copy link

@BartJanvanRossum BartJanvanRossum commented Feb 28, 2022

For what it's worth. I had this issue for a long time (see #4085), but with the latest version of RStudio (RStudio 2022.02.0+443) it seems completely gone and only one banner is printed when opening a project.

@ronblum
Copy link
Contributor

@ronblum ronblum commented Feb 28, 2022

@BartJanvanRossum Thank you very much! This is good to know—I'm glad to hear that the problem is resolved, at least in your case.

@astayleraz
Copy link
Contributor

@astayleraz astayleraz commented May 25, 2022

I ran into this issue with rhel8 and version 2022.06.0-daily+437.pro2

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 25, 2022

A somewhat similar issue reported and fixed on the Pro repository: rstudio/rstudio-pro#1675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests