Hi, I'm having a problem with a scheduled task that chokes my server.
Its role is to analyse bounced messages.
I have been able to identify where it blocks, when analysing a line like this 
one with the regex below:
"Message-id: <26823262.22036.1411993378646.JavaMail.NS4007563$@127.0.0.1>"
<CFSET regEx = 
"[A-Za-z0-9_](\.?[A-Za-z0-9_\-]+)*@[A-Za-z0-9_\-\.]+(\.[A-Za-z]{2,6})">
The server seems to get stuck in an infinite loop.
Actually, the problem is that the function REfind takes much too long.

I narrowed the problem to the following code which shows that the time taken 
grows exponentially with the number of characters and is anyway abnormaly long :

<CFSET line="00000000000000$@">
<CFSET regEx = "([A-Z0-9]+)*@">
<CFLOOP INDEX="n" FROM="1" TO="10">
   <CFSET line = "0" & line>
   <CFSET deb=getTickCount()>
   <CFSET result = REFindNocase (regEx, line)>
   <CFSET time = (getTickCount()-deb)/1000>
   <CFOUTPUT>
   line = (#len(line)# char. = #line#
   result = #result# in #time# sec.<BR></CFOUTPUT>
</CFLOOP>

And the result is:
line = (17 char. = 000000000000000$@ result = 17 in 0.055 sec.
line = (18 char. = 0000000000000000$@ result = 18 in 0.028 sec.
line = (19 char. = 00000000000000000$@ result = 19 in 0.063 sec.
line = (20 char. = 000000000000000000$@ result = 20 in 0.113 sec.
line = (21 char. = 0000000000000000000$@ result = 21 in 0.224 sec.
line = (22 char. = 00000000000000000000$@ result = 22 in 0.447 sec.
line = (23 char. = 000000000000000000000$@ result = 23 in 0.902 sec.
line = (24 char. = 0000000000000000000000$@ result = 24 in 1.787 sec.
line = (25 char. = 00000000000000000000000$@ result = 25 in 3.574 sec.
line = (26 char. = 000000000000000000000000$@ result = 26 in 7.192 sec.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359388
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to