[JIRA] [github-oauth-plugin] (JENKINS-33258) Error on every Jenkins page: java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/user

10 views
Skip to first unread message

leandro.lucarella@sociomantic.com (JIRA)

unread,
Mar 1, 2016, 8:34:03 PM3/1/16
to jenkinsc...@googlegroups.com
Leandro Lucarella created an issue
 
Jenkins / Bug JENKINS-33258
Error on every Jenkins page: java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/user
Issue Type: Bug Bug
Assignee: Sam Gleske
Components: github-oauth-plugin
Created: 02/Mar/16 1:33 AM
Environment: Jenkins 1.642.2, Ubuntu 14.04, plugin version 0.22.3
Priority: Blocker Blocker
Reporter: Leandro Lucarella

Hi, I'm suddenly getting this error and can't use jenkins at all with OAuth plugin. The OAuth applications is set up correctly, and the client secret and ID are set into jenkins config.

I did some changes in the jenkins data directory, so it might be my fault that this is broken, but I fail to make it work again unless I disable security completely in Jenkins. Any help to debug this would be appreciated.

The error I get on every Jenkins URL (BTW, I revoked access to my user to this App, and I don't even get GitHub login page when going to Jenkins).

java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/user
	at org.jenkinsci.plugins.GithubSecurityRealm$1.authenticate(GithubSecurityRealm.java:569)
	at jenkins.security.BasicHeaderRealPasswordAuthenticator.authenticate(BasicHeaderRealPasswordAuthenticator.java:55)
	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:79)
	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:76)
	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:370)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
	at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/user
	at sun.reflect.GeneratedConstructorAccessor72.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1677)
	at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1673)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1246)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
	at org.kohsuke.github.Requester.parse(Requester.java:483)
	at org.kohsuke.github.Requester._to(Requester.java:236)
	at org.kohsuke.github.Requester.to(Requester.java:203)
	at org.kohsuke.github.GitHub.getMyself(GitHub.java:276)
	at org.kohsuke.github.GitHub.<init>(GitHub.java:143)
	at org.kohsuke.github.GitHubBuilder.build(GitHubBuilder.java:196)
	at org.kohsuke.github.GitHub.connectUsingOAuth(GitHub.java:192)
	at org.jenkinsci.plugins.GithubAuthenticationToken.<init>(GithubAuthenticationToken.java:98)
	at org.jenkinsci.plugins.GithubSecurityRealm$1.authenticate(GithubSecurityRealm.java:565)
	... 38 more
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/user
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1628)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
	at org.kohsuke.github.Requester.parse(Requester.java:479)
	... 46 more
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

leandro.lucarella@sociomantic.com (JIRA)

unread,
Mar 2, 2016, 3:13:02 PM3/2/16
to jenkinsc...@googlegroups.com
Leandro Lucarella commented on Bug JENKINS-33258
 
Re: Error on every Jenkins page: java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/user

It looks like there's a browser component on this issue, it works fine on a private window and a browser restart fixed it.

sam.mxracer@gmail.com (JIRA)

unread,
Mar 2, 2016, 7:56:01 PM3/2/16
to jenkinsc...@googlegroups.com

What plugin versions are you using for:

  • Icon Shim plugin
  • Matrix authorization plugin
  • Cloudbees folders plugin

There was a recent release of those three plugins (an unfortunate staggered release) which threw authorization out of whack. Their versions should be:

  • cloudbees-folder 5.2.2
  • icon-shim 2.0.3
  • matrix-auth 1.3.2

sam.mxracer@gmail.com (JIRA)

unread,
Mar 2, 2016, 7:57:02 PM3/2/16
to jenkinsc...@googlegroups.com

leandro.lucarella@sociomantic.com (JIRA)

unread,
Mar 3, 2016, 2:32:01 PM3/3/16
to jenkinsc...@googlegroups.com

I'm using the versions you listed, but I experienced the problem before the update (I disabled auth and updated hoping for the problem to go away).

Is hard to tell the changes in JENKINS_HOME unfortunately, I'm moving one jenkins instance to another but starting for a clean setup, not doing a complete move, so I added a bunch of jobs configuration files and maybe other configuration files too. I saved the previous JENKINS_HOME before messing with it, and restoring the old folder didn't fix the problem.

I only found out it was a browser related issue because another person told me he didn't have any problems with the server when I told him about this issue.

sam.mxracer@gmail.com (JIRA)

unread,
Mar 3, 2016, 8:03:01 PM3/3/16
to jenkinsc...@googlegroups.com

leandro.lucarella@sociomantic.com (JIRA)

unread,
Mar 4, 2016, 11:39:01 AM3/4/16
to jenkinsc...@googlegroups.com

I am
This was very early in the stage of the move, I just copied a couple of jobs to make sure I installed all the necessary plugins, etc. Once everything looked fine, I checked out the whole config files I have in git, and then it happened.

leandro.lucarella@sociomantic.com (JIRA)

unread,
Mar 4, 2016, 11:40:01 AM3/4/16
to jenkinsc...@googlegroups.com

leandro.lucarella@sociomantic.com (JIRA)

unread,
Mar 4, 2016, 11:41:01 AM3/4/16
to jenkinsc...@googlegroups.com

Anyway, I'm fine if you want to close this as invalid or cantreproduce, as once the browser was restarted I never experienced this again.

sam.mxracer@gmail.com (JIRA)

unread,
May 15, 2016, 9:10:01 PM5/15/16
to jenkinsc...@googlegroups.com

sam.mxracer@gmail.com (JIRA)

unread,
May 15, 2016, 9:10:02 PM5/15/16
to jenkinsc...@googlegroups.com

sam.mxracer@gmail.com (JIRA)

unread,
May 15, 2016, 9:10:02 PM5/15/16
to jenkinsc...@googlegroups.com

sam.mxracer@gmail.com (JIRA)

unread,
May 15, 2016, 9:10:02 PM5/15/16
to jenkinsc...@googlegroups.com
Sam Gleske commented on Bug JENKINS-33258
 
Re: Error on every Jenkins page: java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/user

Hmmm, okay. If you experience it again and you're able to reproduce it feel free to re-open this issue or create a new one and link to this one.

megazoll@gmail.com (JIRA)

unread,
Jun 28, 2016, 7:28:03 AM6/28/16
to jenkinsc...@googlegroups.com

I have s same bug. I think it related with http auth. My jenkins instance works via nginx reverse proxy with http auth on nginx. Stripping Authorization header fixes the issue.

Unable to find source-code formatter for language: nginx. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
proxy_set_header Authorization  "";
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

megazoll@gmail.com (JIRA)

unread,
Jun 28, 2016, 7:28:13 AM6/28/16
to jenkinsc...@googlegroups.com
I have s same bug. I think it related with http auth. My jenkins instance works via nginx reverse proxy with http auth on nginx. Stripping Authorization header fixes the issue.

{code :nginx }
proxy_set_header Authorization  "";
{code}

megazoll@gmail.com (JIRA)

unread,
Jun 28, 2016, 8:15:01 AM6/28/16
to jenkinsc...@googlegroups.com
I have s the same bug. I think it related with http auth. My jenkins instance works via nginx reverse proxy with http auth on nginx. Stripping Authorization header fixes the issue.

{code}
proxy_set_header Authorization  "";
{code}
Reply all
Reply to author
Forward
0 new messages