Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8284: Fix Jolokia discovery issues #597

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

skarsaune
Copy link
Contributor

@skarsaune skarsaune commented Oct 30, 2024

This fixes two bugs with Jolokia discovery:

  1. serious : repeated discovery runs crash. Runing repeatedly in the background is the whole point
  2. more of an annoyance: the PR disables JMC agent by omitting JVM info in the descriptor (as presence is interpreted as a local JVM)
    Both tested OK.

Progress

  • Commit message must refer to an issue
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Issue

  • JMC-8284: Fix Jolokia discovery issues (Bug - P2)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jmc.git pull/597/head:pull/597
$ git checkout pull/597

Update a local copy of the PR:
$ git checkout pull/597
$ git pull https://git.openjdk.org/jmc.git pull/597/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 597

View PR using the GUI difftool:
$ git pr show -t 597

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jmc/pull/597.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 30, 2024

👋 Welcome back skarsaune! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 30, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@skarsaune
Copy link
Contributor Author

@aptmac : Are you able to create a bug for this. Or two if that is preferrable.
Details on the bugs:

SEVERE: Cannot register MBean jolokia:type=Discovery,agent=jmc: javax.management.InstanceAlreadyExistsException: jolokia:type=Discovery,agent=jmc
javax.management.InstanceAlreadyExistsException: jolokia:type=Discovery,agent=jmc
	at java.management/com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:322)
	at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1848)
	at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:945)
	at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:880)
	at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:315)
	at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:523)
	at org.jolokia.server.core.service.impl.MBeanRegistry.registerMBeanAtServer(MBeanRegistry.java:80)
	at org.jolokia.server.core.service.impl.MBeanRegistry.registerMBean(MBeanRegistry.java:54)
	at org.jolokia.server.core.service.impl.JolokiaServiceManagerImpl.registerMBean(JolokiaServiceManagerImpl.java:409)
	at org.jolokia.server.core.service.impl.JolokiaContextImpl.registerMBean(JolokiaContextImpl.java:45)
	at org.jolokia.server.core.service.api.AbstractJolokiaService.registerJolokiaMBean(AbstractJolokiaService.java:98)
	at org.jolokia.service.discovery.JolokiaDiscovery.init(JolokiaDiscovery.java:45)
	at org.openjdk.jmc.jolokia.JolokiaDiscoveryListener.discoverJvms(JolokiaDiscoveryListener.java:70)
	at org.openjdk.jmc.jolokia.AbstractCachedDescriptorProvider$Scanner.scan(AbstractCachedDescriptorProvider.java:86)
	at org.openjdk.jmc.jolokia.AbstractCachedDescriptorProvider$Scanner.run(AbstractCachedDescriptorProvider.java:70)
	at java.base/java.lang.Thread.run(Thread.java:1583)
  1. This option does not make sense for Jolokia:
image

@aptmac
Copy link
Member

aptmac commented Oct 31, 2024

@skarsaune I've rolled both of these issues into one ticket if that's okay, I think it fits with this PR that accomplishes both at once.

https://bugs.openjdk.org/browse/JMC-8284

@skarsaune skarsaune changed the title Jolokia discovery issues JMC-8284: Fix Jolokia discovery issues Oct 31, 2024
@openjdk openjdk bot changed the title JMC-8284: Fix Jolokia discovery issues 8284: Fix Jolokia discovery issues Oct 31, 2024
@openjdk openjdk bot added the rfr label Oct 31, 2024

public JolokiaDiscoveryListener(JolokiaDiscoverySettings settings) {
this.settings = settings;
jolokiaDiscovery = new JolokiaDiscovery();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that only one instance is instantiated (linked to the lifecycle of this plugin). If one tries to instantiate another, it will attempt to register an MBean and sinply crash

@mlbridge
Copy link

mlbridge bot commented Oct 31, 2024

Webrevs

@aptmac
Copy link
Member

aptmac commented Nov 1, 2024

There's a fix to the spotbugs config that will fix the Mac tests just an fyi

@skarsaune
Copy link
Contributor Author

There's a fix to the spotbugs config that will fix the Mac tests just an fyi

Indeed, the test passed after merging in master 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants