Copy link to clipboard
Copied
We have a scheduled task that scrubs an inbox regularly and has been running like clockwork since January 2022. This sunday our IT team updated the JDK to 11.0.6 and it started timing out. I've cut the task down to the bare bones and is it still taking multiple minutes to load a single email. I wanted to know if anyone else is experiencing anything like this.
Our CF version: 2018.0.14.330003
The pared down code for the scheduled task:
<cfparam name="url.folder" default="inbox"/>
<cfparam name="url.maxrows" default="10"/>
<cfparam name="url.startRow" default="1"/>
<cftry>
<cfset local.email_username = [USER_NAME] />
<cfset local.email_password = [USER_PASS] />
<cfimap
action="open"
server="imap.gmail.com"
port="993"
username="#local.email_username#"
password="#local.email_password#"
secure="yes"
connection = "test.cf.gmail" />
<!--- get all messages from IMAP server --->
<cfimap
action="getAll"
maxrows="#url.maxrows#"
startRow="#url.startRow#"
name="emails"
folder="#url.folder#"
connection="test.cf.gmail" />
<cfdump var="#emails#" />
<cfcatch>
<cfdump var="#cfcatch#" />
</cfcatch>
</cftry>
<cftry>
<!--- close the connection --->
<cfimap
action="close"
connection="test.cf.gmail" />
<cfcatch>
<cfdump var="#cfcatch#" />
</cfcatch>
</cftry>
Copy link to clipboard
Copied
There's not any known issue (that I know of) about that combo, if you're wondering first about that.
But you say you're running 11.0.6. Did you really mean that? Or 11.0.16 (released in July?) If not the latter, have you considered updating your jvm?
Since you're using "secure" for the cfimap, this could indeed be a JVM (rather than a cf) problem. See this post of mine on the matter:
https://coldfusion.adobe.com/2019/06/error-calling-cf-via-https-solved-updating-jvm/
Let us know if it helps or not.
Copy link to clipboard
Copied
Jeffrey, any update?
Copy link to clipboard
Copied
Hi @jeffreyk34520003 ,
How long does your code take?
To measure the execution time, you could place the line
<cfset startTime=getTickCount()>
at the beginning, and the following line at the end
<!--- Store mail-fetch times in mailFetchTimes.html within current folder. --->
<cfdump var="#getTickCount()-startTime#" label="Total time to get mail" format="html" output="#expandPath('mailFetchTimes.html')#">
I ran your code on ColdFusion 2018.0.14 + JDK11.0.16, changing just the values for username and password. It took consistently 7 seconds to fetch the mail.
Copy link to clipboard
Copied
Some suggestions:
Make sure the connection to the gmail server is not impeded in anyway.