Index: tests/simplerun/debug.scm ================================================================== --- tests/simplerun/debug.scm +++ tests/simplerun/debug.scm @@ -1,6 +1,16 @@ -(import big-chicken trace rmtmod apimod dbmod ulex srfi-18) + +(module junk + * + +(import big-chicken + rmtmod + apimod + dbmod + srfi-18 + trace) + (trace-call-sites #t) (trace ;; db:get-tests-for-run ;; rmt:general-open-connection ;; rmt:open-main-connection @@ -7,16 +17,10 @@ ;; rmt:drop-conn ;; rmt:send-receive ;; rmt:log-to-main ) - -(module junk - * - - (import big-chicken rmtmod apimod dbmod srfi-18) - (define (make-run-id) (let* ((s (conc (current-process-id))) (l (string-length s))) (string->number (substring s (- l 3) l)) )) @@ -47,12 +51,9 @@ (loop (+ r 1) 0 tot-query-time)))))))) ))) (thread-start! th1) (thread-join! th1))) -) - -(import junk) (run) - +) Index: ulex/ulex.scm ================================================================== --- ulex/ulex.scm +++ ulex/ulex.scm @@ -73,11 +73,11 @@ mailbox matchable ;; queues regex regex-case - simple-exceptions + simple-exceptions s11n srfi-1 srfi-18 srfi-4 srfi-69 @@ -186,12 +186,11 @@ (th2 (make-thread (lambda () (case (work-method) ((mailbox limited) (process-work-queue uconn)))) "Ulex work queue processor"))) - (tcp-buffer-size 2048) - ;; (max-connections 2048) + ;; (tcp-buffer-size 2048) (thread-start! th1) (thread-start! th2) (udat-cmd-thread-set! uconn th1) (udat-work-queue-thread-set! uconn th2) (print "cmd loop and process workers started, listening on "(udat-host-port uconn)".") @@ -229,23 +228,23 @@ (else (handle-exceptions ;; TODO - MAKE THIS EXCEPTION CMD SPECIFIC? exn (message exn) (begin - ;; (mutex-lock! *send-mutex*) + ;; (mutex-lock! *send-mutex*) ;; DOESN'T SEEM TO HELP (let-values (((inp oup)(tcp-connect host-port))) (let ((res (if (and inp oup) (begin (serialize dat oup) - (close-output-port oup) + (close-output-port oup) (deserialize inp) - ) + ) (begin (print "ERROR: send called but no receiver has been setup. Please call setup first!") #f)))) (close-input-port inp) - ;; (mutex-unlock! *send-mutex*) + ;; (mutex-unlock! *send-mutex*) ;; DOESN'T SEEM TO HELP res)))))))) ;; res will always be 'ack unless return-method is direct (define (send-via-polling uconn host-port cmd data) (let* ((qrykey (make-cookie uconn)) (sres (send uconn host-port qrykey cmd data))) @@ -375,15 +374,18 @@ (define (ulex-cmd-loop uconn) (let* ((serv-listener (udat-socket uconn)) (listener (lambda () (let loop ((state 'start)) (let-values (((inp oup)(tcp-accept serv-listener))) + ;; (mutex-lock! *send-mutex*) ;; DOESN'T SEEM TO HELP (let* ((rdat (deserialize inp)) ;; '(my-host-port qrykey cmd params) (resp (ulex-handler uconn rdat))) - (if resp (serialize resp oup)) + (serialize resp oup) (close-input-port inp) - (close-output-port oup)) + (close-output-port oup) + ;; (mutex-unlock! *send-mutex*) ;; DOESN'T SEEM TO HELP + ) (loop state)))))) ;; start N of them (let loop ((thnum 0) (threads '())) (if (< thnum 100) @@ -436,11 +438,11 @@ (else (print "ULEX: work "cmd", "params" done in "run-time" ms") ;; send 'response as cmd and result as params (send uconn rem-host-port qrykey 'response result) ;; could check for ack (print "ULEX: response sent back to "rem-host-port" in "(- (current-milliseconds) end-time)))))) - (MBOX_TIMEOUT #f) + (MBOX_TIMEOUT 'do-work-timeout) (else (print "ERROR: rdat "rdat", did not match rem-host-port qrykey cmd params"))))) ;; NEW APPROACH: ;;