Terminate a cfthread doesn't work

Hi.
I have a problem with a long running thread want to be able to terminate
while its running.
The task uses cfthread to re-schedule it self after performing n number of
sub-tasks and can be running for days.
This part works well, but hen trying to terminate the thread from another
script i get this error:
there is no thread running with the name [longrunning_thread] at
lucee.runtime.tag.ThreadTag.doTerminate(…

To reproduce this error, consider these two scripts:

script 1:
<! this script is running 30 times during a period of 30s ->

sleep(1000); request.count++;
<cfif request.count LT 30>

    <cfhttp url="[url]/thread.cfm?count=#request.count#" redirect="yes" 

resolveurl=“no” throwonerror=“yes” timeout=“3600” />

</cfif> 

script 2:
<! should terminate the running thread ->

Is this a bug or am I doing something wrong?

I don’t think another thread (script 2) can see or terminate a thread
started by script 1, although I must admit I’m not sure.
Anyway, for your use case I would create a gateway. They’re quite easy to
implement, see this page on the Railo
wiki: https://github.com/getrailo/railo/wiki/Create-your-own-Event-Gateway-type

I did some work around managing threads started with CFThread from within
other processes. I blogged about it here:
http://domwatson.codes/2015/01/manipulating-railo-cfthreads.html. We use it
to be able to terminate and monitor scheduled tasks from our own scheduled
task manager.

HTH

DominicOn 26 May 2015 at 10:51, Anders Thulin <@Anders_Thulin> wrote:

Hi.
I have a problem with a long running thread want to be able to terminate
while its running.
The task uses cfthread to re-schedule it self after performing n number of
sub-tasks and can be running for days.
This part works well, but hen trying to terminate the thread from another
script i get this error:
there is no thread running with the name [longrunning_thread] at
lucee.runtime.tag.ThreadTag.doTerminate(…

To reproduce this error, consider these two scripts:

script 1:
<! this script is running 30 times during a period of 30s ->

sleep(1000); request.count++;
<cfif request.count LT 30>

    <cfhttp url="[url]/thread.cfm?count=#request.count#"

redirect=“yes” resolveurl=“no” throwonerror=“yes” timeout=“3600” />

</cfif>

script 2:
<! should terminate the running thread ->

Is this a bug or am I doing something wrong?


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+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/e06a0830-28dc-4f37-94bb-1a6d2e041edd%40googlegroups.com
https://groups.google.com/d/msgid/lucee/e06a0830-28dc-4f37-94bb-1a6d2e041edd%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom

T: +44 [0] 845 260 0726• W: www.pixl8.co.uk• E: info@pixl8.co.uk
Follow us on: Facebook http://www.facebook.com/pixl8 Twitter
http://www.twitter.com/pixl8 LinkedIn
http://www.linkedin.com/pixl8CONFIDENTIAL
AND PRIVILEGED - This e-mail and any attachment is intended solely for the
addressee, is strictly confidential and may also be subject to legal,
professional or other privilege or may be protected by work product
immunity or other legal rules. If you are not the addressee please do not
read, print, re-transmit, store or act in reliance on it or any
attachments. Instead, please email it back to the sender and then
immediately permanently delete it. Pixl8 Interactive Ltd Registered in
England. Registered number: 04336501. Registered office: 8 Spur Road,
Cosham, Portsmouth, Hampshire, PO6 3EB