Why do you change your application name based on the environment it's in? That makes no sense. The application is still the same app, irrespective of whether it's in prod, or you're staging it, or developing it.
Equally, same with the source code. You've got your dev site within your live website? How does this make any sense?
I dunno what's going on with your application variables, but they're bound to the application name (this.name
), not where the Application.cfc
is in the directory structure.
I suspect your zero applicationTimeout
is not helping matters much here. This basically means your application never actually persists... it'll be timing out every request. This makes no sense either.
You do not need to <cflock>
that code in onApplicationStart()
. ColdFusion will only allow one request to run onApplicationStart()
: all other requests will be queued until it's completed, by which time the application has started, so the queued requests won't even attempt to run it.
I think your problem is most likely causes by your poor application framework design, and this weird thing you're doing having dev and prod in the same source code tree (which defies all logic).
Sort your source code out, and the problem won't arise.