tracker issue : CF-3929643

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

[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: Language, CF Component

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

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

index.cfm
---------
<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:

Attachments:

Comments:

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 [https://tracker.adobe.com/#/view/CF-3335963] . 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
Hi Nitin, Very sorry for the delay! Regarding your points 1-4, in your 05/17/2019 07:31:23 GMT comment: I agree with all 4 of your points. So, please ignore the last 2 sentences in my 04/16/2015 00:22:55 GMT comment. However, the bug (title & description) are for a bigger issue: applicationStop() is ignored -after- the application has started. If you do the "Steps to reproduce" in this ticket's description, which is "Run above code multiple times in rapid succession", you will see the unexpected behavior remains: "APPLICATION.appStarted timestamp never changes until after applicationtimeout". Could this ticket please be re-opened? Thanks!, -Aaron
Comment by Aaron N.
30994 | July 07, 2019 11:36:24 PM GMT
Hi Nitin and Adobe, ApplicationStop()'s use-case has always been to safely stop the application so that the application can be safely reinitialized. It's never properly done what it set out to do. Nor has it ever finished what it set out to do. I think before we can continue further discussion on this ticket, we should first be discussing how to make ApplicationStop() even fit-for-purpose (outside of the simplest of scenarios). Possibly here: https://tracker.adobe.com/#/view/CF-3335568 Thanks!, -Aaron
Comment by Aaron N.
31002 | July 08, 2019 10:12:08 PM GMT