Running ORMReload often causes timeout or Lucee to crash

I am running Lucee 6.0.0.585

I am using a mix of Coldbox ORM and the qb module. In my Application.cfc I have this bit of logic that allows me to do an ORMReload. Sometimes it works fine when I trigger this by adding a query param to the URL as in ?fwreinit=1&refresh=1 for example, but it times out and then I have to restart Lucee.

if (	!isNull( url.rebuild ) ||	!isNull( url.refresh )	) {
		ORMReload();
    }

error is: public_html/index.cfm has run into a timeout (timeout: 50 seconds) and has been stopped. The thread started 58500ms ago. Open locks at this time [640bc157f893e055bb614b9eeee79693, module16886645ed666b41e092d593f18e04f5.activation.cbsecurity].

coldbox/system/ioc/Builder.cfc: line 591

589: targetObject = “”
590: ){
591: var refLocal = {};
592: var DSLNamespace = listFirst( arguments.definition.dsl, “:” );
593:
called from /home/public_html/coldbox/system/ioc/Injector.cfc: line 1289
called from /home/public_html/coldbox/system/ioc/Injector.cfc: line 915
called from /home/public_html/coldbox/system/ioc/scopes/Singleton.cfc: line 92
called from /home/public_html/coldbox/system/ioc/Injector.cfc: line 581
called from /home/public_html/coldbox/system/web/services/InterceptorService.cfc: line 484

Does this ever happen to anyone else, should I reload another way? I don’t have tons of model objects either.

Does this ever happen to anyone else, should I reload another way?

Yes and no. Yes, I’ve seen tremendous performance costs incurred when running an ORMReload, and no, I don’t know of any better reload method.

Are you using the Ortus ORM extension, or the old Lucee Hibernate extension? We’ve dramatically improved ORM reload times in the Ortus ORM extension - see the docs on v5.4.29.22, where we improved ORMReload time by up to 60%, and the v6.0.0 docs, where we document further ORMReload improvements.

I can’t debug that exception for you, since I don’t have 1) your app, or 2) the full stack trace in front of me, but in general I would follow this process to debug:

  1. Start up Fusion Reactor and profile the ormReload request. Dig into any slow code. This helped me discover LDEV-4064 several years ago.
  2. Install the Ortus ORM extension and benefit immediately frometter docs](https://orm-extension.ortusbooks.com/) and faster startup times.
  3. Rename all but a single entity to *.txt. Run the ORMReload andbug. Then rename back to .cfc until you start seeing the ORMReload slowdown
  4. Look at all code in the pseudo-constructor of each entity. You want to avoid doing any complex work in the pseudo-constructor, since I believe Lucee has to build at least that much of the component just to grab entity metadata.

With that said… your issue seems more like a CBSecurity configuration issue than an ORMReload one. Of course, I can’t say that for sure without seeing, I dunno, the full exception and stack trace, the CBSecurity version, coldbox version, and your coldbox and cbsecurity settings. :slight_smile:

Thanks for the detailed reply @MichaelBorn.

I am using the “cborm” extension shown here: https://coldbox-orm.ortusbooks.com/

It sounds like the extension you’re referring to is different than what I’m using, but please confirm.

Your suggestions around debugging make sense. I will look at my entities and see if I can isolate what is causing the issue. In some ways, I hope I can consistently reproduce it.

I also wonder if it’s worth increasing the request timeout, at least in dev to see if that helps while still digging into solving the underlying issue.

Thanks for your support!

Yes, that’s a ColdBox extension. You also need a Lucee extension which bundles Hibernate. You have two choices: the Lucee Hibernate extension (which is no longer supported or maintained) or the Ortus ORM Extension.