Found the answer: (may be for archive)

don't start felix with the same config twice...

accidentially this happend to me and explains all the upcoming problems.

I hope I didn't spam to much ;-)

regards
Matthias




Am 20.10.2009 um 12:27 schrieb Matthias Neubert:

And again..

I found out that fileinstall is running in 2 threads parallel . I guess this causes all the problems.

My thread are:

3       6595    wait    98      72      main    
*5      6596    vmwait  17      43      HeapWorker      
*7      6597    vmwait  0       0       Signal Catcher  
*9      6598    running 3       13      JDWP    
11      6599    native  0       0       Binder Thread #1        
13      6600    native  0       0       Binder Thread #2        
15      6601    native  0       0       Binder Thread #3        
21 6618 timed-wait 584 78 {felix.fileinstall.poll=3000, felix.fileinstall.dir=/sdcard/FelixOSGiBundles, felix.fileinstall.tmpdir=/data/data/de.mnsoft.
23      6605    wait    1       4       FelixDispatchQueue      
*25     6606    wait    383     51      FelixStartLevel 
*27     6607    wait    379     42      FelixStartLevel 
*29     6608    wait    0       0       FelixPackageAdmin       
*31     6609    wait    0       0       FelixPackageAdmin       
33      6611    wait    588     50      Thread-17       
35      6613    wait    1006    89      Thread-18       
37 6616 timed-wait 709 91 {felix.fileinstall.poll=3000, felix.fileinstall.dir=/sdcard/FelixOSGiBundles, felix.fileinstall.tmpdir=/data/data/de.mnsoft.

So we havle filistall, felixstartlevel and felixpackageadmin twice.

The big question is: Why?

My BasicBundleLoader (=a BundleActivator) looks like this:

public void start(BundleContext arg0) throws Exception {
                
try{
URL url = new URL("file://"+globalapp.basicBundleAbsPath+"/ ipojo140.jar");
        Bundle ipojo = arg0.installBundle(url.toString(), url.openStream());
...
ipojo.start();
...



Its started at felix start up like this:

m_BasicBundleLoader = new BasicBundleLoader(m_globalapp);
                        
// make list of Autostarted BundleActivators
List<BundleActivator> autoStartActivatorList = new ArrayList<BundleActivator>();
// we load BasicBundleLoader, which then will load the rest
autoStartActivatorList.add(m_BasicBundleLoader);
// add list of activators which shall be started with system bundle to felix config m_FelixProperties.put("felix.systembundle.activators", autoStartActivatorList);


Why felix does this twice?


hoping someone has a hint
Matthias



Am 20.10.2009 um 11:22 schrieb Matthias Neubert:

Hello again ;-)


One thing came to mind: it may be, that fileinstall is installed and started twice, since my Basic Bundle Loader (starts with framework, loads bundls like iPOJO and Fileinstall) gets instanciated and started twice (and I don't know why, he's only added to an activators list and started an framework start using "felix.systembundle.activators")

this may be the original problem. But is this possible? How to check if this happens? When I list all bundles, fileinstall is only shown one time.

I still don't have an idea how to solute this problem.

regards
matthias



Am 20.10.2009 um 10:58 schrieb Matthias Neubert:

Hello,

I suffer from a problem I found using FileInstall 2.0.0 on Felix 2.0.0

When I use my GUI to delete a Jar file in the fileinstall-watched directory, fileinstall tries 2 times nearly at the same time (milliseconds - to seconds) to uninstall the bundle.
This happens always and I always get to same errors:

10-20 10:28:26.325: INFO/System.out(4989): Uninstalled /sdcard/ FelixOSGiBundles/de.mnsoft.mapservice.layer1.qypeimpl_1.0.0.jar

10-20 10:28:30.425: INFO/System.out(4989): ERROR: org.apache.felix.framework.cache.BundleArchive: Unable to record state - java.io.FileNotFoundException: /data/data/ de.mnsoft.felixhostapp/files/felix/cache/bundle20/bundle.state 10-20 10:28:30.435: INFO/System.out(4989): ERROR: Error writing persistent state to bundle archive. (java.io.FileNotFoundException: /data/data/de.mnsoft.felixhostapp/ files/felix/cache/bundle20/bundle.state)

10-20 10:28:30.435: WARN/System.err(4989): java.io.FileNotFoundException: /data/data/de.mnsoft.felixhostapp/ files/felix/cache/bundle20/bundle.state 10-20 10:28:30.435: WARN/System.err(4989): at org .apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java: 231) 10-20 10:28:30.435: WARN/System.err(4989): at java.io.FileOutputStream.<init>(FileOutputStream.java:96) 10-20 10:28:30.435: WARN/System.err(4989): at java.io.FileOutputStream.<init>(FileOutputStream.java:69) 10-20 10:28:30.435: WARN/System.err(4989): at org .apache .felix .framework.util.SecureAction.getFileOutputStream(SecureAction.java: 440) 10-20 10:28:30.435: WARN/System.err(4989): at org .apache .felix .framework .cache.BundleArchive.setPersistentState(BundleArchive.java:361) 10-20 10:28:30.445: WARN/System.err(4989): at org .apache .felix .framework .BundleImpl.setPersistentStateUninstalled(BundleImpl.java:760) 10-20 10:28:30.445: WARN/System.err(4989): at org.apache.felix.framework.Felix.uninstallBundle(Felix.java:2197) 10-20 10:28:30.445: WARN/System.err(4989): at org.apache.felix.framework.BundleImpl.uninstall(BundleImpl.java:950) 10-20 10:28:30.445: WARN/System.err(4989): at org .apache .felix .fileinstall .internal.DirectoryWatcher.uninstall(DirectoryWatcher.java:724) 10-20 10:28:30.445: WARN/System.err(4989): at org .apache .felix .fileinstall .internal.DirectoryWatcher.uninstall(DirectoryWatcher.java:600) 10-20 10:28:30.445: WARN/System.err(4989): at org .apache .felix .fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java: 285)

10-20 10:28:30.445: INFO/System.out(4989): ERROR: org.apache.felix.framework.cache.BundleArchive: Unable to record last modification time - java.io.FileNotFoundException: /data/data/ de.mnsoft.felixhostapp/files/felix/cache/bundle20/ bundle.lastmodified

10-20 10:28:30.455: INFO/System.out(4989): ERROR: Error writing last modification time to bundle archive. (java.io.FileNotFoundException: /data/data/de.mnsoft.felixhostapp/ files/felix/cache/bundle20/bundle.lastmodified) 10-20 10:28:30.455: WARN/System.err(4989): java.io.FileNotFoundException: /data/data/de.mnsoft.felixhostapp/ files/felix/cache/bundle20/bundle.lastmodified 10-20 10:28:30.455: WARN/System.err(4989): at org .apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java: 231) 10-20 10:28:30.455: WARN/System.err(4989): at java.io.FileOutputStream.<init>(FileOutputStream.java:96) 10-20 10:28:30.455: WARN/System.err(4989): at java.io.FileOutputStream.<init>(FileOutputStream.java:69) 10-20 10:28:30.455: WARN/System.err(4989): at org .apache .felix .framework.util.SecureAction.getFileOutputStream(SecureAction.java: 440) 10-20 10:28:30.455: WARN/System.err(4989): at org .apache .felix .framework.cache.BundleArchive.setLastModified(BundleArchive.java: 532) 10-20 10:28:30.465: WARN/System.err(4989): at org .apache.felix.framework.BundleImpl.setLastModified(BundleImpl.java: 486) 10-20 10:28:30.465: WARN/System.err(4989): at org.apache.felix.framework.Felix.uninstallBundle(Felix.java:2219) 10-20 10:28:30.465: WARN/System.err(4989): at org.apache.felix.framework.BundleImpl.uninstall(BundleImpl.java:950) 10-20 10:28:30.465: WARN/System.err(4989): at org .apache .felix .fileinstall .internal.DirectoryWatcher.uninstall(DirectoryWatcher.java:724) 10-20 10:28:30.465: WARN/System.err(4989): at org .apache .felix .fileinstall .internal.DirectoryWatcher.uninstall(DirectoryWatcher.java:600) 10-20 10:28:30.475: WARN/System.err(4989): at org .apache .felix .fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java: 285)

