You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2010/12/18 19:57:00 UTC
[jira] Created: (CAMEL-3442) JBI ClassLoading issue in SMX 4.x in
OsgiPackageScanClassResolver
JBI ClassLoading issue in SMX 4.x in OsgiPackageScanClassResolver
-----------------------------------------------------------------
Key: CAMEL-3442
URL: https://issues.apache.org/jira/browse/CAMEL-3442
Project: Camel
Issue Type: Bug
Components: osgi
Affects Versions: 2.5.0
Reporter: Claus Ibsen
Fix For: 2.6.0
CAMEL-3302 introduced a fallback when using JBI in Apache ServiceMix 4.x.
However it may lead to an issue with ConcurrentModificationException when traversing the list of classloaders.
{code}
for (ClassLoader classLoader : super.getClassLoaders()) {
if (!isOsgiClassloader(classLoader)) {
find(test, packageName, classLoader, classes);
}
}
{code}
The for loop is line 62 which causes the exception.
Issue reported here
http://camel.465427.n5.nabble.com/ServiceMix-4-Fuse-4-3-0-fuse-03-00-Problems-running-JBI-example-examples-camel-td3309088.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-3442) JBI ClassLoading issue in SMX 4.x in
OsgiPackageScanClassResolver
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-3442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12973138#action_12973138 ]
Claus Ibsen commented on CAMEL-3442:
------------------------------------
trunk: 1051019.
Fixed unit test failure
> JBI ClassLoading issue in SMX 4.x in OsgiPackageScanClassResolver
> -----------------------------------------------------------------
>
> Key: CAMEL-3442
> URL: https://issues.apache.org/jira/browse/CAMEL-3442
> Project: Camel
> Issue Type: Bug
> Components: osgi
> Affects Versions: 2.5.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Fix For: 2.6.0
>
>
> CAMEL-3302 introduced a fallback when using JBI in Apache ServiceMix 4.x.
> However it may lead to an issue with ConcurrentModificationException when traversing the list of classloaders.
> {code}
> for (ClassLoader classLoader : super.getClassLoaders()) {
> if (!isOsgiClassloader(classLoader)) {
> find(test, packageName, classLoader, classes);
> }
> }
> {code}
> The for loop is line 62 which causes the exception.
> Issue reported here
> http://camel.465427.n5.nabble.com/ServiceMix-4-Fuse-4-3-0-fuse-03-00-Problems-running-JBI-example-examples-camel-td3309088.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (CAMEL-3442) JBI ClassLoading issue in
SMX 4.x in OsgiPackageScanClassResolver
Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-3442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972888#action_12972888 ]
Freeman Fang edited comment on CAMEL-3442 at 12/18/10 9:37 PM:
---------------------------------------------------------------
Hi Claus,
I just checked the patch which I appended with CAMEL-3302, my original patch about the concern code is like
+ Set<ClassLoader> set = getClassLoaders();
+ for (ClassLoader classLoader : set.toArray(new ClassLoader[set.size()])) {
+ if (!isOsgiClassloader(classLoader)) {
+ find(test, packageName, classLoader, classes);
+ }
+ }
With this patch, there should be no ConcurrentModificationException on the Iterator. Willem revised my patch probably for better performance but introduce potential ConcurrentModificationException.
@Willem
Would you please re-check my patch, as classloaders set size isn't big, so change it to an array isn't a big deal IMHO, but this can avoid concurrent problem(such as ConcurrentModificationException).
Another solution I can come up with is change getClassLoaders() in DefaultPackageScanClassResolver
use
classLoaders = Collections.synchronizedSet(new HashSet<ClassLoader>());
instead of
classLoaders = new HashSet<ClassLoader>();
But this also bring in performance impact, I still prefer the way in my original patch.
Best Regards
Freeman
was (Author: ffang):
Hi Claus,
I just checked the patch which I appended with CAMEL-3302, my original patch about the concern code is like
+ Set<ClassLoader> set = getClassLoaders();
+ for (ClassLoader classLoader : set.toArray(new ClassLoader[set.size()])) {
+ if (!isOsgiClassloader(classLoader)) {
+ find(test, packageName, classLoader, classes);
+ }
+ }
With this patch, there should be no ConcurrentModificationException on the Iterator. Willem revised my patch for better performance but introduce potential ConcurrentModificationException.
@Willem
Would you please re-check my patch, as classloaders set size isn't big, so change it to an array isn't a big deal IMHO, but this can avoid concurrent problem(such as ConcurrentModificationException).
Another solution I can come up with is change getClassLoaders() in DefaultPackageScanClassResolver
use
classLoaders = Collections.synchronizedSet(new HashSet<ClassLoader>());
instead of
classLoaders = new HashSet<ClassLoader>();
But this also bring in performance impact, I still prefer the way in my original patch.
Best Regards
Freeman
> JBI ClassLoading issue in SMX 4.x in OsgiPackageScanClassResolver
> -----------------------------------------------------------------
>
> Key: CAMEL-3442
> URL: https://issues.apache.org/jira/browse/CAMEL-3442
> Project: Camel
> Issue Type: Bug
> Components: osgi
> Affects Versions: 2.5.0
> Reporter: Claus Ibsen
> Fix For: 2.6.0
>
>
> CAMEL-3302 introduced a fallback when using JBI in Apache ServiceMix 4.x.
> However it may lead to an issue with ConcurrentModificationException when traversing the list of classloaders.
> {code}
> for (ClassLoader classLoader : super.getClassLoaders()) {
> if (!isOsgiClassloader(classLoader)) {
> find(test, packageName, classLoader, classes);
> }
> }
> {code}
> The for loop is line 62 which causes the exception.
> Issue reported here
> http://camel.465427.n5.nabble.com/ServiceMix-4-Fuse-4-3-0-fuse-03-00-Problems-running-JBI-example-examples-camel-td3309088.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (CAMEL-3442) JBI ClassLoading issue in SMX 4.x in
OsgiPackageScanClassResolver
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-3442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-3442.
--------------------------------
Resolution: Fixed
trunk: 1050776.
> JBI ClassLoading issue in SMX 4.x in OsgiPackageScanClassResolver
> -----------------------------------------------------------------
>
> Key: CAMEL-3442
> URL: https://issues.apache.org/jira/browse/CAMEL-3442
> Project: Camel
> Issue Type: Bug
> Components: osgi
> Affects Versions: 2.5.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Fix For: 2.6.0
>
>
> CAMEL-3302 introduced a fallback when using JBI in Apache ServiceMix 4.x.
> However it may lead to an issue with ConcurrentModificationException when traversing the list of classloaders.
> {code}
> for (ClassLoader classLoader : super.getClassLoaders()) {
> if (!isOsgiClassloader(classLoader)) {
> find(test, packageName, classLoader, classes);
> }
> }
> {code}
> The for loop is line 62 which causes the exception.
> Issue reported here
> http://camel.465427.n5.nabble.com/ServiceMix-4-Fuse-4-3-0-fuse-03-00-Problems-running-JBI-example-examples-camel-td3309088.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (CAMEL-3442) JBI ClassLoading issue in
SMX 4.x in OsgiPackageScanClassResolver
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-3442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972929#action_12972929 ]
Claus Ibsen edited comment on CAMEL-3442 at 12/19/10 2:28 AM:
--------------------------------------------------------------
Thanks Freeman
I think we should fix this in the core, so it returns a new set when invoking {{getClassLoaders}}, that will fix this issue for other custom package scan resolvers that may encounter similar issue.
Something like this:
{code}
public Set<ClassLoader> getClassLoaders() {
// return a new set to avoid any concurrency issues in other runtimes such as OSGi
return Collections.unmodifiableSet(new LinkedHashSet<ClassLoader>(classLoaders));
}
{code}
was (Author: davsclaus):
Thanks Freeman
I think we should fix this in the core, so it returns a new set when invoking {{getClassLoaders}}, that will fix this issue for other custom package scan resolvers that may encounter similar issue.
Something like this:
{code}
public Set<ClassLoader> getClassLoaders() {
// return a new set to avoid any concurrency issues in other runtimes such as OSGi
return new LinkedHashSet<ClassLoader>(classLoaders);
}
{code}
> JBI ClassLoading issue in SMX 4.x in OsgiPackageScanClassResolver
> -----------------------------------------------------------------
>
> Key: CAMEL-3442
> URL: https://issues.apache.org/jira/browse/CAMEL-3442
> Project: Camel
> Issue Type: Bug
> Components: osgi
> Affects Versions: 2.5.0
> Reporter: Claus Ibsen
> Fix For: 2.6.0
>
>
> CAMEL-3302 introduced a fallback when using JBI in Apache ServiceMix 4.x.
> However it may lead to an issue with ConcurrentModificationException when traversing the list of classloaders.
> {code}
> for (ClassLoader classLoader : super.getClassLoaders()) {
> if (!isOsgiClassloader(classLoader)) {
> find(test, packageName, classLoader, classes);
> }
> }
> {code}
> The for loop is line 62 which causes the exception.
> Issue reported here
> http://camel.465427.n5.nabble.com/ServiceMix-4-Fuse-4-3-0-fuse-03-00-Problems-running-JBI-example-examples-camel-td3309088.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-3442) JBI ClassLoading issue in SMX 4.x in
OsgiPackageScanClassResolver
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-3442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972929#action_12972929 ]
Claus Ibsen commented on CAMEL-3442:
------------------------------------
Thanks Freeman
I think we should fix this in the core, so it returns a new set when invoking {{getClassLoaders}}, that will fix this issue for other custom package scan resolvers that may encounter similar issue.
Something like this:
{code}
public Set<ClassLoader> getClassLoaders() {
// return a new set to avoid any concurrency issues in other runtimes such as OSGi
return new LinkedHashSet<ClassLoader>(classLoaders);
}
{code}
> JBI ClassLoading issue in SMX 4.x in OsgiPackageScanClassResolver
> -----------------------------------------------------------------
>
> Key: CAMEL-3442
> URL: https://issues.apache.org/jira/browse/CAMEL-3442
> Project: Camel
> Issue Type: Bug
> Components: osgi
> Affects Versions: 2.5.0
> Reporter: Claus Ibsen
> Fix For: 2.6.0
>
>
> CAMEL-3302 introduced a fallback when using JBI in Apache ServiceMix 4.x.
> However it may lead to an issue with ConcurrentModificationException when traversing the list of classloaders.
> {code}
> for (ClassLoader classLoader : super.getClassLoaders()) {
> if (!isOsgiClassloader(classLoader)) {
> find(test, packageName, classLoader, classes);
> }
> }
> {code}
> The for loop is line 62 which causes the exception.
> Issue reported here
> http://camel.465427.n5.nabble.com/ServiceMix-4-Fuse-4-3-0-fuse-03-00-Problems-running-JBI-example-examples-camel-td3309088.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-3442) JBI ClassLoading issue in SMX 4.x in
OsgiPackageScanClassResolver
Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-3442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972888#action_12972888 ]
Freeman Fang commented on CAMEL-3442:
-------------------------------------
Hi Claus,
I just checked the patch which I appended with CAMEL-3302, my original patch about the concern code is like
+ Set<ClassLoader> set = getClassLoaders();
+ for (ClassLoader classLoader : set.toArray(new ClassLoader[set.size()])) {
+ if (!isOsgiClassloader(classLoader)) {
+ find(test, packageName, classLoader, classes);
+ }
+ }
With this patch, there should be no ConcurrentModificationException on the Iterator. Willem revised my patch for better performance but introduce potential ConcurrentModificationException.
@Willem
Would you please re-check my patch, as classloaders set size isn't big, so change it to an array isn't a big deal IMHO, but this can avoid concurrent problem(such as ConcurrentModificationException).
Another solution I can come up with is change getClassLoaders() in DefaultPackageScanClassResolver
use
classLoaders = Collections.synchronizedSet(new HashSet<ClassLoader>());
instead of
classLoaders = new HashSet<ClassLoader>();
But this also bring in performance impact, I still prefer the way in my original patch.
Best Regards
Freeman
> JBI ClassLoading issue in SMX 4.x in OsgiPackageScanClassResolver
> -----------------------------------------------------------------
>
> Key: CAMEL-3442
> URL: https://issues.apache.org/jira/browse/CAMEL-3442
> Project: Camel
> Issue Type: Bug
> Components: osgi
> Affects Versions: 2.5.0
> Reporter: Claus Ibsen
> Fix For: 2.6.0
>
>
> CAMEL-3302 introduced a fallback when using JBI in Apache ServiceMix 4.x.
> However it may lead to an issue with ConcurrentModificationException when traversing the list of classloaders.
> {code}
> for (ClassLoader classLoader : super.getClassLoaders()) {
> if (!isOsgiClassloader(classLoader)) {
> find(test, packageName, classLoader, classes);
> }
> }
> {code}
> The for loop is line 62 which causes the exception.
> Issue reported here
> http://camel.465427.n5.nabble.com/ServiceMix-4-Fuse-4-3-0-fuse-03-00-Problems-running-JBI-example-examples-camel-td3309088.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (CAMEL-3442) JBI ClassLoading issue in SMX 4.x in
OsgiPackageScanClassResolver
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAMEL-3442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen reassigned CAMEL-3442:
----------------------------------
Assignee: Claus Ibsen
> JBI ClassLoading issue in SMX 4.x in OsgiPackageScanClassResolver
> -----------------------------------------------------------------
>
> Key: CAMEL-3442
> URL: https://issues.apache.org/jira/browse/CAMEL-3442
> Project: Camel
> Issue Type: Bug
> Components: osgi
> Affects Versions: 2.5.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Fix For: 2.6.0
>
>
> CAMEL-3302 introduced a fallback when using JBI in Apache ServiceMix 4.x.
> However it may lead to an issue with ConcurrentModificationException when traversing the list of classloaders.
> {code}
> for (ClassLoader classLoader : super.getClassLoaders()) {
> if (!isOsgiClassloader(classLoader)) {
> find(test, packageName, classLoader, classes);
> }
> }
> {code}
> The for loop is line 62 which causes the exception.
> Issue reported here
> http://camel.465427.n5.nabble.com/ServiceMix-4-Fuse-4-3-0-fuse-03-00-Problems-running-JBI-example-examples-camel-td3309088.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.