Bug 578687 - delete branch is blocked by pull but can not be canceled [freeze]
Summary: delete branch is blocked by pull but can not be canceled [freeze]
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 6.0   Edit
Hardware: PC Windows 10
: P3 minor (vote)
Target Milestone: 6.1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-11 03:13 EST by Jörg Kubitz CLA
Modified: 2022-02-14 12:49 EST (History)
3 users (show)

See Also:


Attachments
Screenshot.png (5.72 KB, image/png)
2022-02-11 03:13 EST, Jörg Kubitz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Kubitz CLA 2022-02-11 03:13:54 EST
Created attachment 288026 [details]
Screenshot.png

When pulling a repository and while waiting trying to delete a branch in another repository the operation blocks, shows a modal "cancel" button, but it's deactivated. => ui freeze until pull completed.


stacktrace:
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.swt.internal.win32.OS.WaitMessage(Native Method)
        at org.eclipse.swt.widgets.Display.sleep(Display.java:4746)
        at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:167)
        at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:368)
        at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:468)
        at org.eclipse.egit.ui.internal.repository.tree.command.DeleteBranchCommand.execute(DeleteBranchCommand.java:62)
Comment 1 Thomas Wolf CLA 2022-02-12 09:16:03 EST
Seemed like an easy thing to fix, but of course nothing is ever simple.

TBH, just fixing this non-cancellable dialog _is_ simple. But the blocking comes from the fact that the branch deletion operations runs with the workspace lock.

Which brings me back to bug 497511: *why* does branch deletion in the repo view run with the workspace lock at all?

Pulling rightly uses a scheduling rule encompassing the projects in the Eclipse workspace from the repository being pulled. After all it is going to modify the workspace.

But branch deletion is purely a repository operation.

Soo... why does this use a scheduling rule? If it is an attempt to synchronize concurrent operations on the same repository, then it doesn't work:

1. one may have a repository in the Git Repositories view of which no projects
   are imported in the Eclipse workspace. On such a repo, I can pull and
   concurrently delete branches.
2. The branch deletion in the history view does not use any scheduling rule,
   so it would allow deleting branches while a pull was in progress.

Either deleting branches never needs to use a scheduling rule, or the history view should also use one. And if the scheduling rule is indeed an attempt to synchronize repository operations, then this whole scheduling rule business would need to b re-thought anyway (globally, throughout EGit) so that it also works for repositories without projects in Eclipse.
Comment 2 Eclipse Genie CLA 2022-02-12 10:06:48 EST
New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/190742
Comment 3 Thomas Wolf CLA 2022-02-12 10:09:25 EST
Actually, the underlying DeleteBranchOperation also uses a scheduling rule, so the *command* definitely doesn't need to use one. But the question remains: why use a workspace scheduling rule at all for branch deletions?
Comment 4 Jörg Kubitz CLA 2022-02-14 04:50:17 EST
(In reply to Thomas Wolf from comment #3)

Thomas, i like that you try to get the to the root of the issue. 
I would have already appreciated a working cancel button ;-)
Comment 5 Thomas Wolf CLA 2022-02-14 05:13:18 EST
(In reply to Jörg Kubitz from comment #4)
> (In reply to Thomas Wolf from comment #3)
> 
> Thomas, i like that you try to get the to the root of the issue. 
> I would have already appreciated a working cancel button ;-)

Which https://git.eclipse.org/r/c/egit/egit/+/190742 gives you. (But DeleteBranchOperation still uses a scheduling rule.)
Comment 7 Matthias Sohn CLA 2022-02-14 12:49:14 EST
(In reply to Thomas Wolf from comment #3)
> Actually, the underlying DeleteBranchOperation also uses a scheduling rule,
> so the *command* definitely doesn't need to use one. But the question
> remains: why use a workspace scheduling rule at all for branch deletions?

I agree deleting a branch (which is not the current branch) doesn't need a workspace scheduling rule since it does not affect the working tree at all.
I any locking is required on jgit level it should be implemented there.