10-20 10:28:30.485: INFO/System.out(4989): Uninstalled /sdcard/ FelixOSGiBundles/de.mnsoft.mapservice.layer1.qypeimpl_1.0.0.jar



It seems that the first "pass" removes the directory in cache directory, and the second "pass" tries to write into the gone directory.(which causes error)

BUT: the bundle is uninstalled (and deleted from watched dir)


When I try to reinstall the same bundle (e.g. copy the jar file again into watched dir) I also get errors:

10-20 10:40:46.735: INFO/System.out(4989): ERROR: org.apache.felix.framework.cache.JarRevision: Unable to create revision directory. 10-20 10:40:46.735: INFO/System.out(4989): ERROR: Unable to update the bundle. (java.io.IOException: Unable to create archive directory.) 10-20 10:40:46.735: WARN/System.err(4989): java.io.IOException: Unable to create archive directory. 10-20 10:40:46.735: WARN/System.err(4989): at org .apache .felix.framework.cache.JarRevision.initialize(JarRevision.java:141) 10-20 10:40:46.745: WARN/System.err(4989): at org .apache.felix.framework.cache.JarRevision.<init>(JarRevision.java: 79) 10-20 10:40:46.745: WARN/System.err(4989): at org .apache .felix .framework .cache.BundleArchive.createRevisionFromLocation(BundleArchive.java: 998) 10-20 10:40:46.745: WARN/System.err(4989): at org .apache .felix.framework.cache.BundleArchive.revise(BundleArchive.java:629) 10-20 10:40:46.745: WARN/System.err(4989): at org.apache.felix.framework.BundleImpl.revise(BundleImpl.java:1043) 10-20 10:40:46.745: WARN/System.err(4989): at org.apache.felix.framework.Felix.updateBundle(Felix.java:1835) 10-20 10:40:46.745: WARN/System.err(4989): at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:908) 10-20 10:40:47.105: DEBUG/dalvikvm(4989): GC freed 45351 objects / 2138144 bytes in 359ms 10-20 10:40:47.105: WARN/System.err(4989): at org .apache .felix .fileinstall .internal.DirectoryWatcher.update(DirectoryWatcher.java:762) 10-20 10:40:47.105: WARN/System.err(4989): at org .apache .felix .fileinstall .internal.DirectoryWatcher.update(DirectoryWatcher.java:621) 10-20 10:40:47.105: WARN/System.err(4989): at org .apache .felix .fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java: 286)

