Argelbargel / gitlab-branch-source-plugin

Jenkins-Plugin to create a multi-branch-project from gitlab
GNU General Public License v2.0
71 stars 44 forks source link

500 when doing merge request event from gitlab #59

Closed dwd-build closed 6 years ago

dwd-build commented 6 years ago

Hiya, great plugin so far! We are trying to use this plugin, but we get some 500 internal server errors when we try to do a merge request even from gitlab to jenkins.

The actual exception: Hook executed successfully but returned HTTP 500 java.lang.Exception at org.kohsuke.stapler.HttpResponses.error(HttpResponses.java:83) at argelbargel.jenkins.plugins.gitlab_branch_source.hooks.GitLabSCMWebHook.doNotify(GitLabSCMWebHook.java:113) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343) at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:77) at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26) 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$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:154) at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:225) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at org.jenkinsci.plugins.modernstatus.ModernStatusFilter.doFilter(ModernStatusFilter.java:52) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:59) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at jenkins.metrics.impl.MetricsFilter.doFilter(MetricsFilter.java:125) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637) at argelbargel.jenkins.plugins.gitlab_branch_source.hooks.GitLabSCMWebHookCrumbExclusion.process(GitLabSCMWebHookCrumbExclusion.java:19) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:73) 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:135) 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:93) 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)

Argelbargel commented 6 years ago

Hmmm... The stacktrace does not really contain enough information to pinpoint the problem :-/ Which version of the plugin are you using?

dwd-build commented 6 years ago

We had this problem with 0.7.5-dev and upgraded to 0.7.6-dev but that has the same issue.

Argelbargel commented 6 years ago

Push events work though?

dwd-build commented 6 years ago

Push events return a 200 so they seem to work correctly.

werthen commented 6 years ago

Just ran into the exact same error on a new installation of the plugin.

dwd-build commented 6 years ago

upgraded plugin to 0.7.6.1-dev - same stuff

jaytaph commented 6 years ago

It might have to do with a segfault i'm noticing while tracing jenkins during a merge request event trigger:

[pid 20400] gettimeofday({1523887094, 279859}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 279954}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280029}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280123}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280198}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280306}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280381}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280490}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280567}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280662}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280738}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280831}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 280906}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 281003}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 281078}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 281173}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 281249}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 281342}, NULL) = 0
[pid 20400] gettimeofday({1523887094, 281417}, NULL) = 0
[pid 20400] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
[pid 20400] rt_sigreturn({mask=[QUIT]}) = 1048576
[pid 20400] writev(1344, [{"HTTP/1.1 500 Server Error\r\nDate: Mon, 16 Apr 2018 13:58:14 GMT\r\nX-Content-Type-Options: nosniff\r\nContent-Type: text/plain;charset=utf-8\r\nContent-Length: 7784\r\nServer: Jetty(9.4.z-SNAPSHOT)\r\n\r\n", 192}, {"java.lang.Exception\n\tat org.kohsuke.stapler.HttpResponses.error(HttpResponses.java:83)\n\tat argelbargel.jenkins.plugins.gitlab_branch_source.hooks.GitLabSCMWebHook.doNotify(GitLabSCMWebHook.java:113)\n\tat java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)\n\tat org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)\n\tat org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:77)\n\tat org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)\n\tat org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)\n\tat org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)\n\tat org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)\n\tat org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)\n\tat org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)\n\tat org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)\n\tat org.kohsuke.stapler.MetaClass$10.dispatch(MetaCl"..., 7784}], 2) = 7976
[pid 20400] gettimeofday({1523887094, 282339}, NULL) = 0
[pid 20400] shutdown(1344, SHUT_WR)     = 0
[pid 20400] gettimeofday({1523887094, 282586}, NULL) = 0
ilushka85 commented 6 years ago

I have the same issue. In tracing it down it is caused because the Action property of the hook event is not translated to the enum and left as null. This is a problem in the gitlab plugin. I will notify them and send a pr there to correct it, but will also submit a pr here to work around this for now.

dwd-build commented 6 years ago

Tried the fix of @ilushka85 - seems to work. Thanks for this! :)

Argelbargel commented 6 years ago

Ok. Great. So i'm closing this and will try to merge the changes into the dev-branch some time this week...