Disabling requesttimeout when using cfthread

481 views
Skip to first unread message

eddie barber

unread,
Nov 4, 2015, 2:37:02 PM11/4/15
to Lucee
I'm looking to write a background process that runs within the application context. I figured the best way to do this would be to use cfthread to create a new run, and loop within that, checking for a control variable on each iteration (in case it needs to be stopped).  However, the thread keeps dying due to the request time out setting. I can increase or decrease this using cfsetting within the cfthread tag, but I cannot disable it (setting it to 0 just makes the timeout happen almost instantly). Increasing the timeout to something very large won't work, as I'd like this thread to ideally run indefinitely.

Is there any way to prevent the timeout from occurring at all? I understand this is a potentially dangerous route to go down, as it could lead to numerous infinitely running threads that could only be killed by restarting Lucee if I'm not careful.  I have looked into both the EventGateway and Task Scheduler, but neither quite works for what I want to do, although I haven't completely ruled either out yet.

Below is what I'm seeing in thread.log

"ERROR","cfthread-8","11/04/2015","14:24:49","","cfthread-8;java.lang.ThreadDeath;java.lang.ThreadDeath
at java.lang.Thread.stop(Thread.java:850)
at lucee.commons.io.StopThread.run(SystemUtil.java:1068)
"

And below is requesttimeout.log

"ERROR","Thread-6","11/04/2015","14:24:49","controler","stop thread (6) because run into a timeout path: D:\lucee\lucee-4.5.1.024-express\webapps\ROOT\index.cfm.;java.lang.Throwable;java.lang.Throwable
at java.lang.Thread.sleep(Native Method)
at lucee.runtime.functions.system.Sleep.call(Sleep.java:28)
at index_cfm$cf.threadCall(D:\lucee\lucee-4.5.1.024-express\webapps\ROOT\index.cfm:17)
at lucee.runtime.thread.ChildThreadImpl.execute(ChildThreadImpl.java:199)
at lucee.runtime.thread.ChildThreadImpl.run(ChildThreadImpl.java:148)
"
"ERROR","Thread-23","11/04/2015","14:24:49","","Thread.stop(Throwable) is not supported by this JVM and failed with UnsupportedOperationException;java.lang.Throwable;java.lang.Throwable
at java.lang.Thread.sleep(Native Method)
at lucee.runtime.functions.system.Sleep.call(Sleep.java:28)
at index_cfm$cf.threadCall(D:\lucee\lucee-4.5.1.024-express\webapps\ROOT\index.cfm:17)
at lucee.runtime.thread.ChildThreadImpl.execute(ChildThreadImpl.java:199)
at lucee.runtime.thread.ChildThreadImpl.run(ChildThreadImpl.java:148)
"


Andrew Dixon

unread,
Nov 4, 2015, 2:42:14 PM11/4/15
to lu...@googlegroups.com
Hi Eddie,

From 4.5.1.007 the value of "zero" should give you an infinite timeout:


Maybe you just need to update?

Kind regards,

Andrew

--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/92adbd8a-346e-46ba-a02d-838c8dab2960%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aaron Terry

unread,
Nov 4, 2015, 3:04:17 PM11/4/15
to lu...@googlegroups.com
Are you running Java 1.8?

If so, sounds like the same issue that been going on in this thread the past few days.


 https://luceeserver.atlassian.net/browse/LDEV-436 fixed this and it was tagged for version 4.5.2.

The current production release is 4.5.1.xxx and doesn't have this fix in it.

The current preview release (v. 4.5.2.017) should have the fix.

I asked yesterday if anyone's running that version in production.



eddie b

unread,
Nov 4, 2015, 3:52:17 PM11/4/15
to Lucee
Thank you both for the quick replies.

Andrew, I don't think that particular bug is the issue here, as I was using the current production release (express version) - 4.5.1.024. 

Aaron, the issue you're describing sounds like it's what's happening, as I am using Java 1.8_60.  However, I just pulled down 4.5.2.017-express, and I appear to be getting the same issue.  The only difference is there is a new Error in the requesttimeout log

"ERROR","Thread-54","11/04/2015","15:45:44","",";lucee.runtime.thread.ChildThreadImpl.stop0(java.lang.Object);java.lang.NoSuchMethodException: lucee.runtime.thread.ChildThreadImpl.stop0(java.lang.Object)
at java.lang.Class.getMethod(Class.java:1786)
at lucee.commons.io.StopThread.run(SystemUtil.java:1085)
"


So not sure if the fix didn't make it into this version, or if there's something else going on. 

-Eddie

Ed Sanford, ODI Consulting.

unread,
Nov 4, 2015, 5:27:15 PM11/4/15
to Lucee
Have you tried creating a task thread instead?  Then timeouts and application tracking are unneeded. 
Status and errors show up in the tasks section of the admin - until the thread completes successfully. 
The only time you'd need to set app vars is for users to be able to track progress.
One minor thing with task threads: put all the input vars needed by the thread into the attribute collection used to call it.  Task threads are not tied to current page/request/session etc.
I've noticed that task threads also do a better job of maintaining good server performance under load.

eddie b

unread,
Nov 4, 2015, 5:48:23 PM11/4/15
to Lucee
Hi Ed,

I have tried creating a task thread, and I still run into the timeout. Only real difference in errors I get in the logs is in the requesttimeout.log, I get 

"ERROR","Thread-31","11/04/2015","17:42:28","",";lucee.runtime.spooler.SpoolerEngineImpl$TaskThread.stop0(java.lang.Object);java.lang.NoSuchMethodException: lucee.runtime.spooler.SpoolerEngineImpl$TaskThread.stop0(java.lang.Object)
at java.lang.Class.getMethod(Class.java:1786)
at lucee.commons.io.StopThread.run(SystemUtil.java:1085)
"

So basically the same error of the stop0 method not existing. 


Eddie

Ricky

unread,
Jan 3, 2016, 1:07:12 PM1/3/16
to Lucee
Apologies for resurrecting a old-ish thread, but I'm in pretty much the exact position as Eddie.  Need an infinitely running poller thread.  Thread dies after timeout settings.  Setting requesttimeout=0 just causes the thread to die immediately.  

I've tried this on Lucee version 4.5.2.018 (Java8) and Lucee version 4.5.2.017 (Java7).  

Ricky

unread,
Jan 6, 2016, 1:24:39 AM1/6/16
to Lucee
I "solved" this by simply using a ridiculous requesttimeout (2147483647 seconds).  Comes out to about 68 years, which might as well be infinite.  If this application is still in production and hasn't restarted after 68 years, then a thread timeout will be the least of my worries.
Reply all
Reply to author
Forward
0 new messages