Got a SDK Exception on deployed tenant logs related to microservice subscription. What do they mean?

Product/components used and version/fix level:

Cumulocity Production

Detailed explanation of the problem:

Hi, I am getting this error on some of my services. I got a couple of alarms that my service is unhealthy and then What does this mean?

2023-10-12 05:15:12.256 ERROR 1 --- [subscriptions-0] .s.s.i.MicroserviceSubscriptionScheduler : Error while reacting on microservice subscription

 

com.cumulocity.sdk.client.SDKException: Error invoking GET http://cumulocity:8111/application/currentApplication
	at com.cumulocity.microservice.subscription.repository.impl.CurrentMicroserviceRepository.handleException(CurrentMicroserviceRepository.java:101) ~[microservice-subscription-1016.0.264.jar!/:na]
	at com.cumulocity.microservice.subscription.repository.impl.CurrentMicroserviceRepository.getCurrentApplication(CurrentMicroserviceRepository.java:65) ~[microservice-subscription-1016.0.264.jar!/:na]
	at com.cumulocity.microservice.subscription.repository.impl.CurrentMicroserviceRepository.register(CurrentMicroserviceRepository.java:42) ~[microservice-subscription-1016.0.264.jar!/:na]
	at com.cumulocity.microservice.subscription.repository.impl.CurrentMicroserviceRepository.register(CurrentMicroserviceRepository.java:57) ~[microservice-subscription-1016.0.264.jar!/:na]
	at com.cumulocity.microservice.subscription.repository.MicroserviceSubscriptionsRepository.register(MicroserviceSubscriptionsRepository.java:110) ~[microservice-subscription-1016.0.264.jar!/:na]
	at com.cumulocity.microservice.subscription.service.impl.MicroserviceSubscriptionsServiceImpl.registerApplication(MicroserviceSubscriptionsServiceImpl.java:169) ~[microservice-subscription-1016.0.264.jar!/:na]
	at com.cumulocity.microservice.subscription.service.impl.MicroserviceSubscriptionsServiceImpl.subscribe(MicroserviceSubscriptionsServiceImpl.java:114) ~[microservice-subscription-1016.0.264.jar!/:na]
	at com.cumulocity.microservice.subscription.service.impl.MicroserviceSubscriptionScheduler.lambda$schedulePeriodicSubscription$0(MicroserviceSubscriptionScheduler.java:81) ~[microservice-subscription-1016.0.264.jar!/:na]
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na]
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Caused by: com.cumulocity.sdk.client.SDKException: Http status code: 502
Something went wrong. Failed to parse error message.
tenant: t173516 user: servicebootstrap-service
	at com.cumulocity.sdk.client.ResponseParser.checkStatus(ResponseParser.java:81) ~[java-client-1016.0.264.jar!/:na]
	at com.cumulocity.sdk.client.ResponseParser.parse(ResponseParser.java:63) ~[java-client-1016.0.264.jar!/:na]
	at com.cumulocity.sdk.client.RestConnector.get(RestConnector.java:118) ~[java-client-1016.0.264.jar!/:na]
	at com.cumulocity.microservice.subscription.repository.application.CurrentApplicationApi.get(CurrentApplicationApi.java:22) ~[microservice-subscription-1016.0.264.jar!/:na]
	at com.cumulocity.microservice.subscription.repository.impl.CurrentMicroserviceRepository.getCurrentApplication(CurrentMicroserviceRepository.java:63) ~[microservice-subscription-1016.0.264.jar!/:na]
	... 12 common frames omitted

Please let me know whats the issue?

Thanks,
Samanyu

1 Like

5xx errors retrieved from Cumulocity Core API indicate that something is wrong with the platform.
502 means that the load balancer could not forward the message to the core.
Most likely this is resolved after some short time. You can handle that by catching SDK Exception with status code 502 and implement a retry pattern for important stuff.
That’s the only thing you can do about it. If the 5xx error persist even after minutes/hours you should create an issue in our support system because it could be that some load balancer are misconfigured or a core in the cluster is not reachable any more and must be restarted.

2 Likes

Okay Thanks, will monitor and update if any issue occurs. :slight_smile:

Hi Stefan,

I just wanted to highlight a few things. Let me know if these contribute to the error that I highlighted in this post. My microservice config is set like CPU as 1 and memory as 512 M. Also my service is set as a multi-tenant.

Could you please guide me on the same?

Thanks,
Samanyu

1 Like

Hi @Sam123 ,

the local resources of your microservice (like CPU cores and memory) don’t have any impact to the 5xx errors. Same for the isolation level.
They only impact if you see your microservice crashing or restarting due to OOM-errors.

What could contribute are the number of requests the microservice is sending to the platform. If you send 1000 of them at the same time this could impact the platform responding with 5xx errors sporadically (throttling your client) but normally even this should be handled well by the load balancers and multiple core nodes processing them.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.