aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-05-28 14:27:49 +0100
committerChristopher Baines <mail@cbaines.net>2021-05-28 14:27:49 +0100
commitb81f4c5fd6b732cb73b8ff47b78a8e5643911cea (patch)
tree1c9fb73541a1356addfdffd0805b416d680a7e6a
parentc9d71251dc979dc220864a099c4c0fdad5cd0fa2 (diff)
downloadbuild-coordinator-b81f4c5fd6b732cb73b8ff47b78a8e5643911cea.tar
build-coordinator-b81f4c5fd6b732cb73b8ff47b78a8e5643911cea.tar.gz
Get rid of the request mutex
This was put in to try and prevent the crashes inside gnutls, but was ineffective since the actual trigger for the issues is garbage collection, rather than parallel requests. There might be some benefit from limiting request parallelism in the future, but that can be thought through then.
-rw-r--r--guix-build-coordinator/agent-messaging/http.scm113
1 files changed, 51 insertions, 62 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm
index da5c682..f223f66 100644
--- a/guix-build-coordinator/agent-messaging/http.scm
+++ b/guix-build-coordinator/agent-messaging/http.scm
@@ -88,11 +88,6 @@
(string-drop agent-path 1)))
#:query query)))
-(define (with-request-mutex thunk)
- (if (running-on-the-hurd?)
- (thunk)
- (monitor (thunk))))
-
(define (default-log level . components)
(apply log-msg level components))
@@ -274,16 +269,14 @@
1000000) ; 1MB
(retry-on-error
(lambda ()
- (with-request-mutex
- (lambda ()
- (call-with-streaming-http-request
- uri
- (lambda (port)
- (call-with-lzip-output-port port
- (lambda (port)
- (write-file file port))
- #:level 9))
- #:headers `((Authorization . ,auth-value))))))
+ (call-with-streaming-http-request
+ uri
+ (lambda (port)
+ (call-with-lzip-output-port port
+ (lambda (port)
+ (write-file file port))
+ #:level 9))
+ #:headers `((Authorization . ,auth-value))))
#:times 6
#:delay 15)
(let* ((directory (or (getenv "TMPDIR") "/tmp"))
@@ -300,27 +293,25 @@
(log 'INFO "finished compressing " file ", now sending")
(retry-on-error
(lambda ()
- (with-request-mutex
- (lambda ()
- (call-with-input-file template
- (lambda (file-port)
- (let-values (((response body)
- (call-with-streaming-http-request
- uri
- (lambda (port)
- (with-time-logging
- (simple-format #f "sending ~A" file)
- (dump-port file-port port
- #:buffer-size 32768)))
- #:headers `((Authorization . ,auth-value)))))
- (when (>= (response-code response) 400)
- (raise-exception
- (make-exception-with-message
- (coordinator-handle-failed-request log
- 'PUT
- (uri-path uri)
- response
- body))))))))))
+ (call-with-input-file template
+ (lambda (file-port)
+ (let-values (((response body)
+ (call-with-streaming-http-request
+ uri
+ (lambda (port)
+ (with-time-logging
+ (simple-format #f "sending ~A" file)
+ (dump-port file-port port
+ #:buffer-size 32768)))
+ #:headers `((Authorization . ,auth-value)))))
+ (when (>= (response-code response) 400)
+ (raise-exception
+ (make-exception-with-message
+ (coordinator-handle-failed-request log
+ 'PUT
+ (uri-path uri)
+ response
+ body))))))))
#:times 12
#:delay (random 15))
@@ -356,32 +347,30 @@
(retry-on-error
(lambda ()
- (with-request-mutex
- (lambda ()
- (let-values (((response body)
- (call-with-streaming-http-request
- uri
- (lambda (request-port)
- (call-with-input-file file
- (lambda (file-port)
- (dump-port file-port request-port
- #:buffer-size 32768))
- #:binary #t))
- #:headers `((Authorization . ,auth-value)))))
- (if (>= (response-code response) 400)
- (raise-exception
- (make-exception-with-message
- (coordinator-handle-failed-request log
- 'PUT
- (uri-path uri)
- response
- body)))
- (begin
- (log 'INFO
- "successfully uploaded log file ("
- (response-code response)
- ")")
- #t))))))
+ (let-values (((response body)
+ (call-with-streaming-http-request
+ uri
+ (lambda (request-port)
+ (call-with-input-file file
+ (lambda (file-port)
+ (dump-port file-port request-port
+ #:buffer-size 32768))
+ #:binary #t))
+ #:headers `((Authorization . ,auth-value)))))
+ (if (>= (response-code response) 400)
+ (raise-exception
+ (make-exception-with-message
+ (coordinator-handle-failed-request log
+ 'PUT
+ (uri-path uri)
+ response
+ body)))
+ (begin
+ (log 'INFO
+ "successfully uploaded log file ("
+ (response-code response)
+ ")")
+ #t))))
#:times 12
#:delay (random 15)))
args))