4

Running ColdBox 4.2 we were seeing this error after reinit, but only on one specific handler cfc. If we reinit several times it would eventually go away, which sounds like a race condition.

We thought of just doing extends="coldbox.system.EventHandler" directly rather than letting the framework mix in the handler methods, but then we began seeing another error:

Error building: myApp.handlers.admin.report -> The CONTROLLER parameter to the init function is required but was not passed in. with constructor arguments: {}

Similarly, this error would go away if we reinit a few times until we get one where things finish baking before a request comes in midway through the init.

We're not able to reproduce this on non-prod systems, likely due to substantially lower load.

Has anyone run into similar things and figured out a way to gracefully reinit the framework under load?

Leigh
  • 28,424
  • 10
  • 49
  • 96
jinglesthula
  • 4,162
  • 4
  • 43
  • 72

1 Answers1

3

I actually managed to reasonably reliably reproduce race condition errors during reinit's and posted it as a issue COLDBOX-307, pretty much the response is don't use fwreinit in production ever which is correct we switched to using our own method that calls applicationStop in application.cfc and it fixed the issues we were seeing when using fwreinit.

One thing to note when using applicationStop it isn't thread safe (maybe not the right term) which means application scope for all currently running requests will go bye bye when it is called so you can have some odd errors from reiniting this way.

Snipzwolf
  • 483
  • 1
  • 8
  • 20
  • Does it kill the sessions themselves? I'd hate to essentially log everyone out just to deploy new code that requires a reinit. – jinglesthula May 10 '17 at 19:59
  • @jinglesthula I'm not actually sure about that as we use session storage so the sessions persist through complete restarts, i would imagine when using only in memory sessions that it would as it is basically the same as restarting the coldfusion server service but quicker and that you would run the risk of running out of memory if it didn't as session scope could contain object from the previous application causing them to never be garbage collected. – Snipzwolf May 10 '17 at 20:08
  • 3
    @jinglesthula actually the answer is no. Calling applicationStop does NOT end existing sessions. – Miguel-F May 10 '17 at 20:22
  • 3
    You can force a ColdBox reinit to be thread safe with locking in your onRequestStart, but the reason we don't do that by default is it can cause serious delays if a single long-running request needs to finish or the reinit itself takes a long time as all other requests get backed up behind that one request which can cause a large number of queued threads and take down your server. The default behavior is the most performant while still serving pages. – Brad Wood May 11 '17 at 03:07
  • didn't help here with CB 3.8.2. Any other solutions? – Chris Kepinski Mar 04 '19 at 10:41