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

Threads unexpectedly die when using labels in github #523

Closed
prediktorn opened this issue May 12, 2017 · 5 comments
Closed

Threads unexpectedly die when using labels in github #523

prediktorn opened this issue May 12, 2017 · 5 comments
Labels

Comments

@prediktorn
Copy link

prediktorn commented May 12, 2017

Jenkins version: 2.46.2
Plugin version: 1.36.2
We have a problem where threads die when we have created a pull request with labels in github. In github we have set the webhook to trigger when we have a Pull Request event.
Pull request
Pull request opened, closed, reopened, edited, assigned, unassigned, review requested, review request removed, labeled, unlabeled, or synchronized.

The output from our jenkins log looks like this:

INFO: Checking PR #5,761 for edgeware/monorepo
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbTrigger handlePR
INFO: Checking PR #5,761 for job Misc/pullrequest_check
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbTrigger handlePR
INFO: Checking PR #5,761 for job Misc/pullrequest_build
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbRootAction handleAction
INFO: Checking PR #5,761 for edgeware/monorepo
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbTrigger handlePR
INFO: Checking PR #5,761 for job Misc/pullrequest_check
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbRepository onPullRequestHook
WARNING: Unknown Pull Request hook action: assigned
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbTrigger handlePR
INFO: Checking PR #5,761 for job Misc/pullrequest_build
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbRepository onPullRequestHook
WARNING: Unknown Pull Request hook action: assigned
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbRootAction handleAction
INFO: Checking PR #5,761 for edgeware/monorepo
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbTrigger handlePR
INFO: Checking PR #5,761 for job Misc/pullrequest_check
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbRepository onPullRequestHook
WARNING: Unknown Pull Request hook action: labeled
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbTrigger handlePR
INFO: Checking PR #5,761 for job Misc/pullrequest_build
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbRepository onPullRequestHook
WARNING: Unknown Pull Request hook action: labeled
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbRootAction handleAction
INFO: Checking PR #5,761 for edgeware/monorepo
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbTrigger handlePR
INFO: Checking PR #5,761 for job Misc/pullrequest_check
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbTrigger handlePR
INFO: Checking PR #5,761 for job Misc/pullrequest_build
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbRepository onPullRequestHook
WARNING: Unknown Pull Request hook action: labeled
May 09, 2017 8:54:04 AM org.jenkinsci.plugins.ghprb.GhprbRepository onPullRequestHook
WARNING: Unknown Pull Request hook action: labeled
May 09, 2017 8:54:05 AM org.jenkinsci.plugins.ghprb.GhprbPullRequest <init>
INFO: Created Pull Request #5,761 on edgeware/monorepo by kohnech () updated at: 5/9/17 8:54 AM SHA: d16ffaada79638e25db32eaa649b84dadaa63009
May 09, 2017 8:54:05 AM org.jenkinsci.plugins.ghprb.GhprbPullRequest updatePR
INFO: Pull request #5,761 was updated on repo edgeware/monorepo but there aren't any new comments nor commits; that may mean that commit status was updated.
May 09, 2017 8:54:05 AM org.jenkinsci.plugins.ghprb.GhprbPullRequest <init>
INFO: Created Pull Request #5,761 on edgeware/monorepo by kohnech () updated at: 5/9/17 8:54 AM SHA: d16ffaada79638e25db32eaa649b84dadaa63009
May 09, 2017 8:54:05 AM org.jenkinsci.plugins.ghprb.GhprbPullRequest updatePR
INFO: Pull request #5,761 was updated on repo edgeware/monorepo but there aren't any new comments nor commits; that may mean that commit status was updated.
May 09, 2017 8:54:05 AM hudson.init.impl.InstallUncaughtExceptionHandler$DefaultUncaughtExceptionHandler uncaughtException
SEVERE: A thread (Thread-68829/131576) died unexpectedly due to an uncaught exception, this may leave your Jenkins in a bad way and is usually indicative of a bug in the code.
java.lang.Error: java.io.FileNotFoundException: {"message":"Not Found","documentation_url":"https://developer.github.com/v3"}
        at org.kohsuke.github.Requester$PagingIterator.fetch(Requester.java:505)
        at org.kohsuke.github.Requester$PagingIterator.hasNext(Requester.java:470)
        at org.kohsuke.github.PagedIterator.fetch(PagedIterator.java:44)
        at org.kohsuke.github.PagedIterator.hasNext(PagedIterator.java:32)
        at org.jenkinsci.plugins.ghprb.GhprbPullRequest.tryBuild(GhprbPullRequest.java:380)
        at org.jenkinsci.plugins.ghprb.GhprbPullRequest.check(GhprbPullRequest.java:163)
        at org.jenkinsci.plugins.ghprb.GhprbRepository.onPullRequestHook(GhprbRepository.java:382)
        at org.jenkinsci.plugins.ghprb.GhprbTrigger.handlePR(GhprbTrigger.java:627)
        at org.jenkinsci.plugins.ghprb.GhprbRootAction$2.run(GhprbRootAction.java:252)
Caused by: java.io.FileNotFoundException: {"message":"Not Found","documentation_url":"https://developer.github.com/v3"}
        at org.kohsuke.github.Requester.handleApiError(Requester.java:650)
        at org.kohsuke.github.Requester$PagingIterator.fetch(Requester.java:499)
        ... 8 more
Caused by: java.io.FileNotFoundException: https://api.github.com/repos/edgeware/monorepo/pulls/5761/commits
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926)
        at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1921)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
        at org.kohsuke.github.Requester.parse(Requester.java:596)
        at org.kohsuke.github.Requester.access$200(Requester.java:68)
        at org.kohsuke.github.Requester$PagingIterator.fetch(Requester.java:494)
        ... 8 more
Caused by: java.io.FileNotFoundException: https://api.github.com/repos/edgeware/monorepo/pulls/5761/commits
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1872)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
        at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
        at org.kohsuke.github.Requester.parse(Requester.java:586)
        ... 10 more
@benpatterson
Copy link
Member

@prediktorn That's interesting. I'd like to ask you some more questions if you don't mind...

  • What version of the github-api do you have installed?
  • Does this happen all the time, or only when receiving events for labels?

While the plugin supports deciding whether or not to build based on label, we haven't wired it specifically to handle label events. So that's my first or second suspicion here...

@prediktorn
Copy link
Author

We are using version 1.85 of the github-api.
It does not happen all the time, and not even all the time when receiving events for labels. It seems to happen roughly once a week for us and has been happening for a couple of months now (so on different versions of the plugins).
Could it be some kind of race condition since jenkins will receive several events (one for opening the pull request, one for each label, one for the pull request being assigned, etc) basically at the same time?
Do you know if there is a way to setup the github webhhok to only notify when a pullrequest is opened or there a new commits?

@sverkera
Copy link

This issue is caused by the github lib on these occasions will catch an IOException and wrap it in a java.lang.Error. This plugin has a catch-all in the thread for Exceptions, but that does not catch an Error.

I've changed that to catch Throwable, which will catch both Error and Exception. I've also added some catching of Error higher up where it catches IOException.

Pull request will come

@sverkera
Copy link

#570

@sverkera sverkera mentioned this issue Nov 20, 2017
samrocketman added a commit that referenced this issue Nov 20, 2017
@bjoernhaeuser
Copy link
Contributor

#570 is merged now, closing this for now.

nosmo pushed a commit to nosmo/ghprb-plugin that referenced this issue Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants