From: Jan Nieuwenhuizen Date: Mon, 22 Apr 2019 17:03:37 +0000 (+0200) Subject: bug: suspendable put-bytevector. X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=a72245949a88b631c97e39fec70313f855e21ec2;hp=a72245949a88b631c97e39fec70313f855e21ec2;p=8sync.git bug: suspendable put-bytevector. To reproduce, do something like ./pre-inst-env demos/websocket/8s-server.scm& chromium demos/websocket/ws-client.html or icecat demos/websocket/ws-client.html and reload browser window several times. The server should produce a backtrace like 18:59:44 janneke@dundal:~/src/8sync/bug [env] $ ./pre-inst-env demos/websocket/8s-server.scm ;;; note: source file /home/janneke/src/8sync/bug/demos/websocket/8s-server.scm ;;; newer than compiled /home/janneke/.cache/guile/ccache/2.2-LE-8-3.A/home/janneke/src/8sync/bug/demos/websocket/8s-server.scm.go ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/janneke/src/8sync/bug/demos/websocket/8s-server.scm ;;; compiled /home/janneke/.cache/guile/ccache/2.2-LE-8-3.A/home/janneke/src/8sync/bug/demos/websocket/8s-server.scm.go listening: 1236 Zzzzzzzz.... on-ws-connection: args=(#< 249ed80> 1) on-ws-message: args= (("/home/janneke/src/8sync/bug/demos/websocket/8s-server.scm")) on-message: ws: "Hello, Web Socket!" on-ws-message: args= (("/home/janneke/src/8sync/bug/demos/websocket/8s-server.scm")) on-message: ws: "Say: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..." While reading request: In procedure fport_read: Connection reset by peer *** Caught exception with key 'system-error and arguments: ("fport_write" "~A" ("Broken pipe") (32)) *** In ice-9/boot-9.scm: 829:9 19 (catch #t # # …) 829:9 18 (catch #t # # …) 829:9 17 (catch #t # # …) 829:9 16 (catch #t # # …) 829:9 15 (catch #t # # …) In 8sync/actors.scm: 596:6 14 (call-catching-coroutine # _) 576:6 13 (call-catching-errors) In ice-9/boot-9.scm: 829:9 12 (catch #t # # …) In 8sync/actors.scm: 616:18 11 (_) In ice-9/boot-9.scm: 841:4 10 (with-throw-handler _ _ _) In 8sync/systems/web.scm: 167:10 9 (_ _ . _) In web/response.scm: 221:2 8 (write-response #< version: (1 . 0) code: 400 reason-phrase: #f headers: ((content-len…> …) In web/http.scm: 1199:2 7 (write-response-line (1 . 0) 400 "Bad Request" #) 1081:2 6 (write-http-version (1 . 0) #) In ice-9/suspendable-ports.scm: 662:12 5 (put-string # "HTTP/" _ _) 83:4 4 (write-bytes # #vu8(72 84 84 80 47 54 76 101 106 51 78 104 110 122 74 116 …) …) In unknown file: 3 (port-write # #vu8(72 84 84 80 47 54 76 101 106 51 78 104 110 122 74 116 …) …) In ice-9/boot-9.scm: 752:25 2 (dispatch-exception _ _ _) 751:25 1 (dispatch-exception 1 system-error ("fport_write" "~A" ("Broken pipe") (32))) In 8sync/agenda.scm: 597:23 0 (print-error-and-continue _ . _) *** Caught exception with key 'wrong-type-arg and arguments: ("port-write" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "open output port" #) (#)) *** In ice-9/eval.scm: 619:8 19 (_ #(#(#))) In ice-9/boot-9.scm: 2312:4 18 (save-module-excursion _) 3822:12 17 (_) In 8sync/actors.scm: 812:6 16 (run-hive #< 28a6500> _ #:cleanup _ #:handle-signals _) In ice-9/control.scm: 91:24 15 (call-with-escape-continuation _) In 8sync/agenda.scm: 568:6 14 (run-agenda #< queue: (() . #f) prompt-tag: ("prompt") read-port-map: # …) 631:5 13 (agenda-run-once! #< queue: (() . #f) prompt-tag: ("prompt") read-port-map: #) In ice-9/boot-9.scm: 829:9 12 (catch #t # # …) 829:9 11 (catch #t # # …) 829:9 10 (catch #t # # …) 829:9 9 (catch #t # # …) In 8sync/actors.scm: 596:6 8 (call-catching-coroutine # _) 576:6 7 (call-catching-errors) In ice-9/boot-9.scm: 829:9 6 (catch #t # # …) In 8sync/actors.scm: 616:18 5 (_) In 8sync/systems/websocket/server.scm: 171:11 4 (websocket-server-send _ #< id: "f89a760cec1b14c9c6654de548156342:8" to: #(" …) In ice-9/suspendable-ports.scm: 83:5 3 (write-bytes # #vu8(83 97 121 58 32 65 65 65 65 65 65 65 65 65 65 65 65 # …) …) In unknown file: 2 (port-write #) In ice-9/boot-9.scm: 751:25 1 (dispatch-exception 0 wrong-type-arg ("port-write" "Wrong type argument in position ~A (expect…" …)) In 8sync/agenda.scm: 597:23 0 (print-error-and-continue _ . _) Zzzzzzzz.... C-c C-c The problem does not occur when enabling these lines (define put-bytevector (@ (ice-9 binary-ports) put-bytevector)) (module-define! (resolve-module '(8sync systems websocket frame)) 'put-bytevector put-bytevector) in demos/websocket/8s-server.scm * demos/websocket/ws-client.html: New file. * demos/websocket/8s-server.scm: New file. ---