jenkinsci / gitlab-plugin

A Jenkins plugin for interfacing with GitLab
https://plugins.jenkins.io/gitlab-plugin/
GNU General Public License v2.0
1.44k stars 613 forks source link

Webhook NullPointerException if Gitlab connection fails #655

Closed kraftman closed 6 years ago

kraftman commented 6 years ago

Issue

Context

Logs & Traces

java.lang.NullPointerException
    at org.jboss.resteasy.util.ReadFromStream.readFromStream(ReadFromStream.java:30)
    at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.bufferEntity(ClientResponse.java:307)
    at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:48)
    at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104)
    at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:64)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.$Proxy97.headCurrentUser(Unknown Source)
    at com.dabsquared.gitlabjenkins.gitlab.api.GitLabClient.headCurrentUser(GitLabClient.java:98)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectGitLabClientBuilder.autodetect(AutodetectGitLabClientBuilder.java:44)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectGitLabClientBuilder.autodetectOrDie(AutodetectGitLabClientBuilder.java:29)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectGitLabClientBuilder.buildClient(AutodetectGitLabClientBuilder.java:25)
    at com.dabsquared.gitlabjenkins.connection.GitLabConnection.getClient(GitLabConnection.java:116)
    at com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.getClient(GitLabConnectionConfig.java:89)
    at com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty.getClient(GitLabConnectionProperty.java:37)
    at com.dabsquared.gitlabjenkins.trigger.branch.ProjectBranchesProvider.getProjectBranches(ProjectBranchesProvider.java:47)
    at com.dabsquared.gitlabjenkins.trigger.branch.ProjectBranchesProvider.doCheckBranchesSpec(ProjectBranchesProvider.java:76)
    at com.dabsquared.gitlabjenkins.GitLabPushTrigger$DescriptorImpl.doCheckExcludeBranchesSpec(GitLabPushTrigger.java:414)
    at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
Caused: java.lang.reflect.InvocationTargetException
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:347)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
    at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:248)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
    at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:248)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
    at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:59)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:92)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:564)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
    at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Problem description

We recently migrated gitlab and jenkins to different machines, and updated gitlab and jenkins to the latest versions. After doing so we updated the webhook url's but got the above error for some projects but not others. Some projects switching 'Rebuild open Merge Requests' from 'on push to source or target branch' to 'on push to source branch' fixed the issue, others it didnt. We eventually found the problem was that the existing gitlab connection credentials weren't working and we needed to update them, but it would have been handy to have a bit more information in the error message.

mogthesprog commented 6 years ago

I get a similar stack trace and null pointer exception. Running Jenkins 2.87 and latest version 1.5 of gitlab plugin.

My issue was related to the Proxy i had configured in the "Manage Plugin > Advanced" tab. When i removed the Proxy it all seemed to work. I had properly configured the NoProxy values though.

Argelbargel commented 6 years ago

@mogthesprog: the problem with the proxy was already reported in #648 and the fix for that is already merged but not released yet.

omehegan commented 6 years ago

@Argelbargel should I hold up releasing 1.5.1 for you to look into this issue?

Argelbargel commented 6 years ago

@omehegan: no. the report cites more than one reason which could have caused the problem. I'd say, we build another release and see whether we might be able to triangulate the root-cause when further feedback comes in...

tomasAlabes commented 6 years ago

@Argelbargel @omehegan please release 1.5.1 as issue #648 is a blocker for the mentioned versions in the bug (downgrading to 1.4.8 doesn't let us discriminate between MR events in the job conf). Thanks :)

mogthesprog commented 6 years ago

@Argelbargel Thanks for the update! :)

krstcs commented 6 years ago

I'm seeing a similar stack trace with 1.5.1, when I run the test in GitLab integrations, Jenkins throws the stacktrace back. Should I revert to an earlier build? This was working before I updated to 1.5.1, but I'm not sure what the last version I was using is, I wasn't the one who pushed out the updates (grrr...).

dskrvk commented 6 years ago

Same here - 1.5.1 and 1.5.0 both have the error. I had to downgrade to 1.4.8, but that one can no longer post MR comments.

Argelbargel commented 6 years ago

I'll try to look into this but am currently a bit swamped with other work, so it might take til after the weekend. @krstcs and @dskrvk could you please post your stacktraces here - except if they are the same to the one posted above. In the meantime reverting back to 1.4 8 or enforcing v3 api in the system configuration might help...

dskrvk commented 6 years ago
ERROR: Build step failed with exception
java.lang.NullPointerException
    at org.jboss.resteasy.util.ReadFromStream.readFromStream(ReadFromStream.java:30)
    at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.bufferEntity(ClientResponse.java:307)
    at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:48)
    at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104)
    at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:64)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.$Proxy119.headCurrentUser(Unknown Source)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.ResteasyGitLabClient.headCurrentUser(ResteasyGitLabClient.java:100)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.autodetect(AutodetectingGitLabClient.java:290)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.autodetectOrDie(AutodetectingGitLabClient.java:278)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.delegate(AutodetectingGitLabClient.java:271)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.access$200(AutodetectingGitLabClient.java:14)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$GitLabOperation.execute(AutodetectingGitLabClient.java:308)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$GitLabOperation.access$100(AutodetectingGitLabClient.java:305)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.execute(AutodetectingGitLabClient.java:301)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.headCurrentUser(AutodetectingGitLabClient.java:203)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.autodetect(AutodetectingGitLabClient.java:290)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.autodetectOrDie(AutodetectingGitLabClient.java:278)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.delegate(AutodetectingGitLabClient.java:271)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.access$200(AutodetectingGitLabClient.java:14)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$GitLabOperation.execute(AutodetectingGitLabClient.java:308)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$GitLabOperation.access$100(AutodetectingGitLabClient.java:305)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.execute(AutodetectingGitLabClient.java:301)
    at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.createMergeRequestNote(AutodetectingGitLabClient.java:157)
    at com.dabsquared.gitlabjenkins.publisher.GitLabMessagePublisher.perform(GitLabMessagePublisher.java:115)
    at com.dabsquared.gitlabjenkins.publisher.MergeRequestNotifier.perform(MergeRequestNotifier.java:39)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
    at hudson.model.Build$BuildExecution.post2(Build.java:186)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
    at hudson.model.Run.execute(Run.java:1749)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:421)
