Repeated calls to ajax URL sometimes run default event instead of specified resource


I have the following handler at /handlers/ajax.cfc:

component {
function jurisdictions(event, rc, prc) {
event.renderData(type=“text”, data=“Correct output”);

I can make a request to that handler with this JQuery, and expect to get back the string “Correct output”:

$.ajax("/ajax/jurisdictions", {

dataType: “text”,
cache: false,
success: function(data) {


  • Output received:” + data + “
  • ”)

    The problem I’ve encountered is that this works as expected, except when multiple requests are made in quick succession. If I wrap that jquery ajax call in a for loop that runs the ajax call more than once, or if I set the ajax call to fire via mouse click and rapidly click the button, then some of the responses I get to the ajax requests return “Correct output” as expected, but some of the ajax requests return the contents of running my defaultEvent, which in this case is my home page.

    How is it that if I issue multiple quick requests to the /ajax/jurisdictions URL, ColdBox sometimes routes to the correct resource, and sometimes runs the default event? Is this a config issue on my end, or a ColdBox bug?


    Just out of curiosity, and just because IE has burned more of my time doing weird things than I care to think about, do you get the same results using different browsers? I realize the jquery call has cache:false, but I still don’t necessarily trust all browsers to particularly honor that.

    are you using production-like settings?

    coldbox.HandlersIndexAutoReload = false;

    coldbox.ConfigAutoReload = false;

    coldbox.HandlerCaching = true;

    coldbox.eventCaching = true;

    models.objectCaching = true;

    modules.autoReload = false;

    wirebox.singletonReload = false;

    ive seen issues with multiple calls to an application in development mode.

    Do you have any settings such as configAutoReload turned on that might be reinitting the framework on each request?



    ColdBox Platform Evangelist
    Ortus Solutions, Corp

    ColdBox Platform:

    To Doug–I’ve tried in Chrome and Firefox and get similar results in both.

    To Aaron and Brad–I first encountered the problem on my local dev environment, so I was not using production settings. However, switching to the production oriented settings you listed, including ConfigAutoReload=false, did not eliminate the problem. I’ve rebuilt the machine image and restarted Railo since switching to production settings, so ColdBox should definitely be using the production settings.

    Here’s the current Coldbox.cfc I’m using to test:

    component output=“false” {

    // Configure ColdBox Application
    function configure() {
    coldbox = {

    appName = “LV”,

    debugMode = false,

    debugPassword = “”,
    reinitPassword = “”,
    handlersIndexAutoReload = false,
    ConfigAutoReload = false,

    defaultEvent = “home.index”,

    requestStartHandler = “”,
    requestEndHandler = “”,
    applicationStartHandler = “”,
    applicationEndHandler = “”,
    sessionStartHandler = “”,
    sessionEndHandler = “”,
    missingTemplateHandler = “”,

    exceptionHandler = “”,

    onInvalidEvent = “”,
    customErrorTemplate = “”,

    handlerCaching = true,

    eventCaching = true

    logbox = {
    appenders = {
    File = {
    logType = “application”
    root = {levelMin=“FATAL”, levelMax=“INFO”, appenders="*"}

    modules = {
    autoReload = false,
    include = [],
    exclude = []

    //Register interceptors as an array, we need order
    interceptors = [
    {class=“coldbox.system.interceptors.Security”, name=“ApplicationSecurity”, properties={
    useRegex = true, rulesSource=“json”, validatorModel=“LoginService”,
    rulesFile = “config/Security.json.cfm”

    flash = {
    inflateToRC = false

    layoutSettings = {
    defaultLayout = “main/main.cfm”



    As there is no code shown for the handler, then there could be a multitude of things going on. First as others have noted is the framerwork using reloading of handlers etc., I don’t think that is the issue as if anything it would just be a lot slower on each request.

    Another is that you are using session information for your request and each request is confusing the session state at the time of the request.

    Let me be very clear here, if you click on one link in the browser and then click another link in the browser, you will have two different requests going on in the background on the server. Depending on the length of time the first takes, it could be the last request to finish, therefore contaminating your session data for a user.

    So the best I can suggest is look into what scopes your data is being stored in, singletons or transients and whether there is any information being stored in the session.

    The advice to check caching and reload config was on the money, but the
    problem was in Routes.cfm, not the settings in Coldbox.cfc. In Routes.cfm I
    had setAutoReload(true). Changing it to false eliminated the problem

    Thanks for the help, everybody!


    Thanks for the update, Conan. I had been having a similar problem with my functional tests using MXUnit. Your solution also solved that problem :slight_smile: