cats-effect icon indicating copy to clipboard operation
cats-effect copied to clipboard

Warning about starvation MBean with sequential runs in SBT

Open hejfelix opened this issue 2 years ago • 0 comments

When running a cats-effect app multiple times in the same shell, I get the warning below. Setting fork := true solves it, but I had to go to discord for this tip.

[WARNING] Failed to register Cats Effect CPU starvation MBean, proceeding with
no-operation versions. You will not see MBean metrics for CPU starvation.
Exception follows:
 javax.management.InstanceAlreadyExistsException: cats.effect.metrics:type=CpuStarvation
    at java.management/com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:436)
    at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1865)
    at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:960)
    at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:895)
    at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:320)
    at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:523)
    at main$ @ main.Main$.main(Main.scala:9)
    at main$ @ main.Main$.main(Main.scala:9)
    at main$ @ main.Main$.main(Main.scala:9)
    at main$ @ main.Main$.main(Main.scala:9)
    at main$ @ main.Main$.main(Main.scala:9)

Suggestion: Improve error message to hint that you might need fork := true

hejfelix avatar Sep 26 '23 07:09 hejfelix