GabrielBrascher opened a new issue #4355: URL: https://github.com/apache/cloudstack/issues/4355
<!-- Verify first that your issue/request is not already reported on GitHub. Also test if the latest release and master branch are affected too. Always add information AFTER of these HTML comments, but no need to delete the comments. --> ##### ISSUE TYPE <!-- Pick one below and delete the rest --> * Bug Report ##### COMPONENT NAME <!-- Categorize the issue, e.g. API, VR, VPN, UI, etc. --> ~~~ API ~~~ ##### CLOUDSTACK VERSION <!-- New line separated list of affected versions, commit ID for issues on master branch. --> ~~~ master/4.15 ~~~ ##### CONFIGURATION <!-- Information about the configuration if relevant, e.g. basic network, advanced networking, etc. N/A otherwise --> ~~~ N/A ~~~ ##### OS / ENVIRONMENT <!-- Information about the environment if relevant, N/A otherwise --> ~~~ N/A ~~~ ##### SUMMARY <!-- Explain the problem/feature briefly --> Issues when API command response is generated. Exception at the log and API command result. The command works fine, but to whom using the API it seems to have failed. ##### STEPS TO REPRODUCE <!-- For bugs, show exactly how to reproduce the problem, using a minimal test-case. Use Screenshots if accurate. For new features, show how the feature would be used. --> <!-- Paste example playbooks or commands between quotes below --> ~~~ Call an API command, e.g. prepareHostMaintenance or cancelHostMaintenance ~~~ <!-- You can also paste gist.github.com links for larger files --> ##### EXPECTED RESULTS <!-- What did you expect to happen when running the steps above? --> ~~~ Proper API response and no log exceptions on the management node ~~~ ##### ACTUAL RESULTS <!-- What actually happened? --> <!-- Paste verbatim command output between quotes below --> ~~~ 1. When calling API command via CloudMonkey: ``` > prepare hostformaintenance id=host-id Error: async API failed for job b43bbdbf-fe65-436c-9e7e-7c48e4fbfea1 ``` 2. log at the management node: ``` 2020-09-29 16:55:15,853 DEBUG [c.c.a.t.Request] (API-Job-Executor-4:ctx-4d783c5f job-55326 ctx-7d98f674) (logid:b43bbdbf) Seq 24-3700551518814994444: Received: { Ans: , MgmtId: 2482717785957, via: 24(n06.2019.cldin.net), Ver: v1, Flags: 110, { MaintainAnswer } } 2020-09-29 16:55:15,874 DEBUG [c.c.r.ResourceState] (API-Job-Executor-4:ctx-4d783c5f job-55326 ctx-7d98f674) (logid:b43bbdbf) Resource state update: [id = 24; name = n06.2019.cldin.net; old state = Enabled; event = AdminAskMaintenance; new state = PrepareForMaintenance] 2020-09-29 16:55:15,917 DEBUG [c.c.r.ResourceManagerImpl] (API-Job-Executor-4:ctx-4d783c5f job-55326 ctx-7d98f674) (logid:b43bbdbf) Sent resource event EVENT_PREPARE_MAINTENANCE_AFTER to listener CapacityManagerImpl 2020-09-29 16:55:15,950 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-4:ctx-4d783c5f job-55326) (logid:b43bbdbf) Unexpected exception while executing org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object near assword":"c*****},"resourcestate":"Prepa at com.google.gson.Streams.parse(Streams.java:51) at com.google.gson.JsonParser.parse(JsonParser.java:83) at com.google.gson.JsonParser.parse(JsonParser.java:58) at com.google.gson.JsonParser.parse(JsonParser.java:44) at com.cloud.utils.HumanReadableJson.addElement(HumanReadableJson.java:52) at com.cloud.utils.HumanReadableJson.getHumanReadableBytesJson(HumanReadableJson.java:46) at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl.convertHumanReadableJson(AsyncJobManagerImpl.java:352) at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl.completeAsyncJob(AsyncJobManagerImpl.java:262) at com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:111) at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:615) at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:48) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52) at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:45) at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:563) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object near assword":"c*****},"resourcestate":"Prepa at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1111) at com.google.gson.stream.JsonReader.nextInObject(JsonReader.java:737) at com.google.gson.stream.JsonReader.quickPeek(JsonReader.java:379) ... 24 more 2020-09-29 16:55:15,955 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-4:ctx-4d783c5f job-55326) (logid:b43bbdbf) Complete async job-55326, jobStatus: FAILED, resultCode: 530, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"530","errortext":"com.google.gson.stream.MalformedJsonException: Unterminated object near assword":"c*****},"resourcestate":"Prepa"} ``` Note that the host got in the Maintenance state as expected and the issue is related only to the response. ~~~ ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org