Megatest

Check-in [110864cea7]
Login
Overview
Comment:merged bad data defense - protection against rmt tack dump for non vector result
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.63-09c-candidate
Files: files | file ages | folders
SHA1: 110864cea7bdaa86024303ba84dc04ea919e1d1c
User & Date: bjbarcla on 2017-03-07 09:40:26
Other Links: branch diff | manifest | tags
Context
2017-03-07
09:42
merged in protection against being unable to write test log due to nfs lag, etc check-in: bad879cb5e user: bjbarcla tags: v1.63-09c-candidate
09:40
merged bad data defense - protection against rmt tack dump for non vector result check-in: 110864cea7 user: bjbarcla tags: v1.63-09c-candidate
09:39
Create new branch named "v1.63-09c-candidate" check-in: 848bb4fc58 user: bjbarcla tags: v1.63-09c-candidate
05:17
Added comprehensive check for corrupted data received from server to fix occasional stack trace from defunct server causing data corruption. Closed-Leaf check-in: 5a9a0708b8 user: matt tags: bad-data-defense
Changes

Modified rmt.scm from [ebacc63386] to [c6804ca810].

253
254
255
256
257
258
259
260











261
262
263
264
265
266
267
253
254
255
256
257
258
259

260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277







-
+
+
+
+
+
+
+
+
+
+
+







(define (rmt:open-qry-close-locally cmd run-id params #!key (remretries 5))
  (let* ((qry-is-write   (not (member cmd api:read-only-queries)))
	 (db-file-path   (db:dbfile-path)) ;;  0))
	 (dbstruct-local (db:setup))  ;; make-dbr:dbstruct path:  dbdir local: #t)))
	 (read-only      (not (file-write-access? db-file-path)))
	 (start          (current-milliseconds))
	 (resdat         (if (not (and read-only qry-is-write))
			     (api:execute-requests dbstruct-local (vector (symbol->string cmd) params))
			     (let ((v (api:execute-requests dbstruct-local (vector (symbol->string cmd) params))))
			       (handle-exceptions ;; there has been a long history of receiving strange errors from values returned by the client when things go wrong..
				exn               ;;  This is an attempt to detect that situation and recover gracefully
				(begin
				  (debug:print0 *default-log-port* "ERROR: bad data from server " v " message: "  ((condition-property-accessor 'exn 'message) exn))
				  (vector #t '())) ;; should always get a vector but if something goes wrong return a dummy
				(if (and (vector? v)
					 (> (vector-length v) 1))
				    (let ((newvec (vector (vector-ref v 0)(vector-ref v 1))))
				      newvec)           ;; by copying the vector while inside the error handler we should force the detection of a corrupted record
				    (vector #t '()))))  ;; we could also check that the returned types are valid
			     (vector #t '())))
	 (success        (vector-ref resdat 0))
	 (res            (vector-ref resdat 1))
	 (duration       (- (current-milliseconds) start)))
    (if (and read-only qry-is-write)
        (debug:print 0 *default-log-port* "ERROR: attempt to write to read-only database ignored. cmd=" cmd))
    (if (not success)
275
276
277
278
279
280
281
282

283
284
285
286
287
288
289
285
286
287
288
289
290
291

292
293
294
295
296
297
298
299







-
+







	      #f))
	(begin
	  ;; (rmt:update-db-stats run-id cmd params duration)
	  ;; mark this run as dirty if this was a write, the watchdog is responsible for syncing it
	  (if qry-is-write
	      (let ((start-time (current-seconds)))
		(mutex-lock! *db-multi-sync-mutex*)
		(set! *db-last-access* start-time)  ;; THIS IS PROBABLY USELESS? (we are on a client)
/		(set! *db-last-access* start-time)  ;; THIS IS PROBABLY USELESS? (we are on a client)
                (mutex-unlock! *db-multi-sync-mutex*)))))
    res))

(define (rmt:send-receive-no-auto-client-setup connection-info cmd run-id params)
  (let* ((run-id   (if run-id run-id 0))
	 (res  	   (handle-exceptions
		    exn