eclipse-researchlabs / scava

Eclipse Public License 2.0
7 stars 1 forks source link

Error 500 getting /analysis/tasks/project/{project} #46

Open davidediruscio opened 4 years ago

davidediruscio commented 4 years ago

In today's build of the platform (30/8/2019), we are getting a server error when accessing the api {oss-app_address}:8182/analysis/tasks/project/{project}:

oss-app_1         | WARNING: Exception or error caught in server resource
oss-app_1         | Internal Server Error (500) - The server encountered an unexpected condition which prevented it from fulfilling the request
oss-app_1         |     at org.restlet.resource.ServerResource.doHandle(ServerResource.java:540)
oss-app_1         |     at org.restlet.resource.ServerResource.get(ServerResource.java:743)
oss-app_1         |     at org.restlet.resource.ServerResource.doHandle(ServerResource.java:618)
oss-app_1         |     at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:679)
oss-app_1         |     at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:357)
oss-app_1         |     at org.restlet.resource.ServerResource.handle(ServerResource.java:1044)
oss-app_1         |     at org.restlet.resource.Finder.handle(Finder.java:236)
oss-app_1         |     at org.restlet.routing.Filter.doHandle(Filter.java:150)
oss-app_1         |     at org.restlet.routing.Filter.handle(Filter.java:197)
oss-app_1         |     at org.restlet.routing.Router.doHandle(Router.java:422)
oss-app_1         |     at org.restlet.routing.Router.handle(Router.java:639)
oss-app_1         |     at org.restlet.routing.Filter.doHandle(Filter.java:150)
oss-app_1         |     at org.restlet.routing.Filter.handle(Filter.java:197)
oss-app_1         |     at org.restlet.routing.Filter.doHandle(Filter.java:150)
oss-app_1         |     at org.restlet.routing.Filter.handle(Filter.java:197)
oss-app_1         |     at org.restlet.routing.Filter.doHandle(Filter.java:150)
oss-app_1         |     at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:140)
oss-app_1         |     at org.restlet.routing.Filter.handle(Filter.java:197)
oss-app_1         |     at org.restlet.routing.Filter.doHandle(Filter.java:150)
oss-app_1         |     at org.restlet.routing.Filter.handle(Filter.java:197)
oss-app_1         |     at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:202)
oss-app_1         |     at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:75)
oss-app_1         |     at org.restlet.Application.handle(Application.java:385)
oss-app_1         |     at org.restlet.routing.Filter.doHandle(Filter.java:150)
oss-app_1         |     at org.restlet.routing.Filter.handle(Filter.java:197)
oss-app_1         |     at org.restlet.routing.Router.doHandle(Router.java:422)
oss-app_1         |     at org.restlet.routing.Router.handle(Router.java:639)
oss-app_1         |     at org.restlet.routing.Filter.doHandle(Filter.java:150)
oss-app_1         |     at org.restlet.routing.Filter.handle(Filter.java:197)
oss-app_1         |     at org.restlet.routing.Router.doHandle(Router.java:422)
oss-app_1         |     at org.restlet.routing.Router.handle(Router.java:639)
oss-app_1         |     at org.restlet.routing.Filter.doHandle(Filter.java:150)
oss-app_1         |     at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:140)
oss-app_1         |     at org.restlet.routing.Filter.handle(Filter.java:197)
oss-app_1         |     at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:202)
oss-app_1         |     at org.restlet.Component.handle(Component.java:408)
oss-app_1         |     at org.restlet.Server.handle(Server.java:507)
oss-app_1         |     at org.restlet.engine.connector.ServerHelper.handle(ServerHelper.java:63)
oss-app_1         |     at org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:143)
oss-app_1         |     at org.restlet.ext.jetty.JettyServerHelper$WrappedServer.handle(JettyServerHelper.java:273)
oss-app_1         |     at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:313)
oss-app_1         |     at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
oss-app_1         |     at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
oss-app_1         |     at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:626)
oss-app_1         |     at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:546)
oss-app_1         |     at java.lang.Thread.run(Thread.java:748)
oss-app_1         | Caused by: java.lang.RuntimeException: no more
oss-app_1         |     at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:388)
oss-app_1         |     at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:350)
oss-app_1         |     at com.mongodb.DBCursor._next(DBCursor.java:421)
oss-app_1         |     at com.mongodb.DBCursor.next(DBCursor.java:494)
oss-app_1         |     at com.googlecode.pongo.runtime.PongoCursorIterator.next(PongoCursorIterator.java:28)
oss-app_1         |     at org.eclipse.scava.platform.analysis.AnalysisTaskService.getAnalysisTasksByProject(AnalysisTaskService.java:192)
oss-app_1         |     at org.eclipse.scava.platform.client.api.AnalysisTasksStatusByProjectResource.doRepresent(AnalysisTasksStatusByProjectResource.java:21)
oss-app_1         |     at org.eclipse.scava.platform.client.api.AbstractApiResource.represent(AbstractApiResource.java:55)
oss-app_1         |     at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
oss-app_1         |     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
oss-app_1         |     at java.lang.reflect.Method.invoke(Method.java:498)
oss-app_1         |     at org.restlet.resource.ServerResource.doHandle(ServerResource.java:524)
oss-app_1         |     ... 45 more

The problem seems to be in handling of the results of the mongodb was you can see in:

...
oss-app_1         | Caused by: java.lang.RuntimeException: no more
oss-app_1         |     at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:388)
...

Does anyone else have a similar problem? Any idea of what may be causing this behaviour?

davidediruscio commented 4 years ago

Sorry @MarcioMateus for the late reply, I missed this issue.

Sometimes I have a similar problem (no projects listed in the UI). What I do is to delete oss-app container, and if the problem is not fixed I delete the oss-db container too. In my case, once the data is in elasticsearch it's fine, I can delete the oss-db.

davidediruscio commented 4 years ago

Checking the code of AnalysisTaskService.java, the line that it is having the issue is AnalysisTask analysisTask = this.repository.getAnalysisTasks().findById(taskRef.getId()).iterator().next();, which I'm guessing that somehow the query to MongoDB is returning null or an empty iterator. Which would mean that the entry of the project that stores the task has been modified somehow.

I don't have a clear idea of why this would happen, but have you modified (metrics to do, dates) at any point the task that was analyzing the project with the issue? Maybe that can help us to get an idea of what it is happening.