10-20 10:40:47.125: INFO/System.out(4989): Failed to update artifact /sdcard/FelixOSGiBundles/ de.mnsoft.mapservice.layer3.qypeimpl_1.0.0.jar: org.osgi.framework.BundleException: Update of bundle de.mnsoft.mapservice.layer3.qypeimpl [24] failed. 10-20 10:40:47.145: INFO/System.out(4989): org.osgi.framework.BundleException: Update of bundle de.mnsoft.mapservice.layer3.qypeimpl [24] failed. 10-20 10:40:47.145: INFO/System.out(4989): at org.apache.felix.framework.Felix.updateBundle(Felix.java:1966) 10-20 10:40:47.145: INFO/System.out(4989): at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:908) 10-20 10:40:47.155: INFO/System.out(4989): at org .apache .felix .fileinstall .internal.DirectoryWatcher.update(DirectoryWatcher.java:762) 10-20 10:40:47.155: INFO/System.out(4989): at org .apache .felix .fileinstall .internal.DirectoryWatcher.update(DirectoryWatcher.java:621) 10-20 10:40:47.155: INFO/System.out(4989): at org .apache .felix .fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java: 286) 10-20 10:40:47.155: INFO/System.out(4989): Caused by: java.io.IOException: Unable to create archive directory. 10-20 10:40:47.155: INFO/System.out(4989): at org .apache .felix.framework.cache.JarRevision.initialize(JarRevision.java:141) 10-20 10:40:47.155: INFO/System.out(4989): at org .apache.felix.framework.cache.JarRevision.<init>(JarRevision.java: 79) 10-20 10:40:47.155: INFO/System.out(4989): at org .apache .felix .framework .cache.BundleArchive.createRevisionFromLocation(BundleArchive.java: 998) 10-20 10:40:47.165: INFO/System.out(4989): at org .apache .felix.framework.cache.BundleArchive.revise(BundleArchive.java:629) 10-20 10:40:47.165: INFO/System.out(4989): at org.apache.felix.framework.BundleImpl.revise(BundleImpl.java:1043) 10-20 10:40:47.165: INFO/System.out(4989): at org.apache.felix.framework.Felix.updateBundle(Felix.java:1835)
10-20 10:40:47.165: INFO/System.out(4989):     ... 4 more


Then he installs the bundle new which then works. I don't know if this behavior is wanted by the author. I have got a simular "double execution problem" with an Bundle- installing and starting activator which is loaded ate framework startup (using "felix.systembundle.activators") If I avoid the double start in my Loader-Activator the Bundles aren't installed. If I allow it, *sometimes* I receive error about that he could not read the jar file.

For me all this sounds like threading problems. Usually there are only millisoconds or max. 3-4 seconds between this strange double- calls.



Does someone know abaout this behavior or knows how to avoid that it occurs?



regards
Matthias


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to