Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347533 - File system watcher thread exits on java.lang.Error
Summary: File system watcher thread exits on java.lang.Error
Status: CLOSED FIXED
Alias: None
Product: Virgo
Classification: RT
Component: runtime (show other bugs)
Version: 2.1.1.RELEASE   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.0.0.M06   Edit
Assignee: Hristo Iliev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-27 23:29 EDT by Ryan CLA
Modified: 2011-06-03 08:26 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan CLA 2011-05-27 23:29:09 EDT
Installing a configuration artifact after installing Pax Logging causes the thread that's monitoring the pickup directory to die, and it doesn't restart.

Steps:
1) Extract Virgo Kernel 2.1.1
2) start
3) Install Pax Logging 1.6.2 via pickup directory. (First install the API, then the Service: http://wiki.ops4j.org/display/paxlogging/Pax+Logging+-+1.6.2)
4) touch pickup/foo.properties

Result:
java.lang.NoClassDefFoundError: org/osgi/service/log/LogService in the "fs-watcher" thread. Thereafter, no activity in the pickup directory is noticed until Virgo is restarted. Log excerpt follows.

[2011-05-27 22:16:02.721] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         HD0001I Hot deployer processing 'CREATED' event for file 'foo.properties'. 
[2011-05-27 22:16:02.721] fs-watcher                   o.e.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener     ApplicationDeploying path '/home/ryan/dev/tools/virgo-pax-logging-problem/pickup/foo.properties'. 
[2011-05-27 22:16:02.760] fs-watcher                   o.e.v.k.m.i.deployer.ModelInstallArtifactLifecycleListener        Processing installing event for configuration 'foo' version '0.0.0' 
[2011-05-27 22:16:02.764] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         DE0000I Installing configuration 'foo' version '0.0.0'. 
[2011-05-27 22:16:02.765] fs-watcher                   o.e.virgo.kernel.userregion.internal.quasi.DependencyCalculator   Calculating missing dependencies of bundle(s) '{}' 
[2011-05-27 22:16:02.768] fs-watcher                   o.e.virgo.kernel.userregion.internal.quasi.DependencyCalculator   The dependencies of '[]' are '[]' 
[2011-05-27 22:16:02.773] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         DE0001I Installed configuration 'foo' version '0.0.0'. 
[2011-05-27 22:16:02.775] fs-watcher                   o.e.v.k.i.a.internal.AtomicInstallArtifactLifecycleListener       No atomic parent of configuration 'foo' version '0.0.0' in scope 'null' to propagate starting event to 
[2011-05-27 22:16:02.779] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         DE0004I Starting configuration 'foo' version '0.0.0'. 
[2011-05-27 22:16:02.780] fs-watcher                   System.err                                                        Exception in thread "fs-watcher" java.lang.NoClassDefFoundError: org/osgi/service/log/LogService 
[2011-05-27 22:16:02.781] fs-watcher                   System.err                                                               at org.apache.felix.cm.impl.ConfigurationManager.log(ConfigurationManager.java:898) 
[2011-05-27 22:16:02.781] fs-watcher                   System.err                                                               at org.apache.felix.cm.impl.UpdateThread.schedule(UpdateThread.java:111) 
[2011-05-27 22:16:02.781] fs-watcher                   System.err                                                               at org.apache.felix.cm.impl.ConfigurationManager.updated(ConfigurationManager.java:571) 
[2011-05-27 22:16:02.781] fs-watcher                   System.err                                                               at org.apache.felix.cm.impl.ConfigurationImpl.update(ConfigurationImpl.java:317) 
[2011-05-27 22:16:02.781] fs-watcher                   System.err                                                               at org.apache.felix.cm.impl.ConfigurationAdapter.update(ConfigurationAdapter.java:110) 
[2011-05-27 22:16:02.781] fs-watcher                   System.err                                                               at org.eclipse.virgo.kernel.install.artifact.internal.ConfigLifecycleEngine.updateConfiguration(ConfigLifecycleEngine.java:64) 
[2011-05-27 22:16:02.781] fs-watcher                   System.err                                                               at org.eclipse.virgo.kernel.install.artifact.internal.ConfigLifecycleEngine.start(ConfigLifecycleEngine.java:40) 
[2011-05-27 22:16:02.782] fs-watcher                   System.err                                                               at org.eclipse.virgo.kernel.install.artifact.internal.ConfigInstallArtifact.doStart(ConfigInstallArtifact.java:83) 
[2011-05-27 22:16:02.782] fs-watcher                   System.err                                                               at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.driveDoStart(AbstractInstallArtifact.java:203) 
[2011-05-27 22:16:02.782] fs-watcher                   System.err                                                               at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.start(AbstractInstallArtifact.java:194) 
[2011-05-27 22:16:02.782] fs-watcher                   System.err                                                               at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.start(PipelinedApplicationDeployer.java:285) 
[2011-05-27 22:16:02.782] fs-watcher                   System.err                                                               at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.deploy(PipelinedApplicationDeployer.java:195) 
[2011-05-27 22:16:02.782] fs-watcher                   System.err                                                               at org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener.deploy(HotDeploymentFileSystemListener.java:174) 
[2011-05-27 22:16:02.782] fs-watcher                   System.err                                                               at org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener.onChange(HotDeploymentFileSystemListener.java:78) 
[2011-05-27 22:16:02.782] fs-watcher                   System.err                                                               at org.eclipse.virgo.util.io.FileSystemChecker.notifyListeners(FileSystemChecker.java:245) 
[2011-05-27 22:16:02.782] fs-watcher                   System.err                                                               at org.eclipse.virgo.util.io.FileSystemChecker.check(FileSystemChecker.java:166) 
[2011-05-27 22:16:02.782] fs-watcher                   System.err                                                               at org.eclipse.virgo.kernel.deployer.hot.WatchTask.run(WatchTask.java:58) 
[2011-05-27 22:16:02.783] fs-watcher                   System.err                                                               at java.lang.Thread.run(Thread.java:662)
Comment 1 Hristo Iliev CLA 2011-05-30 09:36:34 EDT
Pax logging registers a service with the following names:


