[ColdBox 4.1] Random error on same route

I have an app that is working fine on commandbox. Once I’ve uploaded in production I get strange error on same routes. The error randomly changes.

I try to explain better: my app fires multiple ajax request, the same route never respond the same. Sometime is ok, sometime it gets an error “variable [thisInterceptor] doesn’t exist”, sometime gets error “The event: api.utility is not valid registered event.”. When I try to access the route directly from my browser it works great, never had error. This is driving me crazy. I remember I had in the past some error with ajax request, so I use an interceptor that support json request: ColdBox JSON Interceptor to support json http requests · GitHub.

The error I get:

Oopsy! Something went wrong!Event: api.utility

Routed URL: api/utility/getCountries/
Layout: N/A (Module: )
View: N/A
Timestamp: 07/03/2015 02:48:49 AM

Sometime I got also this:

Oopsy! Something went wrong!Event: api:utility.getCountries

Routed URL: api/utility/getCountries/
Layout: N/A (Module: )
View: N/A
Timestamp: 07/03/2015 03:08:21 AM

In order for the thisInterceptor variable to not exist, the interceptors.get( key ) call on line 250 must be returning null. This smells like the framework is having concurrency issues.

Please show us your config. I’m most interested in caching or auto-reload type of settings that would be re-registering interceptors every request. There must be two threads executing at the same time and colliding. The pool of interceptors is a shared “struct” that one thread might be modifying while another thread is trying to read from it.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I would add that my app is running many subsequent ajax calls. So Brad, you probably are on the right path. I think that is concurrency problem as well. What I don’t understand is why it works on my local commandbox and not in production. I’ve checked all the server configuration and are identically.

This is my config:

`

component{

// Configure ColdBox Application
function configure(){

// coldbox directives
coldbox = {
//Application Setup
appName = “TropicalSeo”,
eventName = “event”,

//Development Settings
reinitPassword = “”,
handlersIndexAutoReload = false,

//Implicit Events
defaultEvent = “Home.index”,
requestStartHandler = “”,
requestEndHandler = “”,
applicationStartHandler = “”,
applicationEndHandler = “”,
sessionStartHandler = “”,
sessionEndHandler = “”,
missingTemplateHandler = “”,

//Extension Points
applicationHelper = “”,
viewsHelper = “”,
modulesExternalLocation = [],
viewsExternalLocation = “”,
layoutsExternalLocation = “”,
handlersExternalLocation = “”,
requestContextDecorator = “”,
controllerDecorator = “”,

//Error/Exception Handling
exceptionHandler = “”,
onInvalidEvent = “”,
customErrorTemplate = “/coldbox/system/includes/BugReport.cfm”,

//Application Aspects
handlerCaching = true,
eventCaching = true,
proxyReturnCollection = false,
requestContextDecorator = “models.RequestContextDecorator”
};

// custom settings
settings = {

};

// Module Directives
modules = {
//Turn to false in production
autoReload = false,
// An array of modules names to load, empty means all of them
include = [],
// An array of modules names to NOT load, empty means none
exclude = []
};

// environment settings, create a detectEnvironment() method to detect it yourself.
// create a function with the name of the environment so it can be executed if that environment is detected
// the value of the environment is a list of regex patterns to match the cgi.http_host.
environments = {
development = “^cf8.,^railo.,^127.0.0.1”
};

//i18n & Localization
i18n = {
defaultResourceBundle = “includes/i18n/main”,
defaultLocale = “en_US”,
localeStorage = “cookie”,
unknownTranslation = “NOT FOUND
};

//Layout Settings
layoutSettings = {
defaultLayout = “Main”,
defaultView = “”
};

//Register interceptors as an array, we need order
interceptors = [
//SES
{class=“coldbox.system.interceptors.SES”,
properties={}
},
{class=“interceptors.angular”, properties={}
}
];

}

/**

  • Development environment
    */
    function development(){
    coldbox.customErrorTemplate = “/coldbox/system/includes/BugReport.cfm”;
    debugger.debugMode = true;
    }

}

`

Hmm, I don’t see any red flags in there. Is there any chance one of the requests is reinitting the framework?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I’m not sure what to check. However I’m trying to disable all request and try adding one at time to check where the problem is.

I wanna add that I use coldbox-bundle folder to store my core module. Could be this a problem? If I remember well there was a bug about using a folder to store all core module…

I’ve found the error!!! I’ve set this

`

setAutoReload(true);

`

In my routes.cfc…