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

java.lang.NoClassDefFoundError: org/eclipse/jgit/internal/JGitText #3489

Closed
rgrunber opened this issue Feb 8, 2024 · 13 comments
Closed

java.lang.NoClassDefFoundError: org/eclipse/jgit/internal/JGitText #3489

rgrunber opened this issue Feb 8, 2024 · 13 comments

Comments

@rgrunber
Copy link
Contributor

rgrunber commented Feb 8, 2024

I recently started seeing the following error in our Maven builds that use Tycho. There's not much info in the stacktrace and I couldn't find any references to JGitText in Tycho, so I thought it might have been a Jenkins plugin issue, but I see the error in GitHub Actions also. It doesn't appear to be harmful.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:09 min
[INFO] Finished at: 2024-01-30T08:06:00Z
[INFO] ------------------------------------------------------------------------
Error: Exception in thread "Thread-4" java.lang.NoClassDefFoundError: org/eclipse/jgit/internal/JGitText
	at org.eclipse.jgit.internal.util.ShutdownHook.cleanup(ShutdownHook.java:85)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jgit.internal.JGitText
	... 2 more

https://github.com/redhat-developer/vscode-java/actions/runs/7708013160

We run builds on every new change, and the first one from last week where this started happening was on the bump from 4.0.4 to 4.0.5.

I've seen it in JDT UI main builds : https://ci.eclipse.org/jdt/job/eclipse.jdt.ui-github/job/master/12/console

However, there's also similar builds of the same project on Jenkins where the issue doesn't occur : https://ci.eclipse.org/ls/job/jdt-ls-master/1956/console

@laeubi
Copy link
Member

laeubi commented Feb 8, 2024

@rgrunber this is due to jgit registering a shutdownhook but never unregister it, then when it is finally executed (maven build terminates) "something" went wrong but the text can't be loaded as the classloader is gone, so this is actually leaking.

i have already described it here in more details:

so unless there is a fix in JGit and a new release there is sadly nothing much we can do about it.

@rgrunber
Copy link
Contributor Author

rgrunber commented Feb 8, 2024

Thanks for the reference. Feel free to close unless you'd rather track it.

@mickaelistria
Copy link
Contributor

@laeubi is there an issue open to JGit about the root bug?

@laeubi
Copy link
Member

laeubi commented Mar 8, 2024

Not that I'm aware of, JGit wants me to fill a huge Issue template and last time I tried to contribute said they are not using Github for contributions so I kind of gave up on this. I really don't want this old Bugzilla/Gerrit "feeling" back ;-)

But if you like you can open one and then link it here.

@mickaelistria
Copy link
Contributor

I submitted eclipse-jgit/jgit#36 to JGit.
(@laeubi it was not that much of a big issue template, it wasn't taking much more time to fill it than to fill a freetext)

@laeubi
Copy link
Member

laeubi commented Mar 11, 2024

@mickaelistria
Copy link
Contributor

jgit now just fails earlier

It's probably even worse ;)
Can we consider adding a catch clause somewhere in Tycho to ignore this failure and turn it into a log line?

@laeubi
Copy link
Member

laeubi commented Mar 11, 2024

As this more seem to originate from Maven I think no... I initially assumed it was a problem with the internal OSGi framework but think its more generally a problem when the classloader is disposed as @tomaswolf explained here, in general a Shutdownhook must be used with care and I think JGit is using them wrong as described at https://docs.oracle.com/javase/8/docs/technotes/guides/lang/hook-design.html one should simply cancel a hook when it is no longer needed instead of it lingering around forever.

@mickaelistria
Copy link
Contributor

Is it already possible to leverage the JGit fix in Tycho?

@laeubi
Copy link
Member

laeubi commented Mar 20, 2024

If it is released to maven central somewhere (or a snapshot repo) it should be possible to add an additional <dependency> element to the jgit timestamp provider.

@tomaswolf
Copy link

The JGit snapshot maven repo is https://repo.eclipse.org/content/repositories/jgit-snapshots .

@fbricon
Copy link

fbricon commented Jul 12, 2024

The JGit bug fix is available in 6.10.0, released last month.

@sratz
Copy link
Contributor

sratz commented Sep 19, 2024

Fixed in 5.0.0-SNAPSHOT (via #3994) and 4.0.9 (via #3966)

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

No branches or pull requests

6 participants