createObject reloads all OSGI bundles if javaSettings are configured

Description

None

Environment

This is a performance regression in 5.3.9.x. (I’m having trouble pinning down the exact version.)

Basically, a createObject( "java", "java.internal.class" ) can be extremely slow when run at scale. When profiling via Fusion Reactor, it appears this is because Lucee is loading all OSGI bundles every time - i.e. the OSGI lookup is never cached.

This is similar to , but it appears to be a different cause.

Attachments

3

Activity

dan.switzer@givainc.com 
9 December 2022 at 17:29

First, thanks for this fix. It looks like it’s going to resolve a race condition we’ve been seeing under load where threads were hang.

I’ve been trying to see if I could recreate the race condition and finally came up with something that duplicates the behavior. It does not mirror our production code directly, but it results in similar stack traces where the threads end up getting stuck in a lock trying to load a class.

If you run the attached code under a web stress tool (like jMeter) and just send a large amount of requests at it, you’ll see that the threads quickly get stuck in a race condition. If you remove the {{this.javaSettings}} from the {{Application.cfc}} and restart Lucee, it will run fine. I chose to load the Lucee server bundle, only because I knew it would exist in the environment. It doesn’t matter what JARs you load, you just need to load some.

When I test under 5.3.10.97 the problem is resolved (it’s broken under 5.3.9.141).


Since I can’t seem to attach a zip file, here is the code you need:

Application.cfc

lucee_hang_request_20221205.cfm

Michael Born @ Ortus 
20 September 2022 at 16:06

If this ticket was fixed, then I’m going to presume the assignee found the root cause. 😁

Former user 
14 September 2022 at 09:45

: your issue seems completely unrelated to this ticket.

May be so. Which gets me curious to know if anyone has found the root cause in both cases.

My thinking is that, in both cases, the degradation in performance is due to locking or singlethreadedness during class/component loading. Just a preliminary thought.

Michael Born @ Ortus 
13 September 2022 at 16:02

FWIW, I never claimed this issue only occurs on internal Java classes. I’m sure it also occurs/occurred on java classes in OSGI bundles or jars in the application this.javasettings as well. (And I’m hoping the fix accounts for that as well?)

your issue seems completely unrelated to this ticket.

Former user 
13 September 2022 at 08:23

Fixed

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Created 1 July 2022 at 17:30
Updated 9 December 2022 at 17:29
Resolved 29 August 2022 at 13:43