Overview
Comment: | last of overt connection issues addressed. TCP connections growing very slowly. However now the db issues are manifesting. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.80-transport-cleanish | v1.80-refactor |
Files: | files | file ages | folders |
SHA1: |
22f2c337119577ef0e97e6805926030e |
User & Date: | matt on 2023-01-16 12:17:40 |
Other Links: | branch diff | manifest | tags |
Context
2023-01-16
| ||
14:09 | Cleaned up prepared db statements handling. check-in: 2639de81a8 user: matt tags: v1.80-refactor | |
12:17 | last of overt connection issues addressed. TCP connections growing very slowly. However now the db issues are manifesting. check-in: 22f2c33711 user: matt tags: v1.80-transport-cleanish, v1.80-refactor | |
10:00 |
Major refactor/clean up of client connection stuff. Removed old crufty approach of having both client and server side calls in http-transport. Plan would be to eventually get rid of http-transport.
Open files slowly grows. bad argument type in http-transport. Line 285 (close-connection! fullurl) is wrong. check-in: 67b18cc991 user: matt tags: v1.80-refactor | |
Changes
Modified client.scm from [c0f004bcfc] to [754a2985af].
︙ | ︙ | |||
120 121 122 123 124 125 126 | (if ping-res (if runremote (begin (debug:print-info 2 *default-log-port* "connected to " (client:get-url runremote)) runremote) (client:setup-http areapath runremote remaining-tries: (- remaining-tries 1))) (begin ;; login failed but have a server record, clean out the record and try again | | | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | (if ping-res (if runremote (begin (debug:print-info 2 *default-log-port* "connected to " (client:get-url runremote)) runremote) (client:setup-http areapath runremote remaining-tries: (- remaining-tries 1))) (begin ;; login failed but have a server record, clean out the record and try again (debug:print-info 0 *default-log-port* "client:setup, login unsuccessful, will attempt to start server ... ping-res=" ping-res) ;; had runid. Fixes part of Randy;s ticket 1405717332 (http-transport:close-connections runremote) (thread-sleep! 1) (client:setup-http areapath runremote remaining-tries: (- remaining-tries 1)) ))) (begin ;; no server registered ;; (server:kind-run areapath) (server:start-and-wait areapath) (debug:print-info 0 *default-log-port* "client:setup, no server registered, remaining-tries=" remaining-tries) (thread-sleep! 1) ;; (+ 5 (random (- 20 remaining-tries)))) ;; give server a little time to start up, randomize a little to avoid start storms. (client:setup-http areapath runremote remaining-tries: (- remaining-tries 1))))) |
︙ | ︙ |
Modified http-transport.scm from [7539e23e31] to [5e153aef1a].
︙ | ︙ | |||
278 279 280 281 282 283 284 | (debug:print 0 *default-log-port* "WARNING: failure in with-input-from-request to " fullurl ".") (debug:print 0 *default-log-port* " message: " msg ", exn=" exn) (debug:print 0 *default-log-port* " cmd: " cmd " params: " params " key:" (or server-id "thekey")) (debug:print 0 *default-log-port* " call-chain: " call-chain))) ;; what if another thread is communicating ok? Can't happen due to mutex (http-transport:close-connections runremote) (mutex-unlock! *http-mutex*) | | | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | (debug:print 0 *default-log-port* "WARNING: failure in with-input-from-request to " fullurl ".") (debug:print 0 *default-log-port* " message: " msg ", exn=" exn) (debug:print 0 *default-log-port* " cmd: " cmd " params: " params " key:" (or server-id "thekey")) (debug:print 0 *default-log-port* " call-chain: " call-chain))) ;; what if another thread is communicating ok? Can't happen due to mutex (http-transport:close-connections runremote) (mutex-unlock! *http-mutex*) ;; (close-connection! fullurl) (db:obj->string #f)) (with-input-from-request ;; was dat fullurl (list (cons 'key (or server-id "thekey")) (cons 'cmd cmd) (cons 'params sparams)) read-string)) |
︙ | ︙ | |||
335 336 337 338 339 340 341 | (if (remote? runremote) (let ((api-dat (remote-api-uri runremote))) (handle-exceptions exn (begin (print-call-chain *default-log-port*) (debug:print-error 0 *default-log-port* " closing connection failed with error: " ((condition-property-accessor 'exn 'message) exn) ", exn=" exn)) | | > > | | | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | (if (remote? runremote) (let ((api-dat (remote-api-uri runremote))) (handle-exceptions exn (begin (print-call-chain *default-log-port*) (debug:print-error 0 *default-log-port* " closing connection failed with error: " ((condition-property-accessor 'exn 'message) exn) ", exn=" exn)) (if (and (args:any-defined? "-server" "-execute" "-run") api-dat) (begin ;; NOTE: Verify this actually ever gets hit. Jan 16, 2023. (debug:print-info 0 *default-log-port* "Closing connections to "api-dat) (close-connection! api-dat))) (remote-conndat-set! runremote #f) #t)) #f)) ;; run http-transport:keep-running in a parallel thread to monitor that the db is being ;; used and to shutdown after sometime if it is not. ;; |
︙ | ︙ |
Modified rmt.scm from [ef90d475fb] to [599b82a5a9].
︙ | ︙ | |||
287 288 289 290 291 292 293 | ;; bunch of small functions factored out of send-receive to make debug easier ;; (define (extras-case-11 *default-log-port* runremote cmd params attemptnum rid) ;; (mutex-unlock! *rmt-mutex*) (debug:print-info 12 *default-log-port* "rmt:send-receive, case 9") ;; (mutex-lock! *rmt-mutex*) | < | < | | < | | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | ;; bunch of small functions factored out of send-receive to make debug easier ;; (define (extras-case-11 *default-log-port* runremote cmd params attemptnum rid) ;; (mutex-unlock! *rmt-mutex*) (debug:print-info 12 *default-log-port* "rmt:send-receive, case 9") ;; (mutex-lock! *rmt-mutex*) (let* ((dat-in (condition-case ;; handling here has ;; caused a lot of ;; problems. However it ;; is needed to deal with ;; attemtped ;; communication to ;; servers that have gone ;; away (http-transport:client-api-send-receive 0 runremote cmd params) ((servermismatch) (vector #f "Server id mismatch" )) ((commfail)(vector #f "communications fail")) ((exn)(vector #f "other fail" (print-call-chain))))) (dat (if (and (vector? dat-in) ;; ... check it is a correct size (> (vector-length dat-in) 1)) dat-in (vector #f (conc "communications fail (type 2), dat-in=" dat-in)))) (success (if (vector? dat) (vector-ref dat 0) #f)) (res (if (vector? dat) (vector-ref dat 1) #f))) (if (remote? runremote) (remote-last-access-set! runremote (current-seconds)) ;; refresh access time (begin (debug:print 0 *default-log-port* "INFO: Should not get here! runremote="runremote) (http-transport:close-connections runremote))) (debug:print-info 13 *default-log-port* "rmt:send-receive, case 9. runremote="runremote " dat=" dat) (mutex-unlock! *rmt-mutex*) (if success ;; success only tells us that the transport was ;; successful, have to examine the data to see if ;; there was a detected issue at the other end (extras-transport-succeded *default-log-port* *rmt-mutex* attemptnum runremote res params rid cmd) (begin (debug:print-error 0 *default-log-port* " dat=" dat) |
︙ | ︙ |