hobbit-project / platform

HOBBIT benchmarking platform
GNU General Public License v2.0
23 stars 9 forks source link

Gitlab crawling robustness #22

Closed MichaelRoeder closed 7 years ago

MichaelRoeder commented 7 years ago

Problem

If the crawling of gitlab crashes because of a problem, the platform does not get any updates regarding the benchmark or system definitions.

A crash might occur because of communication problems like

Exception in thread "Timer-1" java.lang.Error: org.gitlab.api.GitlabAPIException: <html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
 - 
    at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:239)
</body>
</html>
<hr><center>nginx/1.11.3</center>
    at org.gitlab.api.http.GitlabHTTPRequestor.getAll(GitlabHTTPRequestor.java:161)
    at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:193)
    at org.hobbit.controller.gitlab.GitlabControllerImpl$1.run(GitlabControllerImpl.java:103)
    at org.gitlab.api.GitlabAPI.getAllProjects(GitlabAPI.java:609)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Caused by: org.gitlab.api.GitlabAPIException: <html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.11.3</center>
</body>
</html>
 - 
    at org.gitlab.api.http.GitlabHTTPRequestor.handleAPIError(GitlabHTTPRequestor.java:369)
    ... 6 more
    at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:236)
    at org.gitlab.api.http.GitlabHTTPRequestor.access$300(GitlabHTTPRequestor.java:28)
Caused by: java.io.IOException: Server returned HTTP response code: 504 for URL: https://git.project-hobbit.eu/api/v3/projects/all?&page=2
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:327)
    ... 6 more
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:28)
    at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:232)

Solution

The Runnable executed by the timer needs to be more robust. A regular checking of the timer or printage of its status might be helpful for monitoring.

MichaelRoeder commented 7 years ago

The problem is caused by the Gitlab library that seems to envelope the original GitlabAPIException into an java.lang.Error which is not catched by the current implementation of our usage of the Gitlab library.

MichaelRoeder commented 7 years ago

Fixed in v1.0.4