Overview
Comment: | Marking ports as taken/released/failed now working. One race condtion taken care of but one remains. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.60 |
Files: | files | file ages | folders |
SHA1: |
5051742e65e834046ac8b34ea1da10ad |
User & Date: | matt on 2014-08-27 21:53:39 |
Other Links: | branch diff | manifest | tags |
Context
2014-08-27
| ||
23:47 | Fixed dying thread. Servers exit cleanly now check-in: 74cbbcdf44 user: matt tags: v1.60 | |
21:53 | Marking ports as taken/released/failed now working. One race condtion taken care of but one remains. check-in: 5051742e65 user: matt tags: v1.60 | |
04:20 | More on portlogger check-in: 53b72738b7 user: matt tags: v1.60 | |
Changes
Modified Makefile from [9b8f439036] to [3cfa0eb4e3].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - + | # make install CSCOPTS='-accumulate-profile -profile-name $(PWD)/profile-ww$(shell date +%V.%u)' PREFIX=$(PWD) CSCOPTS= INSTALL=install SRCFILES = common.scm items.scm launch.scm \ ods.scm runconfig.scm server.scm configf.scm \ db.scm keys.scm margs.scm megatest-version.scm \ process.scm runs.scm tasks.scm tests.scm genexample.scm \ http-transport.scm filedb.scm \ client.scm gutils.scm synchash.scm daemon.scm mt.scm dcommon.scm \ tree.scm ezsteps.scm lock-queue.scm sdb.scm \ |
︙ |
Modified http-transport.scm from [8af71ea3f3] to [92e5cfe525].
︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | + | (declare (uses common)) (declare (uses db)) (declare (uses tests)) (declare (uses tasks)) ;; tasks are where stuff is maintained about what is running. (declare (uses server)) (declare (uses daemon)) (declare (uses portlogger)) (include "common_records.scm") (include "db_records.scm") (define (http-transport:make-server-url hostport) (if (not hostport) #f |
︙ | |||
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + | (define (http-transport:try-start-server run-id ipaddrstr portnum server-id) (handle-exceptions exn (begin (print-error-message exn) (if (< portnum 90000) (begin (portlogger:open-run-close portlogger:set-failed portnum) (debug:print 0 "WARNING: failed to start on portnum: " portnum ", trying next port") (thread-sleep! 0.1) ;; get_next_port goes here (http-transport:try-start-server run-id ipaddrstr (+ portnum 1) server-id)) (begin (open-run-close tasks:server-force-clean-run-record tasks:open-db run-id ipaddrstr portnum " http-transport:try-start-server") (print "ERROR: Tried and tried but could not start the server")))) ;; any error in following steps will result in a retry (case (portlogger:open-run-close portlogger:take-port portnum) ((taken) |
︙ | |||
393 394 395 396 397 398 399 | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | - + + - - + + + | (mutex-unlock! *heartbeat-mutex*) ;; (debug:print 11 "last-access=" last-access ", server-timeout=" server-timeout) ;; ;; no_traffic, no running tests, if server 0, no running servers ;; (if (and *server-run* |
︙ |
Modified portlogger.scm from [ec84e46c0a] to [456633ae98].
︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + + + + + + + + + + + | ;; PURPOSE. (require-extension (srfi 18) extras tcp s11n) (use sqlite3 srfi-1 posix srfi-69 hostinfo) (import (prefix sqlite3 sqlite3:)) (declare (unit portlogger)) ;; lsof -i (define (portlogger:open-db fname) (let* ((exists (file-exists? fname)) (db (sqlite3:open-database fname)) (handler (make-busy-timeout 136000)) (canwrite (file-write-access? fname))) (sqlite3:set-busy-handler! db handler) (sqlite3:execute db "PRAGMA synchronous = 0;") (if (not exists) (sqlite3:execute db "CREATE TABLE ports ( port INTEGER PRIMARY KEY, state TEXT DEFAULT 'not-used', fail_count INTEGER DEFAULT 0);")) db)) (define (portlogger:open-run-close proc . params) (handle-exceptions exn (print "ERROR: portlogger:open-run-close failed. " proc " " params) (let* ((db (portlogger:open-db (conc "/tmp/." (current-user-name) "-portlogger.db"))) (res (apply proc db params))) (sqlite3:finalize! db) res))) ;; (fold-row PROC INIT DATABASE SQL . PARAMETERS) (define (portlogger:take-port db portnum) (let* ((qry1 (sqlite3:prepare db "INSERT INTO ports (port,state) VALUES (?,?);")) (qry2 (sqlite3:prepare db "UPDATE ports SET state=? WHERE port=?;")) (qry3 (sqlite3:prepare db "SELECT state FROM ports WHERE port=?;")) (res (sqlite3:with-transaction |
︙ | |||
76 77 78 79 80 81 82 | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | - + - + | ;;====================================================================== ;; MAIN ;;====================================================================== (define (portlogger:main . args) |