Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Lag because of BuddyClassLoading during XWT Introspection
Lag because of BuddyClassLoading during XWT Introspection [message #1782649] Tue, 27 February 2018 11:41 Go to next message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 312
Registered: February 2012
Location: Düsseldorf
Senior Member
Hi,
we have embedded Papyrus in our application an experience lags due to the properties view which uses XWT. During creation of the XWT tabs, XWT uses introspection to check for BeanInfo classes. Since papyrus makes uses of buddy class loading there is quite a number of bundles which is searched for these BeanInfo classes which probably don't even exist. The lag is quite annoying 20-40 seconds and it is freezing the ui because the class loading takes place in the UI thread.

Is this a known issue?

This is an example of a stack. I just stopped the UI thread during the lag. The class which the classloader is currently looking for is:

org.eclipse.papyrus.infra.properties.ui.widgets.AbstractMultiReferenceBeanInfo

EquinoxContainerAdaptor$1(ClassLoader).findClass(String) line: not available
EquinoxContainerAdaptor$1(ClassLoader).loadClass(String, boolean) line: not available
EquinoxContainerAdaptor$1(ClassLoader).loadClass(String) line: not available
BundleLoader.findClassInternal(String, boolean) line: 479
BundleLoader.findClass(String, boolean) line: 395
BundleLoader.findClass(String) line: 387
DependentPolicy.loadClass(String) line: 55
PolicyHandler.doBuddyClassLoading(String) line: 141
BundleLoader.findClassInternal(String, boolean) line: 471
BundleLoader.findClass(String, boolean) line: 395
BundleLoader.findClass(String) line: 387
DependentPolicy.loadClass(String) line: 55
PolicyHandler.doBuddyClassLoading(String) line: 141
BundleLoader.findClassInternal(String, boolean) line: 471
BundleLoader.findClass(String, boolean) line: 395
BundleLoader.findClass(String) line: 387
EquinoxClassLoader(ModuleClassLoader).loadClass(String, boolean) line: 150
EquinoxClassLoader(ClassLoader).loadClass(String) line: not available
Class<T>.forName0(String, boolean, ClassLoader, Class<?>) line: not available [native method]
Class<T>.forName(String, boolean, ClassLoader) line: not available
ClassFinder.findClass(String, ClassLoader) line: not available
BeanInfoFinder(InstanceFinder<T>).instantiate(Class<?>, String) line: not available
BeanInfoFinder(InstanceFinder<T>).find(Class<?>) line: not available
Introspector.findExplicitBeanInfo(Class<?>) line: not available
Introspector.<init>(Class<?>, Class<?>, int) line: not available
Introspector.getBeanInfo(Class<?>) line: not available
Introspector.getBeanInfo(Class<?>, Class<?>, int) line: not available
Introspector.<init>(Class<?>, Class<?>, int) line: not available
Introspector.getBeanInfo(Class<?>) line: not available
Metaclass(AbstractMetaclass).initialize(Class<?>, IMetaclass) line: 685
Metaclass(AbstractMetaclass).assertInitialize() line: 677
Metaclass(AbstractMetaclass).newInstance(Object[]) line: 395
ResourceLoader.doCreate(Object, Element, Class<?>, Map<String,Object>) line: 613
ResourceLoader.doCreate(Object, Element, Class<?>, Map<String,Object>) line: 717
ResourceLoader.doCreate(Object, Element, Class<?>, Map<String,Object>) line: 717
ResourceLoader.createUIElement(Element, Map<String,Object>) line: 378
PapyrusXWTCore(Core).createCLRElement(IRenderingContext, Element, Map<String,Object>) line: 630
PapyrusXWTCore(Core).load(ILoadingContext, InputStream, URL, Map<String,Object>) line: 772
PapyrusXWTCore(Core).load(ILoadingContext, URL, Map<String,Object>) line: 660
XWTLoader.loadWithOptions(URL, Map<String,Object>) line: 1072

Thanks in advance.

Regards,
Thorsten
Re: Lag because of BuddyClassLoading during XWT Introspection [message #1782659 is a reply to message #1782649] Tue, 27 February 2018 12:58 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Thorsten,

This bug was present in Oxygen.0, but was fixed in either Oxygen.1 or Oxygen.2 (I can't remember for sure). Updating to the latest Papyrus release should solve the issue.

We can't easily get rid of the Buddy Class-loading policy, so we have overridden the XWT Loader to remove some (expensive) calls that are never used in Papyrus, and included our cached class loader to avoid reloading the same classes for each properties page to display.

HTH,
Camille


Camille Letavernier
Re: Lag because of BuddyClassLoading during XWT Introspection [message #1782666 is a reply to message #1782659] Tue, 27 February 2018 14:27 Go to previous messageGo to next message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 312
Registered: February 2012
Location: Düsseldorf
Senior Member
Hi Camille,
thank you very much for responding. It would be big help if you could elaborate on this a little bit more.
If I look into the code I see that there is already the org.eclipse.papyrus.infra.properties.ui.xwt.CachedMetaclassManager and org.eclipse.papyrus.infra.properties.ui.xwt.CachedMetaclassService in place (taken from org.eclipse.papyrus.infra.properties.ui.source_3.2.0.201712060842) . Would you expect this to do somehow do the magic? If so it, doesn't seem to work because I experience these lags. Could it be that I need to add some specific bundle providing some specific loaderservice?

Regards,
Thorsten
Re: Lag because of BuddyClassLoading during XWT Introspection [message #1782669 is a reply to message #1782666] Tue, 27 February 2018 14:38 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Thorsten,

That should be sufficient. You should make sure that you also get the latest version of XWT (Also from ~ 2017-12-xxx), but I believe the dependency to that latest version is explicitly specified, so that shouldn't be an issue.

So in theory:

- Many (expensive) calls from XWT to Class.getResource() should be simply skipped in the case of Papyrus, because we don't use *.xwt files next to Java classes
- The ClassLoader should be called only once per Java Class, because we maintain a Cache for each loaded class (Which Eclipse/OSGI don't do by default)

So the freeze should be less important than it used to be in Oxygen.0 (Due to the removed class.getResource() calls), and it should only happen a few times after loading Papyrus, and improve over time (Due to the added cache). If you experience the same freezes after reloading some properties pages, then there's definitely something wrong.

Once the cached class loaders are populated, displaying a properties page should take around 100-200ms, and definitely less than 1s (i.e. not 100% fluid but "good enough")


Camille Letavernier
Re: Lag because of BuddyClassLoading during XWT Introspection [message #1782670 is a reply to message #1782669] Tue, 27 February 2018 14:51 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Reading your initial e-mail more carefully, I realize that we didn't take BeanInfo into account at all. We indeed don't use that in Papyrus, so it should be skipped, just as the *.xwt files located next to Java Classes.

However, I'm surprised we didn't notice that earlier. I wonder if it's a new XWT feature, or if it only occurs in some specific cases?

I've reported a new bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=531741


Camille Letavernier
Previous Topic:Papyrus not Intuitive
Next Topic: team working collaboratively using Papyrus project
Goto Forum:
  


Current Time: Fri Mar 29 15:49:55 GMT 2024

Powered by FUDForum. Page generated in 0.06139 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top