kruize / autotune

Autonomous Performance Tuning for Kubernetes!
Apache License 2.0
164 stars 54 forks source link

UpdateResults failed with 400 error and NPE #570

Closed chandrams closed 1 year ago

chandrams commented 1 year ago

Updating multiple results for a single experiment failed with 400 error and NPE as below:

2023-02-2008:45:46.131 ERROR [qtp1201454821-28][UpdateResults.java(75)]-Exception due to :Cannot invoke "com.autotune.common.data.ValidationResultData.isSuccess()" because the return value of "com.autotune.common.data.result.ExperimentResultData.getValidationResultData()" is null
java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "obj" is null
    at com.autotune.common.performanceProfiles.PerformanceProfileInterface.RemoteMonitoringOpenShiftImpl.convertObjectToMap(RemoteMonitoringOpenShiftImpl.java:53)
    at com.autotune.common.performanceProfiles.PerformanceProfileInterface.RemoteMonitoringOpenShiftImpl.validate(RemoteMonitoringOpenShiftImpl.java:100)
    at com.autotune.analyzer.utils.ExperimentResultValidation.validate(ExperimentResultValidation.java:60)
    at com.autotune.analyzer.utils.ExperimentInitiator.validateAndUpdateResults(ExperimentInitiator.java:82)
    at com.autotune.analyzer.services.UpdateResults.doPost(UpdateResults.java:66)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:516)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:400)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:645)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:392)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:137)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
    at java.base/java.lang.Thread.run(Unknown Source)

To recreate this:

khansaad commented 1 year ago

@chandrams We need to update the following files as the JSON input data has been modified now.

  1. resource_optimization_openshift.json

change type to function_type

  1. multiple_results_single_exp.json

change general_info to aggregation_info

Also, I need to make a small change in the Java code as well. Will do that in a separate PR.

chandrams commented 1 year ago

Updated, thanks @khansaad

khansaad commented 1 year ago

@chandrams This issue is no longer there. I tested it with the current merged code using this command:

(base) [saakhan@saakhan autotune]$ curl http://192.168.49.2:30072/createPerformanceProfile -d @./tests/scripts/remote_monitoring_tests/json_files/resource_optimization_openshift.json

{"message":"Performance Profile : resource-optimization-openshift created successfully. View Performance Profiles at /listPerformanceProfiles","httpcode":201,"documentationLink":"","status":"SUCCESS"}
dinogun commented 1 year ago

@chandrams can you please confirm if this issue is now resolved. thanks

chandrams commented 1 year ago

I have verified this with kruize/autotune_operator:0.0.10_mvp docker image, not seeing the NPE now.

But with the latest docker image kruize/autotune_operator:test, posting an array of results is not supported so I can see the below message as expected:

Response status code = 400 {"message":"Bulk entries are currently unsupported!","httpcode":400,"documentationLink":"","status":"ERROR"}