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

Move hunks getting executed on agents to separate classes #1652

Merged

Conversation

Vlatombe
Copy link
Member

@Vlatombe Vlatombe commented Sep 4, 2024

I see java.lang.NoClassDefFoundError: javax/servlet/ServletException happening on agent side when loading these as lambdas. Happened on fresh agents (kubernetes agents) when running Jenkins through hpi:run, but also on permanent agent, as long as I clear jarCache.

Not sure where the class is being captured from, but moving these to standalone classes definitely fixes the issue I'm seeing.

Similar to jenkinsci/git-client-plugin#171, jenkinsci/git-client-plugin#359, it has been a long time since I've seen this kind of issue

AVERTISSEMENT: LinkageError while performing UserRequest:UserRPCRequest:org.jenkinsci.plugins.gitclient.GitClient.withRepository[org.jenkinsci.plugins.gitclient.RepositoryCallback](17)
java.lang.NoClassDefFoundError: javax/servlet/ServletException
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
	at java.base/java.lang.Class.getDeclaredMethod(Class.java:2673)
	at java.base/java.lang.invoke.SerializedLambda$1.run(SerializedLambda.java:272)
	at java.base/java.lang.invoke.SerializedLambda$1.run(SerializedLambda.java:269)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
	at java.base/java.lang.invoke.SerializedLambda.readResolve(SerializedLambda.java:269)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1190)
	at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2266)
	at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
	at java.base/java.io.ObjectInputStream.readArray(ObjectInputStream.java:2157)
	at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1721)
	at java.base/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2606)
	at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2457)
	at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2257)
	at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
	at hudson.remoting.UserRequest.deserialize(UserRequest.java:289)
	at hudson.remoting.UserRequest.perform(UserRequest.java:189)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:377)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:140)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletException
	at hudson.remoting.RemoteClassLoader$ClassLoaderProxy.fetch(RemoteClassLoader.java:1029)
	at jdk.internal.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:924)
	at hudson.remoting.Request$2.run(Request.java:377)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at org.jenkinsci.remoting.CallableDecorator.call(CallableDecorator.java:18)
	at hudson.remoting.CallableDecoratorList.lambda$applyDecorator$0(CallableDecoratorList.java:19)
	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
	at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	... 1 more
	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection to localhost/127.0.0.1:8001
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1826)
		at hudson.remoting.Request.call(Request.java:199)
		at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:288)
		at jdk.proxy2/jdk.proxy2.$Proxy7.fetch(Unknown Source)
		at hudson.remoting.RemoteClassLoader.loadRemoteClass(RemoteClassLoader.java:315)
		at hudson.remoting.RemoteClassLoader.loadWithMultiClassLoader(RemoteClassLoader.java:284)
		at hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:243)
		at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
		at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
		at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
		at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
		at java.base/java.lang.Class.getDeclaredMethod(Class.java:2673)
		at java.base/java.lang.invoke.SerializedLambda$1.run(SerializedLambda.java:272)
		at java.base/java.lang.invoke.SerializedLambda$1.run(SerializedLambda.java:269)
		at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
		at java.base/java.lang.invoke.SerializedLambda.readResolve(SerializedLambda.java:269)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
		at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1190)
		at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2266)
		at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
		at java.base/java.io.ObjectInputStream.readArray(ObjectInputStream.java:2157)
		at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1721)
		at java.base/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2606)
		at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2457)
		at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2257)
		at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
		at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
		at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
		at hudson.remoting.UserRequest.deserialize(UserRequest.java:289)
		at hudson.remoting.UserRequest.perform(UserRequest.java:189)
		at hudson.remoting.UserRequest.perform(UserRequest.java:54)
		at hudson.remoting.Request$2.run(Request.java:377)
		at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
		at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
		at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:140)
		... 1 more

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

I see java.lang.NoClassDefFoundError: javax/servlet/ServletException happening on agent side when loading these as lambdas. Not sure where the class is being captured from, but moving these to standalone classes definitely fixes the issue I'm seeing.
@Vlatombe Vlatombe requested a review from a team as a code owner September 4, 2024 16:43
@olamy olamy added the bug Incorrect or flawed behavior label Sep 5, 2024
Copy link
Member

@olamy olamy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm but spotbugs issues need to be fixed.

Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MarkEWaite MarkEWaite merged commit beda22c into jenkinsci:master Sep 17, 2024
17 checks passed
@Vlatombe Vlatombe deleted the servletexception-noclassdeffounderror branch September 18, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect or flawed behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants