[jira] Commented: (FELIX-733) Exception when uninstalling a bundle that contains a native library (and loaded it at bundle startup).

2009-03-04 Thread Karl Pauls (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678744#action_12678744
 ] 

Karl Pauls commented on FELIX-733:
--

Can you try with the current trunk and see whether you still have this issue?

> Exception when uninstalling a bundle that contains a native library (and 
> loaded it at bundle startup).
> --
>
> Key: FELIX-733
> URL: https://issues.apache.org/jira/browse/FELIX-733
> Project: Felix
>  Issue Type: Improvement
>  Components: Framework
> Environment: WinXP, eclipse, sun jdk 1.5 or 1.6
>Reporter: Sylvain MARIE
>Assignee: Karl Pauls
>Priority: Minor
> Attachments: native.patch, native2.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Here is a short description of the problem and how I managed to fix it. Don't 
> hesitate to contact me for details
> or to tell me if something here is wrong ! Cheers. Sylvain.
> 1- bundle "foo" embeds a native library "lib.dll" and declares it in its 
> manifest, with appropriate platform declaration (os, version, processor).
> 2- foo's activator loads that library in the start(bc) method - with 
> System.loadLibrary(...).
> 3- the library loads succesfully (this can be checked with e.g. 
> processExplorer or pmap)
> 4- the bundle is stopped.
> 5- the bundle is uninstalled. 
> > ERROR: org.apache.felix.framework.cache.BundleArchive: Unable to delete 
> > archive directory
> Why does this happen :
> - step 4: the library is not unloaded because foo's contentclassloader is 
> still alive. This is normal.
> - step 5: automatic package refresh : all bundles from uninstalled list are 
> garbaged. Method 
> Felix.garbageCollectBundle attemps to remove the bundle archive from the 
> cache, but
> the dll file is still in use => ERROR. The dll is still in use because foo's 
> contentclassloader has not yet
> been garbaged out.
> How to fix this:  
> 
> We need the ContentClassLoader to be garbaged out. So first release all
> references to foo's activator, then release all references to the 
> ContentClassLoader itself,
> and finally do a System.gc() before attempting to remove the bundle from the 
> cache.
> Two methods are impacted: ContentLoaderImpl.close() and 
> Felix.garbageCollectBundle(...)
> ContentLoaderImpl.java
> ---
> public synchronized void close()
> {
> ...
> ...
> 
> // FIX SMA : release content class loader
> m_classLoader = null;
> }
> Felix.java
> -
> private void garbageCollectBundle(FelixBundle bundle) throws Exception
> {
>   
> 
> 
> // FIX SMA : release reference to the activator
> bundle.getInfo().setActivator(null);
> 
> // Do the garbage collection either systematically, or only if native 
> libraries were loaded, or ... 
> System.gc(); // this destroys the activator, the contentclassloader, 
> and unloads the dll.
> // end FIX SMA
> 
> // Remove the bundle from the cache.
> m_cache.remove(m_cache.getArchive(bundle.getBundleId()));
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (FELIX-733) Exception when uninstalling a bundle that contains a native library (and loaded it at bundle startup).

2009-02-27 Thread Vincent ASTRUC (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677364#action_12677364
 ] 

Vincent ASTRUC commented on FELIX-733:
--

I have the same problem, i use felix 1.4.1
In the memory profiler all objects "enum" stay in the memory.

> Exception when uninstalling a bundle that contains a native library (and 
> loaded it at bundle startup).
> --
>
> Key: FELIX-733
> URL: https://issues.apache.org/jira/browse/FELIX-733
> Project: Felix
>  Issue Type: Improvement
>  Components: Framework
> Environment: WinXP, eclipse, sun jdk 1.5 or 1.6
>Reporter: Sylvain MARIE
>Assignee: Karl Pauls
>Priority: Minor
> Attachments: native.patch, native2.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Here is a short description of the problem and how I managed to fix it. Don't 
> hesitate to contact me for details
> or to tell me if something here is wrong ! Cheers. Sylvain.
> 1- bundle "foo" embeds a native library "lib.dll" and declares it in its 
> manifest, with appropriate platform declaration (os, version, processor).
> 2- foo's activator loads that library in the start(bc) method - with 
> System.loadLibrary(...).
> 3- the library loads succesfully (this can be checked with e.g. 
> processExplorer or pmap)
> 4- the bundle is stopped.
> 5- the bundle is uninstalled. 
> > ERROR: org.apache.felix.framework.cache.BundleArchive: Unable to delete 
> > archive directory
> Why does this happen :
> - step 4: the library is not unloaded because foo's contentclassloader is 
> still alive. This is normal.
> - step 5: automatic package refresh : all bundles from uninstalled list are 
> garbaged. Method 
> Felix.garbageCollectBundle attemps to remove the bundle archive from the 
> cache, but
> the dll file is still in use => ERROR. The dll is still in use because foo's 
> contentclassloader has not yet
> been garbaged out.
> How to fix this:  
> 
> We need the ContentClassLoader to be garbaged out. So first release all
> references to foo's activator, then release all references to the 
> ContentClassLoader itself,
> and finally do a System.gc() before attempting to remove the bundle from the 
> cache.
> Two methods are impacted: ContentLoaderImpl.close() and 
> Felix.garbageCollectBundle(...)
> ContentLoaderImpl.java
> ---
> public synchronized void close()
> {
> ...
> ...
> 
> // FIX SMA : release content class loader
> m_classLoader = null;
> }
> Felix.java
> -
> private void garbageCollectBundle(FelixBundle bundle) throws Exception
> {
>   
> 
> 
> // FIX SMA : release reference to the activator
> bundle.getInfo().setActivator(null);
> 
> // Do the garbage collection either systematically, or only if native 
> libraries were loaded, or ... 
> System.gc(); // this destroys the activator, the contentclassloader, 
> and unloads the dll.
> // end FIX SMA
> 
> // Remove the bundle from the cache.
> m_cache.remove(m_cache.getArchive(bundle.getBundleId()));
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (FELIX-733) Exception when uninstalling a bundle that contains a native library (and loaded it at bundle startup).

2008-10-13 Thread Sylvain MARIE (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639060#action_12639060
 ] 

Sylvain MARIE commented on FELIX-733:
-

This works perfectly : I can now install, start, update, uninstall a 
DLL-loading bundle without any trouble. The DLL is correctly unloaded.
Thanks Karl.

> Exception when uninstalling a bundle that contains a native library (and 
> loaded it at bundle startup).
> --
>
> Key: FELIX-733
> URL: https://issues.apache.org/jira/browse/FELIX-733
> Project: Felix
>  Issue Type: Improvement
>  Components: Framework
> Environment: WinXP, eclipse, sun jdk 1.5 or 1.6
>Reporter: Sylvain MARIE
>Assignee: Karl Pauls
>Priority: Minor
> Attachments: native.patch, native2.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Here is a short description of the problem and how I managed to fix it. Don't 
> hesitate to contact me for details
> or to tell me if something here is wrong ! Cheers. Sylvain.
> 1- bundle "foo" embeds a native library "lib.dll" and declares it in its 
> manifest, with appropriate platform declaration (os, version, processor).
> 2- foo's activator loads that library in the start(bc) method - with 
> System.loadLibrary(...).
> 3- the library loads succesfully (this can be checked with e.g. 
> processExplorer or pmap)
> 4- the bundle is stopped.
> 5- the bundle is uninstalled. 
> > ERROR: org.apache.felix.framework.cache.BundleArchive: Unable to delete 
> > archive directory
> Why does this happen :
> - step 4: the library is not unloaded because foo's contentclassloader is 
> still alive. This is normal.
> - step 5: automatic package refresh : all bundles from uninstalled list are 
> garbaged. Method 
> Felix.garbageCollectBundle attemps to remove the bundle archive from the 
> cache, but
> the dll file is still in use => ERROR. The dll is still in use because foo's 
> contentclassloader has not yet
> been garbaged out.
> How to fix this:  
> 
> We need the ContentClassLoader to be garbaged out. So first release all
> references to foo's activator, then release all references to the 
> ContentClassLoader itself,
> and finally do a System.gc() before attempting to remove the bundle from the 
> cache.
> Two methods are impacted: ContentLoaderImpl.close() and 
> Felix.garbageCollectBundle(...)
> ContentLoaderImpl.java
> ---
> public synchronized void close()
> {
> ...
> ...
> 
> // FIX SMA : release content class loader
> m_classLoader = null;
> }
> Felix.java
> -
> private void garbageCollectBundle(FelixBundle bundle) throws Exception
> {
>   
> 
> 
> // FIX SMA : release reference to the activator
> bundle.getInfo().setActivator(null);
> 
> // Do the garbage collection either systematically, or only if native 
> libraries were loaded, or ... 
> System.gc(); // this destroys the activator, the contentclassloader, 
> and unloads the dll.
> // end FIX SMA
> 
> // Remove the bundle from the cache.
> m_cache.remove(m_cache.getArchive(bundle.getBundleId()));
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (FELIX-733) Exception when uninstalling a bundle that contains a native library (and loaded it at bundle startup).

2008-10-13 Thread Sylvain MARIE (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638985#action_12638985
 ] 

Sylvain MARIE commented on FELIX-733:
-

Thank you Karl. I tried your patch ; unfortunately it doesn't work: the content 
class loader is not garbaged out when the gc() are called.
The FIX below makes your patch work but maybe one should check why the 
ContentLoaderImpl is itself no garbaged out...

Second thing: you pached the BundleArchive.dispose() method but I saw that 
other methods
also call deleteDirectoryTree(). Maybe we should patch deleteDirectoryTree 
directly ?

If you need it I can send you my test bundle in order for you to test your 
patches.

Cheers

Sylvain

--FIX

class ContentLoaderImpl.java :

public synchronized void close()
{
m_content.close();
for (int i = 0; (m_contentPath != null) && (i < m_contentPath.length); 
i++)
{
m_contentPath[i].close();
}
for (int i = 0; (m_fragmentContents != null) && (i < 
m_fragmentContents.length); i++)
{
m_fragmentContents[i].close();
}
// FIX SMA release content class loader
m_classLoader = null;
// END FIX sma
}

> Exception when uninstalling a bundle that contains a native library (and 
> loaded it at bundle startup).
> --
>
> Key: FELIX-733
> URL: https://issues.apache.org/jira/browse/FELIX-733
> Project: Felix
>  Issue Type: Improvement
>  Components: Framework
> Environment: WinXP, eclipse, sun jdk 1.5 or 1.6
>Reporter: Sylvain MARIE
>Assignee: Karl Pauls
>Priority: Minor
> Attachments: native.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Here is a short description of the problem and how I managed to fix it. Don't 
> hesitate to contact me for details
> or to tell me if something here is wrong ! Cheers. Sylvain.
> 1- bundle "foo" embeds a native library "lib.dll" and declares it in its 
> manifest, with appropriate platform declaration (os, version, processor).
> 2- foo's activator loads that library in the start(bc) method - with 
> System.loadLibrary(...).
> 3- the library loads succesfully (this can be checked with e.g. 
> processExplorer or pmap)
> 4- the bundle is stopped.
> 5- the bundle is uninstalled. 
> > ERROR: org.apache.felix.framework.cache.BundleArchive: Unable to delete 
> > archive directory
> Why does this happen :
> - step 4: the library is not unloaded because foo's contentclassloader is 
> still alive. This is normal.
> - step 5: automatic package refresh : all bundles from uninstalled list are 
> garbaged. Method 
> Felix.garbageCollectBundle attemps to remove the bundle archive from the 
> cache, but
> the dll file is still in use => ERROR. The dll is still in use because foo's 
> contentclassloader has not yet
> been garbaged out.
> How to fix this:  
> 
> We need the ContentClassLoader to be garbaged out. So first release all
> references to foo's activator, then release all references to the 
> ContentClassLoader itself,
> and finally do a System.gc() before attempting to remove the bundle from the 
> cache.
> Two methods are impacted: ContentLoaderImpl.close() and 
> Felix.garbageCollectBundle(...)
> ContentLoaderImpl.java
> ---
> public synchronized void close()
> {
> ...
> ...
> 
> // FIX SMA : release content class loader
> m_classLoader = null;
> }
> Felix.java
> -
> private void garbageCollectBundle(FelixBundle bundle) throws Exception
> {
>   
> 
> 
> // FIX SMA : release reference to the activator
> bundle.getInfo().setActivator(null);
> 
> // Do the garbage collection either systematically, or only if native 
> libraries were loaded, or ... 
> System.gc(); // this destroys the activator, the contentclassloader, 
> and unloads the dll.
> // end FIX SMA
> 
> // Remove the bundle from the cache.
> m_cache.remove(m_cache.getArchive(bundle.getBundleId()));
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (FELIX-733) Exception when uninstalling a bundle that contains a native library (and loaded it at bundle startup).

2008-09-25 Thread Karl Pauls (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634512#action_12634512
 ] 

Karl Pauls commented on FELIX-733:
--

Well,  it depends. We would have to call System.gc twice in order to trigger a 
deep gc. This is a very expensiv thing to do. Im against doing this just to 
make a warning go away. If somebody does a patch that first tries to delete and 
only if of dosent work and we are on windows and the bundle has a native 
library calls gc twice and delete again then I would be more in favour.

> Exception when uninstalling a bundle that contains a native library (and 
> loaded it at bundle startup).
> --
>
> Key: FELIX-733
> URL: https://issues.apache.org/jira/browse/FELIX-733
> Project: Felix
>  Issue Type: Improvement
>  Components: Framework
> Environment: WinXP, eclipse, sun jdk 1.5 or 1.6
>Reporter: Sylvain MARIE
>Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Here is a short description of the problem and how I managed to fix it. Don't 
> hesitate to contact me for details
> or to tell me if something here is wrong ! Cheers. Sylvain.
> 1- bundle "foo" embeds a native library "lib.dll" and declares it in its 
> manifest, with appropriate platform declaration (os, version, processor).
> 2- foo's activator loads that library in the start(bc) method - with 
> System.loadLibrary(...).
> 3- the library loads succesfully (this can be checked with e.g. 
> processExplorer or pmap)
> 4- the bundle is stopped.
> 5- the bundle is uninstalled. 
> > ERROR: org.apache.felix.framework.cache.BundleArchive: Unable to delete 
> > archive directory
> Why does this happen :
> - step 4: the library is not unloaded because foo's contentclassloader is 
> still alive. This is normal.
> - step 5: automatic package refresh : all bundles from uninstalled list are 
> garbaged. Method 
> Felix.garbageCollectBundle attemps to remove the bundle archive from the 
> cache, but
> the dll file is still in use => ERROR. The dll is still in use because foo's 
> contentclassloader has not yet
> been garbaged out.
> How to fix this:  
> 
> We need the ContentClassLoader to be garbaged out. So first release all
> references to foo's activator, then release all references to the 
> ContentClassLoader itself,
> and finally do a System.gc() before attempting to remove the bundle from the 
> cache.
> Two methods are impacted: ContentLoaderImpl.close() and 
> Felix.garbageCollectBundle(...)
> ContentLoaderImpl.java
> ---
> public synchronized void close()
> {
> ...
> ...
> 
> // FIX SMA : release content class loader
> m_classLoader = null;
> }
> Felix.java
> -
> private void garbageCollectBundle(FelixBundle bundle) throws Exception
> {
>   
> 
> 
> // FIX SMA : release reference to the activator
> bundle.getInfo().setActivator(null);
> 
> // Do the garbage collection either systematically, or only if native 
> libraries were loaded, or ... 
> System.gc(); // this destroys the activator, the contentclassloader, 
> and unloads the dll.
> // end FIX SMA
> 
> // Remove the bundle from the cache.
> m_cache.remove(m_cache.getArchive(bundle.getBundleId()));
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (FELIX-733) Exception when uninstalling a bundle that contains a native library (and loaded it at bundle startup).

2008-09-25 Thread Stuart McCulloch (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634509#action_12634509
 ] 

Stuart McCulloch commented on FELIX-733:


+1 on nulling out the various fields once we're done with them

+0 on the System.gc() as this is only a suggestion to the JVM and doesn't 
guarantee the instances will be collected - but then again it wouldn't do any 
harm...

> Exception when uninstalling a bundle that contains a native library (and 
> loaded it at bundle startup).
> --
>
> Key: FELIX-733
> URL: https://issues.apache.org/jira/browse/FELIX-733
> Project: Felix
>  Issue Type: Improvement
>  Components: Framework
> Environment: WinXP, eclipse, sun jdk 1.5 or 1.6
>Reporter: Sylvain MARIE
>Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Here is a short description of the problem and how I managed to fix it. Don't 
> hesitate to contact me for details
> or to tell me if something here is wrong ! Cheers. Sylvain.
> 1- bundle "foo" embeds a native library "lib.dll" and declares it in its 
> manifest, with appropriate platform declaration (os, version, processor).
> 2- foo's activator loads that library in the start(bc) method - with 
> System.loadLibrary(...).
> 3- the library loads succesfully (this can be checked with e.g. 
> processExplorer or pmap)
> 4- the bundle is stopped.
> 5- the bundle is uninstalled. 
> > ERROR: org.apache.felix.framework.cache.BundleArchive: Unable to delete 
> > archive directory
> Why does this happen :
> - step 4: the library is not unloaded because foo's contentclassloader is 
> still alive. This is normal.
> - step 5: automatic package refresh : all bundles from uninstalled list are 
> garbaged. Method 
> Felix.garbageCollectBundle attemps to remove the bundle archive from the 
> cache, but
> the dll file is still in use => ERROR. The dll is still in use because foo's 
> contentclassloader has not yet
> been garbaged out.
> How to fix this:  
> 
> We need the ContentClassLoader to be garbaged out. So first release all
> references to foo's activator, then release all references to the 
> ContentClassLoader itself,
> and finally do a System.gc() before attempting to remove the bundle from the 
> cache.
> Two methods are impacted: ContentLoaderImpl.close() and 
> Felix.garbageCollectBundle(...)
> ContentLoaderImpl.java
> ---
> public synchronized void close()
> {
> ...
> ...
> 
> // FIX SMA : release content class loader
> m_classLoader = null;
> }
> Felix.java
> -
> private void garbageCollectBundle(FelixBundle bundle) throws Exception
> {
>   
> 
> 
> // FIX SMA : release reference to the activator
> bundle.getInfo().setActivator(null);
> 
> // Do the garbage collection either systematically, or only if native 
> libraries were loaded, or ... 
> System.gc(); // this destroys the activator, the contentclassloader, 
> and unloads the dll.
> // end FIX SMA
> 
> // Remove the bundle from the cache.
> m_cache.remove(m_cache.getArchive(bundle.getBundleId()));
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (FELIX-733) Exception when uninstalling a bundle that contains a native library (and loaded it at bundle startup).

2008-09-23 Thread Richard S. Hall (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633835#action_12633835
 ] 

Richard S. Hall commented on FELIX-733:
---

It makes sense that this happens. Regarding the solution, it doesn't seem 
unreasonable. However, it is not guaranteed to work, since System.gc() doesn't 
really have to do anything from what I understand. The question is, should we 
implement this fix anyway since it sounds like it will at least help for 
Windows. Sounds reasonable to me. Any other thoughts?

> Exception when uninstalling a bundle that contains a native library (and 
> loaded it at bundle startup).
> --
>
> Key: FELIX-733
> URL: https://issues.apache.org/jira/browse/FELIX-733
> Project: Felix
>  Issue Type: Improvement
>  Components: Framework
> Environment: WinXP, eclipse, sun jdk 1.5 or 1.6
>Reporter: Sylvain MARIE
>Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Here is a short description of the problem and how I managed to fix it. Don't 
> hesitate to contact me for details
> or to tell me if something here is wrong ! Cheers. Sylvain.
> 1- bundle "foo" embeds a native library "lib.dll" and declares it in its 
> manifest, with appropriate platform declaration (os, version, processor).
> 2- foo's activator loads that library in the start(bc) method - with 
> System.loadLibrary(...).
> 3- the library loads succesfully (this can be checked with e.g. 
> processExplorer or pmap)
> 4- the bundle is stopped.
> 5- the bundle is uninstalled. 
> > ERROR: org.apache.felix.framework.cache.BundleArchive: Unable to delete 
> > archive directory
> Why does this happen :
> - step 4: the library is not unloaded because foo's contentclassloader is 
> still alive. This is normal.
> - step 5: automatic package refresh : all bundles from uninstalled list are 
> garbaged. Method 
> Felix.garbageCollectBundle attemps to remove the bundle archive from the 
> cache, but
> the dll file is still in use => ERROR. The dll is still in use because foo's 
> contentclassloader has not yet
> been garbaged out.
> How to fix this:  
> 
> We need the ContentClassLoader to be garbaged out. So first release all
> references to foo's activator, then release all references to the 
> ContentClassLoader itself,
> and finally do a System.gc() before attempting to remove the bundle from the 
> cache.
> Two methods are impacted: ContentLoaderImpl.close() and 
> Felix.garbageCollectBundle(...)
> ContentLoaderImpl.java
> ---
> public synchronized void close()
> {
> ...
> ...
> 
> // FIX SMA : release content class loader
> m_classLoader = null;
> }
> Felix.java
> -
> private void garbageCollectBundle(FelixBundle bundle) throws Exception
> {
>   
> 
> 
> // FIX SMA : release reference to the activator
> bundle.getInfo().setActivator(null);
> 
> // Do the garbage collection either systematically, or only if native 
> libraries were loaded, or ... 
> System.gc(); // this destroys the activator, the contentclassloader, 
> and unloads the dll.
> // end FIX SMA
> 
> // Remove the bundle from the cache.
> m_cache.remove(m_cache.getArchive(bundle.getBundleId()));
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.