import org.osgi.service.log.LogService
...
    private static final String[] LOGSERVICE_NAMES = {
        LogService.class.getName(),
        org.knopflerfish.service.log.LogService.class.getName(),
        PaxLoggingService.class.getName(),
        ManagedService.class.getName()
    };
...
        // register the Pax Logging service
        PaxLoggingServiceImpl paxLogging = new PaxLoggingServiceImpl( bundleContext, logReader, m_eventAdmin );
        Hashtable serviceProperties = new Hashtable();
        serviceProperties.put( Constants.SERVICE_ID, "org.ops4j.pax.logging.configuration" );
        serviceProperties.put( Constants.SERVICE_PID, CONFIGURATION_PID );
        m_RegistrationPaxLogging = bundleContext.registerService( LOGSERVICE_NAMES, paxLogging, serviceProperties );

It seems like "org.osgi.service.log.LogService" causes the NoClassDef.
Comment 2 Hristo Iliev CLA 2011-05-31 10:04:44 EDT
The issue is not reproducible on 3.0M04, but on 2.1.1 (as reported) it can be reproduced on Windows and Linux even after restart (no -clean).
Comment 3 Hristo Iliev CLA 2011-05-31 10:20:27 EDT
Updating Apache Felix ConfigAdmin to 1.2.8 fixed the problem
Comment 4 Ryan CLA 2011-05-31 10:50:00 EDT
(In reply to comment #3)
> Updating Apache Felix ConfigAdmin to 1.2.8 fixed the problem

Cool. Would I replace the one in repository/ext, in lib/kernel, or both. I only generally know what ConfigAdmin is. Why is it both places?

Also, it seems there should be some better exception handling around the fs-thread to keep it from dying on stray exceptions like this.
Comment 5 Hristo Iliev CLA 2011-05-31 11:08:30 EDT
I replaced just the classes in ConfigAdmin JAR with the ones from 1.2.8, so I didn't have to adapt the bundle manifests.

I guess that replacing the classes in both lib and repository/ext should provide you with a quick workaround.
Comment 6 Glyn Normington CLA 2011-06-01 05:53:07 EDT
Please note that we have switched to Equinox Config Admin in the 3.0 line, which is presumably why the problem does not recreate there.

I don't think there's much need to fix 2.1.x given that there is a relatively straightforward workaround.

So perhaps we should use this bug to beef up the fs watcher thread exception handling, in which case we should change the bug title appropriately.

Hristo: wdyt since the bug is currently yours?
Comment 7 Hristo Iliev CLA 2011-06-01 10:23:19 EDT
The problem with the watcher thread seems to be that it handles only Exceptions, while we have Error here.
Comment 8 Hristo Iliev CLA 2011-06-01 12:23:10 EDT
Commit 1f9341d18c38a798879a7f5d4ffcf2c46bc324de will no longer allow listeners to interrupt artifact scanning in FileSystemChecker
Comment 9 Hristo Iliev CLA 2011-06-02 02:05:30 EDT
Commit 5813b337159873f5c6cea936f7279c2335dcedfd improves the exception handling of WatchTask
Comment 10 Hristo Iliev CLA 2011-06-03 08:25:40 EDT
File system watcher thread is now better protected against exception/errors. The fix should appear in 3.0.0.M06, while for 2.1.1 one can workaround the issue by updating Apache Felix ConfigAdmin.