RADAR-base/RADAR-Backend

SourceStatisticsMonitor fails upon restart

nivemaham opened this issue · 4 comments

SourceStatisticsMonitor fails to restart with following exception.

radar-backend-monitor_1        | [2018-02-27 14:07:08 UTC]  INFO [pool-2-thread-4] (AppInfoParser.java:84) - Kafka commitId : 73be1e1168f91ee2 (org.apache.kafka.common.utils.AppInfoParser)
radar-backend-monitor_1        | [2018-02-27 14:07:08 UTC]  WARN [pool-2-thread-4] (AppInfoParser.java:60) - Error registering AppInfo mbean (org.apache.kafka.common.utils.AppInfoParser)
radar-backend-monitor_1        | javax.management.InstanceAlreadyExistsException: kafka.consumer:type=app-info,id=org.radarcns.monitor.SourceStatisticsMonitor-1
radar-backend-monitor_1        | 	at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
radar-backend-monitor_1        | 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
radar-backend-monitor_1        | 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
radar-backend-monitor_1        | 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
radar-backend-monitor_1        | 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
radar-backend-monitor_1        | 	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
radar-backend-monitor_1        | 	at org.apache.kafka.common.utils.AppInfoParser.registerAppInfo(AppInfoParser.java:58)
radar-backend-monitor_1        | 	at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:757)
radar-backend-monitor_1        | 	at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:633)
radar-backend-monitor_1        | 	at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:615)
radar-backend-monitor_1        | 	at org.radarcns.monitor.AbstractKafkaMonitor.start(AbstractKafkaMonitor.java:159)
radar-backend-monitor_1        | 	at org.radarcns.monitor.SourceStatisticsMonitor.start(SourceStatisticsMonitor.java:91)
radar-backend-monitor_1        | 	at org.radarcns.monitor.CombinedKafkaMonitor.lambda$start$0(CombinedKafkaMonitor.java:83)
radar-backend-monitor_1        | 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
radar-backend-monitor_1        | 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
radar-backend-monitor_1        | 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
radar-backend-monitor_1        | 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
radar-backend-monitor_1        | 	at java.lang.Thread.run(Thread.java:745)

Should be fixed with c3c288b.

Different threads of the stream should have a different client id-
Here-

"Source statistics monitor must have a name"), "1",

It should not always be "1"

Thanks for the quick fix @blootsvoets . I was thinking can't we pass a random value like a UUID or something, instead of fixed value?

Reopening this since still getting the error after a recreate of the monitor container -

[2018-06-12 13:42:29 UTC]  INFO [pool-2-thread-3] (AppInfoParser.java:83) - Kafka version : 0.11.0.2 (org.apache.kafka.common.utils.AppInfoParser)
[2018-06-12 13:42:29 UTC]  INFO [pool-2-thread-3] (AppInfoParser.java:84) - Kafka commitId : 73be1e1168f91ee2 (org.apache.kafka.common.utils.AppInfoParser)
[2018-06-12 13:42:29 UTC]  WARN [pool-2-thread-3] (AppInfoParser.java:60) - Error registering AppInfo mbean (org.apache.kafka.common.utils.AppInfoParser)
javax.management.InstanceAlreadyExistsException: kafka.consumer:type=app-info,id=org.radarcns.monitor.SourceStatisticsMonitor-1-source_statistics_android_phone
	at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
	at org.apache.kafka.common.utils.AppInfoParser.registerAppInfo(AppInfoParser.java:58)
	at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:757)
	at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:633)
	at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:615)
	at org.radarcns.monitor.AbstractKafkaMonitor.handleSerializationException(AbstractKafkaMonitor.java:202)
	at org.radarcns.monitor.AbstractKafkaMonitor.start(AbstractKafkaMonitor.java:173)
	at org.radarcns.monitor.SourceStatisticsMonitor.start(SourceStatisticsMonitor.java:92)
	at org.radarcns.monitor.CombinedKafkaMonitor.lambda$start$0(CombinedKafkaMonitor.java:83)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

As nivethika suggested, its a good idea to have a UUID in place to avoid this.