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

NullPointerException on many manage jenkins pages from unconfigured Slack plugin #369

Closed
bradrhod opened this issue Feb 26, 2018 · 11 comments

Comments

@bradrhod
Copy link

bradrhod commented Feb 26, 2018

This seems to cause a lot of problems for users.

This has nothing to do with upgrading the plugin. The repro steps are easy and straightforward.

  • bring up jenkinsci/blueocean docker image in a container.
  • navigate to plugins and install slack plug in.
  • after restart for plugin install, navigate to global Tools config or Global Security config or a number of other pages and they all crash with below stack.

This is a pretty bad experience, you have to stop everything and dig through all of the above issues, which appear to be on different versions of the plugin.

Some code was added that protects if the url gotten from getSlackOutgoingWebhookURL is null.

@Override`
public String getUrlName() {
    String url = globalConfig.getSlackOutgoingWebhookURL();
    if (url == null || url.equals(""))
        return UUID.randomUUID().toString().replaceAll("-", "");
   return "/"+url;
}

Clearly the problem is caused by the globalConfig being Null. The problem is caused when slack plugin is installed and not fully configured. The unconfigured plugin should definitely not be crashing these other jenkins config pages.

Once you run into this issue it will be further confused. When you go to the Configure System page and actually configure Slack extension, you can even hit test successfully, then you navigate to these other pages they still crash. You have to restart jenkins to get the globalConfig to work properly.

Another monkey patch for would be in the getUrlName() add a test for null globalConfig.

@Override`
public String getUrlName() {
    if (globalConfig == null)
        return UUID.randomUUID().toString().replaceAll("-", "");
    String url = globalConfig.getSlackOutgoingWebhookURL();
    if (url == null || url.equals(""))
        return UUID.randomUUID().toString().replaceAll("-", "");
   return "/"+url;
}

A better fix would to be actually figuring out why this object is null in the first place. Also looking into why the slack plugin runs on these unrelated configuration pages could provide a better fix.

The version of Jenkins is 1.89. The version of the slack plugin is the latest version.

java.lang.NullPointerException
at jenkins.plugins.slack.webhook.WebhookEndpoint.getUrlName(WebhookEndpoint.java:51)
at jenkins.model.Jenkins.getDynamic(Jenkins.java:3621)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
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.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:812)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:86)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
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:1652)
at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)

@bradrhod bradrhod changed the title NullPointerException on many manage jenkins pages from Slack plugin NullPointerException on many manage jenkins pages from unconfigured Slack plugin Feb 26, 2018
@fengxx
Copy link

fengxx commented Mar 2, 2018

it will be fixed by #364, waiting @gurumaia for review

@bradrhod
Copy link
Author

bradrhod commented Mar 3, 2018

Awesome. Thanks.

@wizard580
Copy link

Can I ping you guys? @gurumaia ?
We need this fix :)

@Korrd
Copy link

Korrd commented Mar 13, 2018

Same here. I need to use the plugin too.

@Korrd
Copy link

Korrd commented Mar 20, 2018

Are there any news regarding this?

@bogdan-calapod
Copy link

I'm also interested in a fix for this.

@williamstorres
Copy link

Any news?

@VivaLaRobo
Copy link

Any updates on this?

@arymkus
Copy link

arymkus commented Apr 20, 2018

Same for me, had to deinstall.

@larsskj
Copy link

larsskj commented Aug 28, 2018

I'm bitten by this one as well - and I'm also considering deinstall.

@kmadel
Copy link
Contributor

kmadel commented Oct 7, 2018

#403

@kmadel kmadel closed this as completed Oct 7, 2018
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

10 participants