[Openmcl-devel] Trouble killing a processes

Gary Byers gb at clozure.com
Wed Oct 6 00:01:50 PDT 2010

It's not generally possible to answer the question "Is there a bug in
PROCESS-KILL in the version of CCL that I'm using ?" without knowing
what version of CCL you're using.

I don't -think- that I've ever flamed anyone for providing this
information, even if it doesn't seem to be relevant.

I couldn't reproduce any problem on any of the platforms that I tried
your example on.  The output that gets generated (what gets printed
and in what order) isn't generally predictable, and the state of the
newly-created thread when the printer looks at it - whether it's
waiting to run, running, or has already exited in response to the
PROCESS-KILL - depends on whether the thread has gotten scheduled
(which in turn depends on lots of factors and is ultimately up to the
OS's scheduler.)

Some buffered output may appear after the thread that generated it
has exited, but it's hard to understand how a lisp process that prints
as being "exhausted" (has already exited, no longer has stacks or
a native thread associated with it) can continue to generate output.
If you're in fact seeing this - if the processs sometimes prints as
"exhausted" and it continues to generate output ... well, that'd certainly
be puzzling.

Stranger things happen, but a lot of things depend on the mechanisms
that PROCESS-KILL uses working, and it's at least convenient to believe
that if those mechanisms don't work someone (lots of someones ...) would

On Tue, 5 Oct 2010, Michael Minerva wrote:

> Hey all,
> I have been having trouble killing a process in the application that I am
> currently working on, so I decided to make a simpler example using just
> basic ccl methods, and I experience the same problem.  I was wondering if
> anyone could help me understand what is going on.  My little program just
> makes a process which just prints to the console then sleeps in a loop, then
> I assign this process to a local variable, then I kill the process and print
> it out.  Often times, even after I have issues the command process-kill to
> the reference  to the process, the process continues printing.  Sometimes
> when I print the process after killing it, it says it is still active,
> sometimes it s says it is exhausted and sometimes it says it is reset.
>  According to the documentation I found about this method it is supposed to
> "Causes a specified process to cleanly exit from any ongoing computation,
> and then exit.".  Can anyone help me understand why this is not happening?  
> Here is my example program.  If you try it out make sure to run it many
> times because it will often work correctly on the first try.  Also, when you
> see the behavior I have been experiencing you will need to quit ccl to end
> the process.  
> (defun make-a-process()
>   (process-run-function
>    '(:name "my-process" :priority 1)
>    #'(lambda ()
>        (loop
>          (print "doing process things.")
>          (print *current-process*)
>          (sleep .01)))))
> (defun process-test ()
>   (let ((my-process
>          (make-a-process)))
>     (print "kill process")
>     (process-kill my-process)
>     (print *current-process*)
>     (print "after kill")
>     (print my-process)
>     nil))
> (process-test)

More information about the Openmcl-devel mailing list