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

Viewing git history can throw an exception with new JGit #6592

Closed
neilcsmith-net opened this issue Oct 19, 2023 · 3 comments · Fixed by #6594
Closed

Viewing git history can throw an exception with new JGit #6592

neilcsmith-net opened this issue Oct 19, 2023 · 3 comments · Fixed by #6594
Labels
git [ci] enable versioning job kind:bug Bug report or fix
Milestone

Comments

@neilcsmith-net
Copy link
Member

neilcsmith-net commented Oct 19, 2023

Apache NetBeans version

Apache NetBeans 20 release candidate

What happened

Using show history on a larger git repository (eg. NetBeans' sources) throws an exception in JGit and just shows No Results Yet - Search in Progress.

WARNING [org.netbeans.libs.git.jgit.commands.LogCommand]: Out of available flags for branches: 236
SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.git.ui.history.SearchExecutor
java.lang.IllegalArgumentException: 24 flags already created.
	at org.eclipse.jgit.revwalk.RevWalk.allocFlag(RevWalk.java:1360)
	at org.eclipse.jgit.revwalk.RevWalk.newFlag(RevWalk.java:1354)
	at org.netbeans.libs.git.jgit.commands.LogCommand.run(LogCommand.java:124)
	at org.netbeans.libs.git.jgit.commands.GitCommand$1.run(GitCommand.java:56)
	at org.netbeans.libs.git.jgit.commands.GitCommand$1.run(GitCommand.java:53)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
	at org.netbeans.libs.git.jgit.commands.GitCommand.execute(GitCommand.java:53)
	at org.netbeans.libs.git.GitClient.log(GitClient.java:981)
	at org.netbeans.modules.git.client.GitClient$39.call(GitClient.java:613)
	at org.netbeans.modules.git.client.GitClient$39.call(GitClient.java:609)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker$1$1.call(GitClient.java:933)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker$1.call(GitClient.java:956)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethodIntern(GitClient.java:968)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethod(GitClient.java:897)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethod(GitClient.java:875)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker.access$400(GitClient.java:869)
	at org.netbeans.modules.git.client.GitClient.log(GitClient.java:609)
	at org.netbeans.modules.git.ui.history.SearchExecutor.search(SearchExecutor.java:186)
	at org.netbeans.modules.git.ui.history.SearchExecutor.perform(SearchExecutor.java:167)
	at org.netbeans.modules.git.client.GitProgressSupport.performIntern(GitProgressSupport.java:92)
	at org.netbeans.modules.git.client.GitProgressSupport.run(GitProgressSupport.java:85)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1420)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2035)

How to reproduce

No response

Did this work correctly in an earlier version?

Apache NetBeans 19

Operating System

Ubuntu 22.04

JDK

JDK 21

@neilcsmith-net neilcsmith-net added kind:bug Bug report or fix needs:triage Requires attention from one of the committers git [ci] enable versioning job labels Oct 19, 2023
@neilcsmith-net neilcsmith-net added this to the NB20 milestone Oct 19, 2023
@mbien
Copy link
Member

mbien commented Oct 19, 2023

what happens if load all revisions is turned off in git history settings?

@neilcsmith-net
Copy link
Member Author

neilcsmith-net commented Oct 19, 2023

It is off. From the message is related to number of branches. And seems similar to the issue discussed at https://github.com/jenkinsci/git-client-plugin/blob/master/src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java#L2481 There do seem to be some places that limit the flags in LogCommand - need a closer look.

@mbien
Copy link
Member

mbien commented Oct 19, 2023

if markBranchFlags leaves one spare flag, run can use the spare and it seems to work.

diff --git a/ide/libs.git/src/org/netbeans/libs/git/jgit/commands/LogCommand.java b/ide/libs.git/src/org/netbeans/libs/git/jgit/commands/LogCommand.java
index cb9460b..ffef113 100644
--- a/ide/libs.git/src/org/netbeans/libs/git/jgit/commands/LogCommand.java
+++ b/ide/libs.git/src/org/netbeans/libs/git/jgit/commands/LogCommand.java
@@ -210,7 +210,7 @@
                     }
                 } else {
                     usedFlags.add(flagId);
-                    if (i < 25) {
+                    if (i < 24) {
                         i = i + 1;
                         RevFlag flag = walk.newFlag(flagId);
                         List<GitBranch> branches = new ArrayList<>(allBranches.size());

crisis averted?

@mbien mbien removed the needs:triage Requires attention from one of the committers label Oct 19, 2023
@mbien mbien linked a pull request Oct 19, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
git [ci] enable versioning job kind:bug Bug report or fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants