Bug 574806 - Auto-Refresh after Git Actions (Switch branch, pull, ...) is missing
Summary: Auto-Refresh after Git Actions (Switch branch, pull, ...) is missing
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 5.12   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 5.13   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 575615 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-07-12 12:32 EDT by Ingo Mohr CLA
Modified: 2021-08-26 04:45 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Mohr CLA 2021-07-12 12:32:01 EDT
Hi folks,

I have a problem w/ missing refreshes in the UI of EGit 5.12 (2021-06).

When I switch a branch or pull a branch (other actions, too), the Git UI (Repositories view, staging view, I didn't check the others) won't refresh itself.

Workaround: On the Staging View click the "Refresh" button in the view's toolbar.

Git Preferences:
- Automatic refresh:
  - Refresh interval (s): 300*
  - Refresh only when workbench is active: true (checked)

* It doesn't help when I change the value to 1.

My Eclipse is a fresh installation on a fresh workspace (i.e. folders created for exactly this Eclipse).

Do you have an idea what could be the cause?


Thank you for any hints/thoughs
Ingo
Comment 1 Andrey Loskutov CLA 2021-07-12 12:56:52 EDT
Any errors in the Eclipse Error log view?
Comment 2 Thomas Wolf CLA 2021-07-12 13:29:27 EDT
No idea. There was one previous mention of this that I saw at [1]. But I've never observed this myself.

[1] https://www.eclipse.org/forums/index.php/t/1108254/
Comment 3 Ingo Mohr CLA 2021-07-13 17:00:14 EDT
Hi Andrew and Thomas,

thank you for your hints and links.

I didn't find git-related entries in the log.
I cleaned the log and restarted Eclipse, and afterwards the refresh-problem is gone.

(which is not that satisfying in terms of reproducing the problem - since at least 2 collegues of mine also have the problem).

The problem in the forum is, if I've seen it correcty, also part of the refresh problem: nothing got updated (for any Git-operation) - unless I've clicked the "Refresh" button on the Staging View.

If it's fine w/ you, I'd like to keep this issue open to add more information once I 've got more.
Comment 4 Thomas Wolf CLA 2021-07-13 17:52:31 EDT
(In reply to Ingo Mohr from comment #3)
> I cleaned the log and restarted Eclipse, and afterwards the refresh-problem
> is gone.

Same as in the instance reported in the forum. Without a reproducible scenario there's not much we could do :-(.
Comment 5 Ingo Mohr CLA 2021-07-14 05:11:24 EDT
tl;dr: I think, I go for "Can't reproduce" or "no caused by EGit" resp.

Here's what I did:

I executed following scenario w/ 2021-06 and EGit 5.12.0.202106070339 for different configs.

Scenario:
S1. Download Eclipse via Oomph wizard
S2. Open Git Repositories view
S3. Open Git Staging view and tell it to use column layout
S4. Open Git History view
S5. Import existing Git repo
S6. Switch branch to existing other branch
S7. Check whether Git Repositories view is updated

Configs:
C1. Our own Oomph wizard config (to setup a 2021-06 plus additional features we typically use) plus repo-import => can reproduce => restart => cannot reproduce
C2. Same as C1. but w/o repo import => same
C3: Default Eclipse Oomph wizard, installing Java IDE => cannot repdroduce at all.
C4: Executed for C2 again => cannot reproduce
C5: Executed for C1 again => cannot reproduce

So, no I think it maybe has to do with a glitch in my cached Oomph config on my machine. It's just a thought, but apparently the problem is not caused by EGit 5.12.
Comment 6 Andrey Loskutov CLA 2021-07-14 05:30:04 EDT
I see it now too, latest nightly build of EGit.
I'm playing with bug 574771 reproducer.
I've just created repo, added extracted SDK content to it, commit.
Copied next nightly build over the first one.
In Staging view, "add all". 
Nothing (visible to user) happens, no jobs in the progress view (no system too).
"Refresh" in Staging view => all files are staged as expected.
Comment 7 Andrey Loskutov CLA 2021-07-14 06:02:31 EDT
(In reply to Andrey Loskutov from comment #6)
> I see it now too, latest nightly build of EGit.
> I'm playing with bug 574771 reproducer.
> I've just created repo, added extracted SDK content to it, commit.
> Copied next nightly build over the first one.
> In Staging view, "add all". 
> Nothing (visible to user) happens, no jobs in the progress view (no system
> too).
> "Refresh" in Staging view => all files are staged as expected.

*Probably* part of the problem could be: this is a project *without builders*, not a Java project, not CDT, no Xtext, nada, just plain project. Staging view doesn't react anymore there, independently what I do. Only manual Refresh helps.

Interestingly, the same case with a small project works fine.

What is crazy: exact same repository works fine in another workspace or if I start Eclipse in debugger. So there must be some egit/jgit or other setting that forces this behavior.
Comment 8 Eclipse Genie CLA 2021-07-14 09:43:06 EDT
New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/183058
Comment 9 Thomas Wolf CLA 2021-07-14 10:13:25 EDT
(In reply to Eclipse Genie from comment #8)
> New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/183058

Wild guess: I suspect this could be caused by the move to initialize EGit via OSGi declarative services. That made start-up (potentially) multi-threaded. There is a strange dependency between RepositoryCache and IndexDiffCache, and the initialization of the singletons isn't thread safe.

The above change uses thread-safe singletons implemented as enums. If you have a reproducible case and the problem vanishes if you use the EGit from [1], then most likely some singleton wasn't actually a singleton. (Download the repo[1] as zip, then install locally from that archive (or from that archive unpacked).)

[1] https://ci.eclipse.org/egit/job/egit.gerrit/2143/artifact/org.eclipse.egit.repository/target/repository/
Comment 10 Thomas Wolf CLA 2021-07-14 10:53:25 EDT
Andrey, I don't think bug 542597 is related. That change is in EGit nightly only, but people report this against EGit 5.12.
Comment 11 Andrey Loskutov CLA 2021-07-14 11:21:04 EDT
(In reply to Thomas Wolf from comment #9)
> (In reply to Eclipse Genie from comment #8)
> > New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/183058
> 
> Wild guess: I suspect this could be caused by the move to initialize EGit
> via OSGi declarative services. That made start-up (potentially)
> multi-threaded. There is a strange dependency between RepositoryCache and
> IndexDiffCache, and the initialization of the singletons isn't thread safe.

After restart I can't reproduce the problem anymore with same repository/installation. Also tried that with the patch above, everything seem to be OK.

Nevertheless, the patch could explain why that is hard to reproduce, if it is a timing issue.

(In reply to Thomas Wolf from comment #10)
> Andrey, I don't think bug 542597 is related. That change is in EGit nightly
> only, but people report this against EGit 5.12.

I just wondered if bug 542597 itself is the manifestation of the same issue here, not the patch.
Comment 13 Thomas Wolf CLA 2021-08-20 04:35:39 EDT
Most likely the same issue as in Oomph bug 575240.
Comment 15 Thomas Wolf CLA 2021-08-24 07:15:27 EDT
I'm tentatively closing this. The one reproducible case that I saw in Oomph bug 575240 is fixed by this. Feel free to re-open it re-occurs with EGit 5.13 (or with an Oomph using EGit 5.13).

Note that currently Oomph still uses EGit 5.12. So true checking whether it still can be made to re-occur can be done only once 5.13 and Eclipse 2021-09 are released.
Comment 16 Thomas Wolf CLA 2021-08-25 04:43:22 EDT
*** Bug 575615 has been marked as a duplicate of this bug. ***
Comment 17 Lars Vogel CLA 2021-08-25 05:03:28 EDT
(In reply to Thomas Wolf from comment #16)
> *** Bug 575615 has been marked as a duplicate of this bug. ***

Looks good in with Egit nightly for me.
Comment 18 Ingo Mohr CLA 2021-08-26 04:45:43 EDT
Hi folks,

Thanks a lot for the fix! Looking forward to the next release. :)