[info-mcl] process crash
Terje Norderhaug
terje at in-progress.com
Tue Jul 21 13:39:45 CDT 2009
On Jul 20, 2009, at 4:22 PM, Alexander Repenning wrote:
> Just wondering... has anybody found any work around the process
> problems in RMCL. At least so far I have not been able to use
> process-run-function in a way that is NOT causing a crash.
I have found that there are some situations in which starting a
process on RMCL leads to a crash (G4/OSX 10.4.11) while starting a
process works fine in other situations. Perhaps by mapping it out, we
can find patterns and clues to resolve the issue?
As I've mentioned already, evaluating a process-run-function in the
listener typically leads to a crash:
(process-run-function "Seldom Starts" (lambda ()()))
However, sometimes even that works fine (after RMCL has been running
for some time?).
An eval-enqueue of a process-run-function in the listener usually
also leads to a crash:
(eval-enqueue `(process-run-function "Usually Crashes" #'(lambda ()())))
However, sometimes eval-enqueue with a process-run-function works
fine even shortly after starting up RMCL, after which evaluating
process-run-function in the listener suddenly also works.
Opening a New Listener from the File menu consistently works fine for
me. It implicitly creates a new process as listed in the Processes
inspector. So it is possible to create new processes.
Starting a process from a dialog item action function seems also to
consistently work fine:
(add-subviews (make-instance 'window)
(make-dialog-item 'button-dialog-item nil nil "Start Process"
(lambda (b)
(declare (ignore b))
(process-run-function "OK" (lambda ()(sleep 30))))))
However, making a dialog item action function eval-enqueue the
process-run-function usually induces a crash when clicking the button:
(add-subviews (make-instance 'window)
(make-dialog-item 'button-dialog-item nil nil "Start Process"
(lambda (b)
(declare (ignore b))
(eval-enqueue `(process-run-function "Usually Crashes"
#'(lambda ()()))))))
An init.lisp file in the RMCL folder with the form below loads fine
at startup. The process can be seen in the Processes inspector:
(ccl::process-run-function "Init" (lambda ()(sleep 30)))
However, load the same file from the listener and you'll likely get a
crash:
(load "ccl:init.lisp")
Here is a simple tcp client/server that forks a new process on each
request. Place the following in an init.lisp in the RMCL folder:
(in-package :ccl)
(require :opentransport)
(process-run-function "Server"
(lambda ()
(loop
for i from 0
do (with-open-stream (server (open-tcp-stream nil 8888))
(process-wait (write-to-string i) (lambda ()(listen
server)))
(format server "Hello ~A~%" i)
(force-output server)
(process-run-function "crash?" (lambda ()(sleep 30)))))))
(defun connect ()
(with-open-stream (connection (open-tcp-stream (local-interface-ip-
address) 8888))
(telnet-write-line connection "Hello?")
(telnet-read-line connection)))
(add-subviews (make-instance 'window)
(make-dialog-item 'button-dialog-item nil nil "Connect"
(lambda (b)
(declare (ignore b))
(eval-enqueue #'connect))))
Click the Connect button. Bing-dada-boom...
Using telnet to connect to the server above on port 8888 also leads
to an RMCL crash (after typing enter/return).
-- Terje
> On Jul 9, 2009, at 5:28 PM, Terje Norderhaug wrote:
>> The most serious code modifications I am having to make relates to
>> less liberal use of processes. Spawning a new process at the wrong
>> time may take down RMCL. Starting a new process in general works
>> fine, as long as it is not as a consequence of user activity. It may
>> have to do with whether there are any event handling going on. For
>> example, evaluating a process-run-function like below in Fred or the
>> Listener reliably causes my vanilla RMCL to "quit unexpectedly" (G4,
>> OSX 10.4.11).
>>
>> (process-run-function "NeverStarts" (lambda ()()))
>>
>> -- Terje Norderhaug
>
> Prof. Alexander Repenning
>
> University of Colorado
> Computer Science Department
> Boulder, CO 80309-430
>
> vCard: http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf
>
>
> _______________________________________________
> info-mcl mailing list
> info-mcl at clozure.com
> http://clozure.com/mailman/listinfo/info-mcl
More information about the info-mcl
mailing list