krstcs commented 6 years ago

java.lang.NullPointerException at org.jboss.resteasy.util.ReadFromStream.readFromStream(ReadFromStream.java:30) at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.bufferEntity(ClientResponse.java:307) at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:48) at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104) at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:64) at com.dabsquared.gitlabjenkins.gitlab.api.impl.$Proxy120.headCurrentUser(Unknown Source) at com.dabsquared.gitlabjenkins.gitlab.api.impl.ResteasyGitLabClient.headCurrentUser(ResteasyGitLabClient.java:100) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.autodetect(AutodetectingGitLabClient.java:290) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.autodetectOrDie(AutodetectingGitLabClient.java:278) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.delegate(AutodetectingGitLabClient.java:271) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.access$200(AutodetectingGitLabClient.java:14) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$GitLabOperation.execute(AutodetectingGitLabClient.java:308) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$GitLabOperation.access$100(AutodetectingGitLabClient.java:305) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.execute(AutodetectingGitLabClient.java:301) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.headCurrentUser(AutodetectingGitLabClient.java:203) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.autodetect(AutodetectingGitLabClient.java:290) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.autodetectOrDie(AutodetectingGitLabClient.java:278) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.delegate(AutodetectingGitLabClient.java:271) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.access$200(AutodetectingGitLabClient.java:14) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$GitLabOperation.execute(AutodetectingGitLabClient.java:308) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$GitLabOperation.access$100(AutodetectingGitLabClient.java:305) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.execute(AutodetectingGitLabClient.java:301) at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.changeBuildStatus(AutodetectingGitLabClient.java:120) at com.dabsquared.gitlabjenkins.trigger.handler.AbstractWebHookTriggerHandler.setCommitStatusPendingIfNecessary(AbstractWebHookTriggerHandler.java:74) at com.dabsquared.gitlabjenkins.trigger.handler.AbstractWebHookTriggerHandler.handle(AbstractWebHookTriggerHandler.java:51) at com.dabsquared.gitlabjenkins.trigger.handler.push.PushHookTriggerHandlerImpl.handle(PushHookTriggerHandlerImpl.java:30) at com.dabsquared.gitlabjenkins.trigger.handler.push.PushHookTriggerHandlerImpl.handle(PushHookTriggerHandlerImpl.java:23) at com.dabsquared.gitlabjenkins.trigger.handler.push.PushHookTriggerHandlerList.handle(PushHookTriggerHandlerList.java:24) at com.dabsquared.gitlabjenkins.trigger.handler.push.PushHookTriggerHandlerList.handle(PushHookTriggerHandlerList.java:13) at com.dabsquared.gitlabjenkins.GitLabPushTrigger.onPost(GitLabPushTrigger.java:265) at com.dabsquared.gitlabjenkins.webhook.build.PushBuildAction$1.performOnPost(PushBuildAction.java:72) at com.dabsquared.gitlabjenkins.webhook.build.BuildWebHookAction$TriggerNotifier.run(BuildWebHookAction.java:54) at hudson.security.ACL.impersonate(ACL.java:243) at com.dabsquared.gitlabjenkins.webhook.build.PushBuildAction.execute(PushBuildAction.java:69) at com.dabsquared.gitlabjenkins.webhook.build.BuildWebHookAction.execute(BuildWebHookAction.java:31) at com.dabsquared.gitlabjenkins.webhook.GitLabWebHook.getDynamic(GitLabWebHook.java:44) at java.lang.invoke.MethodHandle.invokeWithArguments(Unknown Source) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184) at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:372) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715) Caused: javax.servlet.ServletException at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:765) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845) at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) at org.kohsuke.stapler.Stapler.service(Stapler.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135) at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:59) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637) at com.dabsquared.gitlabjenkins.webhook.GitLabWebHook$GitlabWebHookCrumbExclusion.process(GitLabWebHook.java:53) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:58) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.BasicHeaderProcessor.success(BasicHeaderProcessor.java:139) at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:81) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249) at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:564) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128) at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199) at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

Argelbargel commented 6 years ago

Do you all have a proxy configured? Just looking at the code i could not find an obvious cause for the problem, thus i'll need some help to reproduce the bug...

dskrvk commented 6 years ago

No proxy in our case.

Argelbargel commented 6 years ago

Okay, if it is not caused by the proxy-settings. As far as i can see, the exception is thrown if gitlab reports an status >=400 but the resteasy-proxy is not able to get a inputstream of the response. As this causes the NPE it'll be hard to find out what's going wrong on the gitlab side. Perhaps you could check the gitlab-logs for the times this exception is thrown?

dskrvk commented 6 years ago

We're on gitlab.com actually.

Argelbargel commented 6 years ago

I think the cause is a bug (RESTEASY-1347) in the resteasy-client we're using to talk to gitlab. It seems to be unable to properly handle error-response for HTTP-HEAD-requests. So if you're using a gitlab-version which does not yet support the new v4-api then this error will occur when we try to auto-detect which api to use (because we try v4 before v3). To work around this bug, you should force the plugin to always use the v3-api in the advanced section of the jenkins-wide gitlab-settings.

omehegan commented 6 years ago

This was just fixed/released in version 1.5.3 of the plugin. It should be in the update center within a few hours.