Programmatically kill a cfthread spawned from anywhere
12/09/2008In certain instances where you have endlessly running/sleeping
'monitoring' threads, there is effectively no way to kill them short of
a CF server cycle or via the CF8 server monitor.
I had this
issue during development where inside an app scoped component I was
creating two 'monitor' threads, which were charged with monitoring two
separate queues, sleeping every few seconds. Whenever the app scope
was reinitialized, two more threads would be created, up to the point
where all threads were utilized and the app bombed due to the lingering
(and idle) threads left from the previous instantiation.
CFThreads
are not application specific, they are bound to the server;
furthermore, multiple threads with the same name can be created in
different requests. In order to attempt to 'bind' a thread to a given
application, I recommend prefixing all threads with an
application-specific unique string prefix; this will allow you to use
the prefix argument of the UDF below and effectively kill only those threads which were
spawned from a particular application.
Given all this, I created the following UDF which allows you to kill any cfthread, either by name or by prefix string.
Adventures in bad variable names
11/25/2008There are many built-in, always-there variable scopes in CF, including #cgi#, #form#, #url#, etc., and one does well to avoid using these names for anything other than their intended purpose. However, I was doing a CFHTTP call (in CF8) and set the result attribute to 'http' (the result attribute allows you to specify the return variable name rather than receive the 'cfhttp' default) and immediately had issues.
I discovered, to my surprise, that 'http' is synonymous with 'cgi' - at least under CF8/IIS6. I actually would have expected it to be synonymous with 'cfhttp' (I seem to recall that 'http' was the fixed return variable name from cfhttp calls in earlier versions of CF?).
Anyway, if I ever need cgi environment variable values I use, of course, #cgi#. I don't ever recall using #http# and never suspected it existed. Begs the question why synonymous scope names even exist.
Anyway, weird.
DBX 10.1.8 Released
11/18/2008Minor update in this version:
- when launching the SQL*Exec window from the table or view detail page, the populated sql now has the columns [bracketed] (by request)
- increased the default size of the textarea in the SQLExec window since although its actually sizable by way of resizing the frames, the frames are difficult to see/resize
Also, it seems that RIAForge still suffers from its frequent downtime, so I've added a new alternate download link for DBX on the Projects page.