• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 682
  • Last Modified:

Coldfusion System Failure: Out of memory

Hi,

I am getting an out of memory error in coldfusion (see stack trace below). The error occures when calling a webservice through cfinvoke. I think there is a memory leak
in my program. I installed fusionreactor and i am seeing a strange pattern (see attachment). Increasing heap size did not do anything, increasing page file does seem to work. Now the important question: How do i find a memory leak in coldfusion 9 (64bit). I tried to install jrockit but coldfusion would not start.
 

-----------------------
coldfusion.jsp.CompilationFailedException: Errors reported by Java compiler: ***System Failure: Out of memory . at
coldfusion.jsp.JavaCompiler.compileClass(JavaCompiler.java:152) at
coldfusion.xml.rpc.XmlRpcServiceImpl$2.run(XmlRpcServiceImpl.java:294) at
java.security.AccessController.doPrivileged(Native Method) at
coldfusion.xml.rpc.XmlRpcServiceImpl.registerWebService(XmlRpcServiceImpl.java:270) at
coldfusion.xml.rpc.XmlRpcServiceImpl.getWebService(XmlRpcServiceImpl.java:496) at
coldfusion.xml.rpc.XmlRpcServiceImpl.getWebServiceProxy(XmlRpcServiceImpl.java:450) at
coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:438) at
cfscrapeable_file2ecfm1483786449._factor2(E:\sites\execute\scrapeable_file.cfm:79) at
cfscrapeable_file2ecfm1483786449._factor4(E:\sites\execute\scrapeable_file.cfm:68) at
cfscrapeable_file2ecfm1483786449._factor7(E:\sites\execute\scrapeable_file.cfm:49) at
cfscrapeable_file2ecfm1483786449._factor8(E:\sites\execute\scrapeable_file.cfm:32) at
cfscrapeable_file2ecfm1483786449._factor10(E:\sites\execute\scrapeable_file.cfm:31) at
cfscrapeable_file2ecfm1483786449._factor11(E:\sites\execute\scrapeable_file.cfm:8) at
cfscrapeable_file2ecfm1483786449.runPage(E:\sites\execute\scrapeable_file.cfm:1) at
coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231) at
coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416) at
coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at
coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:363) at
coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at
coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at
coldfusion.filter.PathFilter.invoke(PathFilter.java:87) at
coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at
coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at
coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at
coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) at
coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at
coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at
coldfusion.filter.CachingFilter.invoke(CachingFilter.java:53) at
coldfusion.CfmServlet.service(CfmServlet.java:200) at
coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at
jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at
com.intergral.fusionreactor.filter.FusionReactorFilter.c(FusionReactorFilter.java:428) at
com.intergral.fusionreactor.filter.FusionReactorFilter.d(FusionReactorFilter.java:262) at
com.intergral.fusionreactor.filter.FusionReactorFilter.doFilter(FusionReactorFilter.java:171) at
jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at
coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at
coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at
jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at
jrun.servlet.FilterChain.service(FilterChain.java:101) at
jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at
jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at
jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at
jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320) at
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at
jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266) at
jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

----------------------

memory-leak.jpg
0
Nebukad
Asked:
Nebukad
  • 3
1 Solution
 
Tomarse111Commented:
That strange pattern should be the normal garbage collection as work; it peaks, gets dropped and slowly builds backup to then repeat itself. That graph is normal.

From your dump, what are you running at:

E:\sites\execute\scrapeable_file.cfm:79

??
0
 
