tracker issue : CF-3041891

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

Bug 83835:(Watson Migration Closure)If the first run (since server start) new http(); occurs inside a thread, the call silently fails

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/LowImpact

Reporter/Name(from Bugbase): Mike Causer / Mike Causer (mike causer)

Created: 08/17/2010

Components: Language

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 9,0,0,249384 /

Priority/Frequency: Normal / Unknown

Locale/System: English / Mac 10 All

Vote Count: 5

Problem:

If the first run (since server start) new http(); occurs inside a thread, the call silently fails.Inside the custom tag /com/adobe/coldfusion/http.cfc on construct the private method getSupportedTagAttributes() is called, inherited from the base.cfc, which gets the allowed tag attributes from the taglib.cftld file in /WEB-INF. The results are cached in server.coldfusion.serviceTagAttributes.cfhttp.When new http() is first instantiated from within a thread, the server.coldfusion.serviceTagAttributes struct does not exist, and base.cfc's getSupportedTagAttributes() is called. Problem is, that because the function is being called from within a thread, the function does not have the correct context and does not locate the correct WEB-INF folder.Inside getSupportedTagAttributes(), the WEB-INF folder is located using getPageContext().getSerletContext().getRealPath("/WEB-INF"). When inside a thread, the getRealPath("/WEB-INF") returns:"/Users/Mike/Development/Trunk/Webroot/WEB-INF".When not in a thread, the same function call returns the correct path:"/Applications/JRun4/servers/cfusion9/cfusion-ear/cfusion-war/WEB-INF/"It seems the coldfusion.runtime.ServletContextWrapper _doGetRealPath() method is responsible for returning the webroot path instead of the base template path.The workaround for me is to instantiate a http() object on server start and discard it.This triggers the getSupportedTagAttributes() call which puts the attributes in the server.coldfusion scope making all subsequent threaded (and unthreaded) http() calls work.
Method:

getPageContext().getServletContext().getRealPath("/WEB-INF");// returns "/Applications/JRun4/servers/coldfusion9/cfusion-ear/cfusion-war/WEB-INF/"// as expected.thread action = "run" priority = "low" name = "mikesThread" {    getPageContext().getServletContext().getRealPath("/WEB-INF");}// returns: "/Users/Mike/Development/Trunk/Webroot/WEB-INF"// not as expected.-----* start coldfusion server *thread action = "run" priority = "low" name = "mikesThread" {    new http( url = "http://localhost/test.html" ).send();}// throws error:// Error [cfthread-0] - MIKESTHREAD: An error occurred when performing a file operation read on file /Users/Mike/Development/Trunk/Webroot/WEB-INF/cftags/META-INF/taglib.cftld.// first run http() construct calls base.cfc's getSupportedTagAttributes() which tries to get the allowed attributes from the taglib.cftld from the incorrect WEB-INF  resulting in a file not found-----* start coldfusion server *new http(); // this onethread action = "run" priority = "low" name = "mikesThread" {    new http( url = "http://localhost/test.html" ).send();}// works perfectly.
Result:

Error [cfthread-0] - MIKESTHREAD: An error occurred when performing a file operation read on file /Users/Mike/Development/Trunk/Webroot/WEB-INF/cftags/META-INF/taglib.cftld

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

Watson Bug ID:	3041891

External Customer Info:
External Company:  
External Customer Name: Mike Causer
External Customer Email: 5E3754C04462CDFF992016B6
External Test Config: 08/17/2010

Attachments:

Comments:

>anitkumar85 [14:25] >@mjhagen please leave a comment on the bug and I will get it evaluated.
Comment by Mingo H.
21495 | June 01, 2017 12:27:40 PM GMT