Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -272,11 +272,17 @@ (set! success #f) (debug:print 0 "WARNING: failure in with-input-from-request to " fullurl ".") (debug:print 0 " message: " ((condition-property-accessor 'exn 'message) exn)) (hash-table-delete! *runremote* run-id) ;; Killing associated server to allow clean retry.") - (tasks:kill-server-run-id run-id) ;; better to kill the server in the logic that called this routine? + ;; (tasks:kill-server-run-id run-id) ;; better to kill the server in the logic that called this routine? + + ;; could try to start server here, if sucessful, retry the call to with-input-from-request + ;; otherwise - raise the error + + ;; (rmt:start-server run-id) + (mutex-unlock! *http-mutex*) (signal (make-composite-condition (make-property-condition 'commfail 'message "failed to connect to server"))) "communications failed") (with-input-from-request ;; was dat Index: rmt.scm ================================================================== --- rmt.scm +++ rmt.scm @@ -108,11 +108,19 @@ (if connection-info ;; use the server if have connection info (let* ((dat (case *transport-type* ((http)(condition-case (http-transport:client-api-send-receive run-id connection-info cmd params) - ((commfail)(vector #f "communications fail")) + ((commfail) + (if (< attemptnum 5) + (begin + (debug:print 0 "Trying again, try number " attemptnum) + (hash-table-delete! *runremote* run-id) + (rmt:send-receive cmd rid params attemptnum: (+ attemptnum 1))) + (begin + (debug:print 0 "Giving up, try number " attemptnum) + (vector #f "communications fail")))) ((exn)(vector #f "other fail")))) ((nmsg)(condition-case (nmsg-transport:client-api-send-receive run-id connection-info cmd params) ((timeout)(vector #f "timeout talking to server")))) (else (exit)))) @@ -259,11 +267,13 @@ (define (rmt:send-receive-no-auto-client-setup connection-info cmd run-id params) (let* ((run-id (if run-id run-id 0)) ;; (jparams (db:obj->string params)) ;; (rmt:dat->json-str params)) (res (handle-exceptions exn - #f + (begin + (debug:print 0 "Failed in rmt:send-receive-no-auto-client-setup, cmd=" cmd ", run-id=" run-id ", params=" params) + #f) (http-transport:client-api-send-receive run-id connection-info cmd params)))) ;; ((commfail) (vector #f "communications fail"))))) (if (and res (vector-ref res 0)) (vector-ref res 1) ;;; YES!! THIS IS CORRECT!! CHANGE IT HERE, THEN CHANGE rmt:send-receive ALSO!!! #f)))