tracker issue : CF-3334174

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

Interfaces are slow, continuously checked if modified (implementedInterfacesChanged/getLastModifiedTime)

| View in Tracker

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

Reporter/Name(from Bugbase): KlaasJan Winkel / KlaasJan Winkel (elklaaso)

Created: 09/20/2012

Components: Performance

Versions: 9.0.1

Failure Type: Performance Issue

Found In Build/Fixed In Build: 9.0.1 /

Priority/Frequency: Major / All users will encounter

Locale/System: English / Windows 7

Vote Count: 0

Problem Description:
At each function call, coldfusion checks if the interface is implemented correctly, it checks if the interfaces files have been modified. This cannot be turned off in the admin (no caching options help with this, disable cfc type check also does not help).

Steps to Reproduce:
Create a cfc, that implements (preferrably) multiple interfaces, with a function that does something like return 1+1 (it seems not to be checked if it doesnt do anything?!).
Loop over that function from another cfc many times.

Use VisualVM -> Monitor-> CPU sampling. 

You will get many: 
at java.io.WinNTFileSystem.getLastModifiedTime(Native Method)

Thread dump looks like this (see attached file):

   java.lang.Thread.State: RUNNABLE
	at java.io.WinNTFileSystem.getLastModifiedTime(Native Method)
	at java.io.File.lastModified(File.java:826)
	at coldfusion.compiler.NeoTranslator.getLastModifiedTime(NeoTranslator.java:990)
	at coldfusion.runtime.TemplateClassLoader.getLastModifiedTime(TemplateClassLoader.java:297)
	at coldfusion.runtime.InterfaceTemplateProxyCache.getTemplateProxyFromPath(InterfaceTemplateProxyCache.java:119)
	at coldfusion.runtime.TemplateProxy.implementedInterfacesChanged(TemplateProxy.java:1472)
	at coldfusion.runtime.TemplateProxy.verifyInterfacesImpl(TemplateProxy.java:862)
	at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2297)

Actual Result:
Interface checked for changes continuously on file system.

Expected Result:
At least no interface change check within 1 request.

Any Workarounds:

It seems that this guy made a workaround using AspectJ:

http://forums.adobe.com/thread/1048647

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

Watson Bug ID:	3334174

External Customer Info:
External Company:  
External Customer Name: elklaaso
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

  1. September 20, 2012 00:00:00: 1_interfacecheckthreaddump.JPG
  2. September 20, 2012 00:00:00: 2_cpusample.JPG
  3. December 18, 2013 00:00:00: 3_lastmodifiedbugtestcase.zip
  4. December 18, 2013 00:00:00: 4_lastmodifiedbugtestcaseNEW.zip

Comments:

Made a proof of concept, discovered that it ONLY happens when calling the interface function with argumentcollection: <cfset s = {a=1,b=2} interfacedFunction(argumentCollection=s) it will be ok if explicitly called: interfacedFunction(s.a,s.b)
Comment by External U.
18050 | September 20, 2012 07:33:12 AM GMT
Calling a function f that is part of an interface with f(argumentcollection=args) .. will invoke: public final Object _invoke(Object instance, String methodName, Map args) instead of: public final Object _invoke(Object instance, String methodName, Object args[]) The first one will call templateproxy and check interface at runtime.
Comment by External U.
18051 | September 20, 2012 07:35:35 AM GMT
Have you tried using " Cache template in request" option under Server Settings > Caching? If not, try this. If you are still facing this issue then please attach a repro case.
Comment by Nimit S.
18052 | December 18, 2013 04:24:17 AM GMT
I remember i tried, but just to be sure i tried again with Cache Template in request enabled. This does not make a difference. calling an interfaced function on a cfc with NAMED arguments is a factor 3000 slower - f(argumentcollection=s) f(a=1,b=2) are slow. - f(1,2) is fast. Please see the lastmodifiedbugtestcase.zip for the cfm files that reproduce this bug. Use ?noargcol in the url to see the time it takes with non-named arugments.
Comment by External U.
18053 | December 18, 2013 08:15:28 AM GMT
Nimit, can you try it with enabling trusted cache?
Comment by Awdhesh K.
18054 | December 19, 2013 02:24:42 AM GMT
Awdhesh: Trusted cache wont help either, ive just checked. None of the caching helps even a little bit
Comment by External U.
18055 | December 19, 2013 06:42:45 AM GMT
I can't believe this is not going to be fixed in Coldfusion Splendor. I know a company that spend a week removing interfaces from cfc's because of the performance problem, this company has a lot of sites and is a major customer of Adobe.
Comment by External U.
18056 | March 04, 2014 09:22:42 AM GMT