NebukadAuthor Commented:
Thanks for your response. There is no simple answer to your question. The error occures when a webservice is invoked. Below the code of the webservice.
<cfinvoke webservice="http://10.0.0.1:84/_webservices/getwebsite.cfc?wsdl" method="getSitev3" returnvariable="objectHTTP" refreshWSDL="yes">
	<cfinvokeargument name="pass_url" value="#trim(session_replaceVariable(webscraper_scrapeable_file_url))#"/>
	<cfinvokeargument name="pass_cookie" value=""/>
	<cfinvokeargument name="pass_variables" value="#local_variables#"/>
	<cfinvokeargument name="pass_httpuseragent" value="#session_getVariable('webscraper_httpuseragent')#"/>
	<cfinvokeargument name="pass_httphost" value="#session_getVariable('webscraper_httphost')#"/>
	<cfinvokeargument name="pass_httpport" value="#session_getVariable('webscraper_httpport')#"/>
	<cfinvokeargument name="pass_debug" value="false"/>
	<cfinvokeargument name="pass_remember_cookie" value="#urldecode(previousCookies)#"/>
</cfinvoke>

Open in new window


code block: http://10.0.0.1:84/_webservices/getwebsite.cfc?wsdl
<cfcomponent>
	<cffunction name="getSitev3" access="remote" returntype="struct" output="no">
		<cfargument name="pass_url" type="any">
		<cfargument name="pass_cookie" type="string">
		<cfargument name="pass_variables" type="array" >
		<cfargument name="pass_httpuseragent" type="string" >
		<cfargument name="pass_httphost" type="string" >
		<cfargument name="pass_httpport" type="string" >
		<cfargument name="pass_debug" type="boolean" >
		<cfargument name="pass_remember_cookie" type="any" default="">
		<cfset var websitedata = '' />
		<cfset var i = '' />

		<cfset websitedata=structnew()>
		<cfif arrayLen(pass_variables) gt 0>
			<cfloop from=1 to=#arrayLen(pass_variables)# index="i">
				<cfif #pass_variables[i][3]# eq 'formfield'>
					<cfset "websitedata.uri_formfield_#rereplace(pass_variables[i][1],'[^A-Za-z0-9_]','_','all')#" = #replace(pass_variables[i][2],'"','"','all')#>
				<cfelseif #pass_variables[i][3]# eq 'url'>
					<cfset "websitedata.uri_url_#rereplace(pass_variables[i][1],'[^A-Za-z0-9_]','_','all')#" = #replace(pass_variables[i][2],'"','"','all')#>
				<cfelseif #pass_variables[i][3]# eq 'cookie'>
					<cfset "websitedata.uri_cookie_#rereplace(pass_variables[i][1],'[^A-Za-z0-9_]','_','all')#" = #pass_variables[i][2]#>
				<cfelseif #pass_variables[i][3]# eq 'header'>
					<cfset "websitedata.uri_cookie_#rereplace(pass_variables[i][1],'[^A-Za-z0-9_]','_','all')#" = #pass_variables[i][2]#>
				<cfelseif #pass_variables[i][3]# eq 'body'>
					<cfset "websitedata.uri_body_#rereplace(pass_variables[i][1],'[^A-Za-z0-9_]','_','all')#" = #replace(pass_variables[i][2],'"','"','all')#>
				</cfif>
			</cfloop>
		</cfif>


		<cfhttp  URL="http://10.0.0.1:84/_webservices/getwebsite_url.cfm?debug=#pass_debug#" timeout="120" method="post">
			<cfhttpparam type="header" name="Cache-Control" value="no-cache">
			<cfhttpparam type="Formfield" value="#pass_url#" name="weburl">
			<cfhttpparam type="Formfield" value="#pass_httpuseragent#" name="$httpuseragent$">
			<cfhttpparam type="Formfield" value="#pass_httphost#" name="$httphost$">
			<cfhttpparam type="Formfield" value="#pass_httpport#" name="$httpport$">
			<cfhttpparam type="Formfield" value="#pass_remember_cookie#" name="$COOKIE_STRING">

		 	<cfif arrayLen(pass_variables) gt 0>
				<cfloop from=1 to=#arrayLen(pass_variables)# index="i">
					<cfif #pass_variables[i][3]# eq 'formfield'>
						<cfhttpparam type="Formfield" value="#replace(pass_variables[i][2],'"','"','all')#" name="$FORMFIELD_#cfhttp_NameToAsc(pass_variables[i][1])#">
					<cfelseif #pass_variables[i][3]# eq 'cookie'>
						<cfhttpparam type="Formfield" value="#replace(pass_variables[i][2],'"','"','all')#" name="$COOKIE_APPEND_#cfhttp_NameToAsc(pass_variables[i][1])#">
					<cfelseif #pass_variables[i][3]# eq 'url'>
						<cfhttpparam type="Formfield" value="#replace(pass_variables[i][2],'"','"','all')#" name="$URL_#cfhttp_NameToAsc(pass_variables[i][1])#">
					<cfelseif #pass_variables[i][3]# eq 'header'>
						<cfhttpparam type="Formfield" value="#replace(pass_variables[i][2],'"','"','all')#" name="$HEADER_#cfhttp_NameToAsc(pass_variables[i][1])#">
					<cfelseif #pass_variables[i][3]# eq 'body'>
						<cfhttpparam type="Formfield" value="#replace(pass_variables[i][2],'"','"','all')#" name="$BODY_#cfhttp_NameToAsc(pass_variables[i][1])#">
					</cfif>
				</cfloop>
			</cfif>
		</cfhttp>
		<cfset websitedata.mimeType = #cfhttp.mimeType#>
		<cfset websitedata.header = #cfhttp.header#>
		<cfset websitedata.responseheader = #cfhttp.responseheader#>
		<cfset websitedata.responseBody = #rereplace(cfhttp.fileContent,'[^\x09-\xFF]',' ','all')#>
		<cfset websitedata.status = #left(cfhttp.statuscode,3)#>
		<cftry><cfset websitedata.cookies = #cfhttp.ResponseHeader["Set-Cookie"]#>
		<cfcatch type="any"><cfset websitedata.cookies = ""></cfcatch></cftry>
		<cfset websitedata.uri = #pass_url#>
		<cfset websitedata.charSet = #cfhttp.charSet#>
		<cfreturn websitedata>
	</cffunction>

	<cffunction name="cfhttp_NameToAsc">
		<cfargument name="in" required="no" default="">
		<cfset var post_retaintCase_i = '' />
		<cfset var out = ''>

		<cfloop from=1 to="#len(in)#" index="post_retaintCase_i">
			<cfif out eq ''><cfset out = '[[SC[['>
			<cfelse><cfset out = "#out#."></cfif>
			<cfoutput><cfset out = "#out##asc(mid(in,post_retaintCase_i,1))#"></cfoutput>
		</cfloop>
		<cfif out eq  ''><cfreturn out>
		<cfelse><cfreturn "#out#]]EC]]"></cfif>
	</cffunction>



