[GLASSFISH-20498] Monitoring: misleading message or failure to register probe misses important data Created: 10/May/13  Updated: 21/Sep/15

Status: Open
Project: glassfish
Component/s: monitoring
Affects Version/s: 4.0_b88_RC4
Fix Version/s: 4.1.1

Type: Bug Priority: Major
Reporter: marina vatkina Assignee: Byron Nevins
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

See GLASSFISH-19677 - the failed probe registration reports the probe class, not the actual failure:

WARNING: MNTG0201:Flashlight listener registration failed for listener class : com.sun.ejb.monitoring.stats.StatelessSessionBeanStatsProvider , will retry later

The actual cause is available only at FINE level:

FINE: Listener registration failed
java.lang.RuntimeException: Probe is not yet registered: glassfish:ejb:bean_null_MonTest_TestBean:methodEndEvent

But the actual probes are registered fine...



 Comments   
Comment by Terry2013 [ 31/Dec/14 ]

Hi Romain , Marina
I have reproduced the issue on the latest GlssfishV4.
I investigated a bit of source code , and found the logic in ejb-container is very odd.

com.sun.ejb.containers.BaseContainer
protected void createMonitoringRegistry() {
            //Please disregard the above code

            ejbProbeListener = getMonitoringStatsProvider(appName, modName, ejbName);
            ejbProbeListener.addMethods(getContainerId(), appName, modName, ejbName, getMonitoringMethodsArray());
            ejbProbeListener.register();★1

            if (_logger.isLoggable(Level.FINE)) {
	        _logger.log(Level.FINE, "Created MonitoringRegistry: " + 
                        EjbMonitoringUtils.getDetailedLoggingName(appName, modName, ejbName));
            }
	} catch (Exception ex) {
	    _logger.log(Level.SEVERE, COULD_NOT_CREATE_MONITORREGISTRYMEDIATOR, new Object[]{EjbMonitoringUtils.getDetailedLoggingName(appName, modName, ejbName), ex});
	}

        // Always create to avoid NPE
        try {
            ProbeProviderFactory probeFactory = ejbContainerUtilImpl.getProbeProviderFactory();
            String invokerId = EjbMonitoringUtils.getInvokerId(appName, modName, ejbName);
            ejbProbeNotifier = probeFactory.getProbeProvider(EjbMonitoringProbeProvider.class, invokerId);★2
            if (_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, "Got ProbeProvider: " + ejbProbeNotifier.getClass().getName());
            }
        } catch (Exception ex) {
            ejbProbeNotifier = new EjbMonitoringProbeProvider();
            if (_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, "Error getting the EjbMonitoringProbeProvider");
            }
        }

    }

In my understanding , Monitoring in GlassFish V4 need to register ProbeProvider and StatsProvider.
And StatProvider depend on ProbeProvider.So I think StatProvider's registration need after ProbeProvider's.
But in ejb container , StatProvider's registration (★1) is before ProbeProvider's(★2).
So the MNTG0201 message is output .

By the way,After I change ProbeProvider and ProbeProvider registration order, the MNTG0201 message is not output .

Comment by lzg5039 [ 20/Jan/15 ]

Hi Romain , Marina ,Terry2013

there is same probelm in the com.sun.ejb.containers.StatefulSessionContainer.registerMonitorableComponents
★2 order to register before ★1

 protected void registerMonitorableComponents() {
        super.registerMonitorableComponents();
        cacheProbeListener = new EjbCacheStatsProvider(sessionBeanCache,
                getContainerId(), containerInfo.appName, containerInfo.modName,
                containerInfo.ejbName);
        cacheProbeListener.register();★1

        try {
            ProbeProviderFactory probeFactory = ejbContainerUtilImpl.getProbeProviderFactory();
            String invokerId = EjbMonitoringUtils.getInvokerId(containerInfo.appName,
                    containerInfo.modName, containerInfo.ejbName);
            cacheProbeNotifier = probeFactory.getProbeProvider(EjbCacheProbeProvider.class, invokerId);★2
            if (_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, "Got ProbeProvider: " + cacheProbeNotifier.getClass().getName());
            }
        } catch (Exception ex) {
            cacheProbeNotifier = new EjbCacheProbeProvider();
            if (_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, "Error getting the EjbMonitoringProbeProvider");
            }
        }

        if (isHAEnabled) {
            sfsbStoreMonitor = new HAStatefulSessionStoreMonitor();
        } else {
            sfsbStoreMonitor = new StatefulSessionStoreMonitor();
        }
        sessionBeanCache.setStatefulSessionStoreMonitor(sfsbStoreMonitor);
        _logger.log(Level.FINE, "[SFSBContainer] registered monitorable");
    }

There is an another problem in the org.glassfish.persistence.ejb.entitybean.container.registerMonitorableComponents.
There is not EjbCacheProbeProvider in the registerMonitorableComponents(),but EjbCacheStatsProvider depends on the EjbCacheProbeProvider .
So I think it needs to register EjbCacheProbeProvider before ★1.

  protected void registerMonitorableComponents() {
        super.registerMonitorableComponents();
	if (readyStore != null) {
	    int confMaxCacheSize = cacheProp.maxCacheSize;
	    if (confMaxCacheSize <= 0) {
		confMaxCacheSize = Integer.MAX_VALUE;
	    }
	    this.cacheStatsProvider = new EntityCacheStatsProvider(
		    (BaseCache) readyStore, confMaxCacheSize);
	    //registryMediator.registerProvider(cacheStatsProvider);
            cacheProbeListener = new EjbCacheStatsProvider(cacheStatsProvider,
                    getContainerId(), containerInfo.appName, containerInfo.modName,
                    containerInfo.ejbName);
            cacheProbeListener.register();★1
	}
        poolProbeListener = new EjbPoolStatsProvider(entityCtxPool, 
                getContainerId(), containerInfo.appName, containerInfo.modName,
                containerInfo.ejbName);
        poolProbeListener.register();
        _logger.log(Level.FINE, "[Entity Container] registered monitorable");
    }

Generated at Sun Dec 11 01:37:33 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.