tracker issue : CF-3929643

select a category, or use search below
(searches all categories and all time range)

[ANeff] Bug for: applicationStop() silently ignored in Application.cfc initialization area

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/AsDesigned

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 01/28/2015

Components: CFComponent

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Normal / Few users will encounter

Locale/System: ALL / Platforms All

Vote Count: 0

component { = "myapp";
  THIS.applicationTimeout = createTimeSpan(0,0,1,0);
  applicationStop();//ignored (bug)
  function onApplicationStart() {
    APPLICATION.appStarted = now();
    return true;

<cfset writeDump(APPLICATION.appStarted)>

Steps to reproduce:
1) Run above code multiple times in rapid succession

Expected result: APPLICATION.appStarted timestamp should keep changing

Actual result: APPLICATION.appStarted timestamp never changes until after applicationtimeout

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3929643

External Customer Info:
External Company:  
External Customer Name: Aaron
External Customer Email:



Problem: applicationstop() is ignored. Code should never be ignored. Either applicationstop() should run (preferred) or throw exception. Thanks, -Aaron
Comment by External U.
8664 | February 07, 2015 03:11:51 PM GMT
Would you think this as a more widely used use-case, as the application is attempted to be stopped even before it has initialized. Let us know if you see any concerns with this?
Comment by HariKrishna K.
8665 | April 15, 2015 06:15:42 AM GMT
Hi Hari, Thank you for your follow-up! IMO this is not a widely used use-case. My primary concern was/is that a CF function was completely ignored. IMO applicationStop() should either stop the application, or it should throw an exception if it cannot do so. In this use-case, can it just throw an "applicationStop() cannot be used until the application has been initialized" exception message? Thanks!, -Aaron
Comment by External U.
8666 | April 16, 2015 12:22:55 AM GMT
We can throw the error. Its low priority and will take up later.
Comment by Awdhesh K.
8667 | August 18, 2015 07:51:24 AM GMT
Hi Aaron, We were just looking at this bug.  These are related information that i have gathered: 1)  We ignore applicationStop() if application scope is not created. This is as per the ER: Ignore duplicate applicationStop()s [] . 2) In the application.cfc we can have the _onRequestEnd_, and this will make sure that applicationStop() is called everytime. _function onRequestEnd(){_ _applicationStop();_ _}_ _3) <cfset applicationStop()>_ can be added in the end of index.cfm. This will make sure that applicationStop is called every time. 4) Throwing exception when _applicationStop()_ is called before application initialization might break the backward compatibility of CF applications. I understand that it been very long since this bug is open. But we certainly would appreciate your input on this. Do you still think that this bug needs a fix? Additionally can you help me with a valid use-case?   Thanks, Nitin   
Comment by Nitin K.
30758 | May 17, 2019 07:31:23 AM GMT
Gentle reminder! Waiting for your response.
Comment by Nitin K.
30930 | June 18, 2019 07:54:36 AM GMT