</cfcomponent>

Open in new window


code block: http://10.0.0.1:84/_webservices/getwebsite_url.cfm
<cfset remember_cookies = arrayNew(2)>
<cfset remember_numberofconnections = 0>
<cfloop collection=#form# item="key">
	<cfset form["#cfhttp_NameToChr(key).out#"] = #form[key]#>
	<cfif cfhttp_NameToChr(key).converted>
		<cfset StructDelete( form , key )> 
	</cfif> 
</cfloop>

<cfset #cfhttp_CookiesToArray(form.$COOKIE_STRING)#>


<cfloop collection="#form#" item="fi">
	<cfif refind('^\$COOKIE_APPEND.*',fi) gt 0>
		<cfset temp_append_cookie = "#rereplace(fi,'\$COOKIE_APPEND_(.*?)','\1','one')#=#StructFind(form,fi)#">
		<cfif find(';',temp_append_cookie) eq 0><cfset temp_append_cookie = "#temp_append_cookie#;"></cfif>
		<cfset cfhttp_CookiesSave(temp_append_cookie)>
	</cfif>
</cfloop>
<cfset form.$COOKIE_STRING = cfhttp_CookiesPostable()>

<cfif form.$httpuseragent$ eq ''>
	<cfset form.$httpuseragent$ = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729)'>
