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>
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:
Let us know if it helps or not.
Jeffrey, any update?
Hi @jeffreyk34520003 ,
How long does your code take?
To measure the execution time, you could place the line
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.
Make sure the connection to the gmail server is not impeded in anyway.