</cfif>
<cfif trim(form.$httpport$) eq ''>
	<cfset form.$httpport$ = 80>
</cfif>

<cfset form.$httpmethod$ = 'get'>
<cfloop collection="#form#" item="fi">
	<cfif refind('^\$FORMFIELD_.*',fi) gt 0>
		<cfset form.$httpmethod$ = 'post'>
	</cfif>
	<cfif refind('^\$BODY_.*',fi) gt 0>
		<cfset form.$httpmethod$ = 'post'>
	</cfif>
</cfloop>

<cfloop CONDITION="#remember_numberofconnections# lte 4">
	<cfset remember_numberofconnections = remember_numberofconnections+1>

	<cfhttp redirect="no" method="#form.$httpmethod$#" timeout="30" getasbinary="yes" url="#form.weburl#" charset="utf-8" userAgent="#form.$httpuseragent$#" proxyServer="#form.$httphost$#" proxyPort="#form.$httpport$#">
		<cfhttpparam type="header" name="Accept-Encoding" Value="no-compression"> 
		<cfhttpparam type="header" name="Cache-Control" value="no-cache"> 
		<cfloop collection="#form#" item="fi">
			<cfif refind('^\$URL_.*',fi) gt 0>
				<cfif refind('^\$URL_EMPTY.*',fi) gt 0><cfhttpparam type="URL" value="" name="#StructFind(form,fi)#">
				<cfelse><cfhttpparam type="URL" value="#StructFind(form,fi)#" name="#rereplace(fi,'\$URL_(.*?)','\1','one')#"></cfif>
			</cfif>
			<cfif refind('^\$FORMFIELD_.*',fi) gt 0>
				<cfif refind('^\$FORMFIELD_EMPTY.*',fi) gt 0><cfhttpparam type="FormField" value="" name="#StructFind(form,fi)#">
				<Cfelse><cfhttpparam type="FormField" value="#StructFind(form,fi)#" name="#rereplace(fi,'\$FORMFIELD_(.*?)','\1','one')#"></cfif>
			</cfif>
			<cfif refind('^\$HEADER_.*',fi) gt 0>
				<cfif refind('^\$FORMFIELD_EMPTY.*',fi) gt 0><cfhttpparam type="header" value="" name="#StructFind(form,fi)#">
				<Cfelse><cfhttpparam type="header" value="#StructFind(form,fi)#" name="#rereplace(fi,'\$HEADER_(.*?)','\1','one')#"></cfif>
			</cfif>
			<cfif refind('^\$BODY_.*',fi) gt 0>
				<cfif refind('^\$BODY_EMPTY.*',fi) gt 0><cfhttpparam type="body" value="">
				<Cfelse><cfhttpparam type="body" value='#StructFind(form,fi)#'></cfif>
			</cfif>
		</cfloop>

		<cfloop from=1 to="#listlen(form.$COOKIE_STRING,chr(1000))#" index="i">
			<cfset founditem="#listgetat(form.$COOKIE_STRING,i,chr(1000))#">
			<cfif find(';',founditem) eq 0>
				<cfhttpparam type="cookie" name="#left(founditem,find('=',founditem)-1)#" value="#mid(founditem,find('=',founditem)+1,len(founditem))#">
			<cfelse>
				<cfhttpparam type="cookie" name="#left(founditem,find('=',founditem)-1)#" value="#mid(founditem,find('=',founditem)+1,find(';',founditem)-find('=',founditem)-1)#">
			</cfif>
		</cfloop>
	</cfhttp>
	<cfif #refind('^3[0-9]{2}',cfhttp.Statuscode,false)# gt 0>
		<cfif isdefined("cfhttp.Responseheader.Location")>
			<cfset form.weburl = #regex_UrlRelToAbs(cfhttp.Responseheader.Location,form.weburl)#>
			<cfif structKeyExists(cfhttp.Responseheader,'Set-Cookie')>
				<cfset cfhttp_CookiesSave(#cfhttp.Responseheader['Set-Cookie']#)>
				<cfset form.$COOKIE_STRING = cfhttp_CookiesPostable()>
			</cfif>
		<cfelse>
			<cfbreak>
		</cfif>	
	<cfelse>
		<cfbreak>
	</cfif>
</cfloop>


<cfif cfhttp.errorDetail eq ''>
	<cfset mycharset = "">
	<cfset mycharset = #cfhttp.Charset#>
	<cfset filec = #ToString(cfhttp.fileContent)#>
	<cfif len(mycharset) eq 0>
		<cfset mycharset = "ISO-8859-1">
		<cfset pat = "(?i)<META(.*)charset=\s*([^\s|^""|^']*)">	
		<cfif #refindnocase(pat,filec)# gt 0>
			<cfset local_re = #refindnocase(pat,filec,1,true)#>
			<cfif local_re.len[3] gt 0>
				<cfset mycharset = #Mid(filec,local_re.pos[3],local_re.len[3])#>
			<cfelse>
				<cfset mycharset = #Mid(filec,local_re.pos[2],local_re.len[2])#>
				<cfset mycharset = trim(rereplacenocase(mycharset,'.*charset=([^>^' & "'" & '^"]+).*','\1','one'))>
			</cfif>
		</cfif>
	</cfif>
	<cfif mycharset neq 'utf-8'>
		<cftry>
			<cfset filec = CharsetEncode(cfhttp.fileContent, mycharset)>
			<cfset filec = #ToString(filec)#>
			<cfcatch type="any">
				<cfset filec = #ToString(cfhttp.fileContent)#>
			</cfcatch>
		</cftry>
	</cfif>
<cfcontent type="text/html; charset=#mycharset#"> 
<cfheader statuscode="#cfhttp.Responseheader.Status_Code#" statustext=""/>
<cfheader name="location" value="#form.weburl#"	/>
<cftry>
 	<cfif StructKeyExists(cfhttp.Responseheader,"Set-Cookie")>
		<cftry>
			<cfloop collection="#cfhttp.Responseheader["Set-Cookie"]#" item="getcookie">
				<cfheader name="Set-Cookie" value="#cfhttp.Responseheader["Set-Cookie"][getcookie]#"/>
			</cfloop>
			<cfcatch type="any"><cfheader name="Set-Cookie" value="#cfhttp.Responseheader["Set-Cookie"]#"/></cfcatch>
		</cftry>
	<cfelse>
		<cfheader name="Set-Cookie" value=""/>
	</cfif>
	<cfcatch type="any"><cfheader name="Set-Cookie" value=""/></cfcatch>
</cftry>
<cfoutput>#HttpContentStrip(filec)#</cfoutput>
<cfelse>
<cfcontent type="text/html; charset=utf-8"> 
<cfheader statuscode="399" statustext="See Other"/>
<cfheader name="location" value="#form.weburl#"	/>
<cfheader name="Set-Cookie" value=""/>
<cfoutput>#cfhttp.errorDetail#</cfoutput>
</cfif>

<cffunction name="HttpContentStrip">
	<cfargument name="in" required="no" default="">
	<cfset var out= #replace(in,chr(27),' ','all')#>
	<cfreturn out>	
</cffunction>

<cffunction name="cfhttp_CookiesSave">
	<cfargument name="in">
	<cfset var doloop = false>
	<cfset var arrLen = ''>
	<Cfset var curItem = ''>
	<cfset var curItemName = ''>
	<cfset var curItemFound = false>

	<cfif IsStruct(in)><cfif StructCount(in) gt 0><cfset doloop = true></cfif>
	<cfelseif in neq ''><cfset doloop = true></cfif>

	<cfif doloop>
		<cfset in=cfhttp_CookiesToString(in)>
		<cfset arrLen = Evaluate("arraylen(remember_cookies)")>

		<cfloop from=1 to="#listlen(in,chr(1000))#" index="i">
			<cfset curItem = #listgetAt(in,i,chr(1000))#>
			<cfset curItemName =#left(curItem,find('=',curItem)-1)#>

			<cfset curItemFound = false>
			<cfloop from=1 to="#arrLen#" index="j">
				<cfif curItemName eq evaluate("remember_cookies[j][1]")>
					<cfset curItemFound = true>
					<cfset evaluate("remember_cookies[j][1]=curItemName")>
					<cfset evaluate("remember_cookies[j][2]=curItem")>
				</cfif>
			</cfloop>
	
			<cfif not curItemFound>
				<cfset arrLen = arraylen(evaluate("remember_cookies"))>
				<cfset evaluate("remember_cookies[arrLen+1][1]=curItemName")>
				<cfset evaluate("remember_cookies[arrLen+1][2]=curItem")>
			</cfif>
		</cfloop>
	</cfif>
</cffunction>

<cffunction name="cfhttp_CookiesPostable">
	<cfset var out = ''>
	<cfset var arrLen = Evaluate("arraylen(remember_cookies)")>
	<cfloop from=1 to='#arrLen#' index="j">
		<cfset out= "#out##evaluate("remember_cookies[j][2]")#">
		<cfif arrLen gt j><cfset out = "#out##chr(1000)#"></cfif> 
	</cfloop>
	<cfreturn out>
</cffunction>

<cffunction name="cfhttp_CookiesToString">
	<cfargument name="cfhttp_CookiesToString_in">
	<cfset var cfhttp_CookiesToString_out = ''>

	<cfif isStruct(cfhttp_CookiesToString_in)>
		<cfset cfhttp_CookiesToString_out = ''>
		<cfloop collection="#cfhttp_CookiesToString_in#" item="cfhttp_CookiesToString_item">
			<cfif cfhttp_CookiesToString_out neq ''><cfset cfhttp_CookiesToString_out = "#cfhttp_CookiesToString_out##chr(1000)#"></cfif>
			<cfset cfhttp_CookiesToString_out="#cfhttp_CookiesToString_out##evaluate("cfhttp_CookiesToString_in.#cfhttp_CookiesToString_item#")#">
		</cfloop>
		<cfreturn cfhttp_CookiesToString_out>
	</cfif>
	<cfreturn cfhttp_CookiesToString_in>
</cffunction>

<cffunction name="cfhttp_CookiesToArray">
	<cfargument name="in">
	<cfloop from=1 to="#listlen(in,chr(1000))#" index="i">
		<cfset founditem="#listgetat(in,i,chr(1000))#">
		<cfset remember_cookies[i][1] = #left(founditem,find('=',founditem)-1)#>
		<cfset remember_cookies[i][2] = #founditem#>
	</cfloop>
</cffunction>

<cffunction name="cfhttp_NameToChr">
	<cfargument name="in" required="no" default=1>
	<cfset var ret = structNew()>
	<cfset in = replacenocase(in,'[[SC[[]]EC]]','','all')>
	<cfset var start = #evaluate(findNoCase('[[SC[[',in)+6)#>
	<cfset var end = #evaluate(findNoCase(']]EC]]',in)-start)#>
	<cfif start gt 0 AND end gt 0>
		<cfset var asclist = mid(in,start,end)>
		<cfset var out = ''>
		<cfloop from=1 to="#listlen(asclist,".")#" index="cfhttp_NameToChr_i">
			<cfset out = "#out##chr(listgetat(asclist,cfhttp_NameToChr_i,"."))#">
		</cfloop>
		<cfset out = rereplace(in,'\[\[SC.*?\]\]EC\]\]',out,'one')>
		<cfset ret.converted = true>
		<cfset ret.out = out>
		<cfreturn ret>
	<cfelse>
		<cfset ret.converted = false>
		<cfset ret.out = in>
		<cfreturn ret>
	</cfif>
</cffunction>

<cffunction name="regex_UrlRelToAbs">
	<cfargument name="RelativePath">
	<cfargument name="AbsolutePath">
	<cfset var tempstruct = structnew()>
	<cfset var AbsolutePath_arr = ''>

	<cfset RelativePath=ReplaceNoCase(RelativePath,"&apos;","'","ALL")>
	<cfset RelativePath=ReplaceNoCase(RelativePath,"&quot;","""","ALL")>
	<cfset RelativePath=ReplaceNoCase(RelativePath,"&lt;","<","ALL")>
	<cfset RelativePath=ReplaceNoCase(RelativePath,"&gt;",">","ALL")>
	<cfset RelativePath=ReplaceNoCase(RelativePath,"&amp;","&","ALL")>

	<cfif isvalid('url',RelativePath)><cfreturn RelativePath></cfif>

	<cfif refind('^\/\/',RelativePath)>
		<cfset RelativePath = rereplace(RelativePath,'^\/\/','','one')>
		<cfreturn "http://#RelativePath#">
	</cfif>

	<cfset tempstruct.domain =  reReplace(AbsolutePath,"(^\w+://)([^\/:]+)[\w\W]*$","\1\2","one") />

	<cfset AbsolutePath_arr = #refind("^((http[s]?|ftp):\/)?\/?([^:\/\s]+)(([A-Za-z0-9_\/\%\(\)]+)*\/)([A-Za-z0-9_\-\.\%\(\)]+[^##?\s]+)(.+)?(##[\w\-]+)?$",AbsolutePath,1,true)#>

	<cftry>
		<cfif AbsolutePath_arr.len[5] gt 0>
			<cfset tempstruct.folders =  #trim(mid(AbsolutePath,AbsolutePath_arr.pos[5],AbsolutePath_arr.len[5]))#>
		<cfelse>
			<cfset tempstruct.folders =  ''>
		</cfif>
		<cfcatch type="any">
			<cfset tempstruct.folders =  ''>
		</cfcatch>
	</cftry> 

	<cfif left(RelativePath,1) eq '/'>
		<cfreturn "#tempstruct.domain##RelativePath#">
	<cfelseif left(RelativePath,1) neq '.'>
		<cfreturn "#tempstruct.domain##tempstruct.folders##RelativePath#">
	<cfelse>
		<cfset regex_UrlProperties_oc = #arraylen(rematch('(\.\./|\./)',RelativePath))#>
		<cfset regex_UrlProperties_newF = ''>
		<cfloop from=1 to=#listlen(tempstruct.folders,'/')-regex_UrlProperties_oc# index="i"><cfset regex_UrlProperties_newF = "#regex_UrlProperties_newF##listgetAt(tempstruct.folders,i,'/')#/"></cfloop>
		<cfreturn "#tempstruct.domain#/#regex_UrlProperties_newF##rereplace(RelativePath,'(\.\./|\./)','','all')#">
	</cfif>
</cffunction>

Open in new window

0
 
NebukadAuthor Commented:
Solved the memory issue by executing the follow code that empties java's memory

	<Cfset runtime = CreateObject("java","java.lang.Runtime").getRuntime()>
	<cfset fm = runtime.freememory()/>
	<Cfset fm = int((fm/1024)/1024)/>
	<cfset usedmem = 2900-fm/>

	<cfif usedmem gt 2200>
		<cfset session_addLogToDatabase('Empty garbage ','Warning','')>
		<cfset obj = createObject("java","java.lang.System")/>
	    <cfset obj.gc()/>
	    <cfset obj.runFinalization()/>
	</cfif>

Open in new window

0
 
NebukadAuthor Commented:
No responses in the last days and this solution does seem to work.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now