bug#62590: Strange put-char encoding-error "conversion to port encoding failed"
Christopher Baines <[email protected]> Tue, 11 Feb 2025 18:29:43 +0000
| Newsgroups | gmane.lisp.guile.bugs |
|---|---|
| Message-ID | <[email protected]> |
Christopher Baines <[email protected]> writes: > I've been seeing some strange occasional errors for a while now. ... > I'm not sure what the 84 means? If I'm picking out the characters that > have failed to be encoded, I'm not sure why some of these would fail > (like space or w)? > > Unfortunately I'm not sure how to reproduce this. Suspendable ports > might be a factor here as that is probably in use. Still seeing these errors, including today. I've managed to stumble on a reliable and somewhat minimal way of reproducing them: /gnu/store/lnlw64i4k06yphjbyr3ciy07mz9snlwg-guile-next-3.0.10-0.5d3f561/bin/guile put-char-exn.scm > /dev/null The output is somewhat variable, but on my system within a few seconds it will output something like: current-output-port: #<output: file 1> (encoding: UTF-8) In ice-9/boot-9.scm: 1762:12 17 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) In unknown file: 16 (apply-smob/0 #<thunk 7f5dd6953fa0>) In ice-9/threads.scm: 165:20 15 (_) In unknown file: 14 (call-with-unblocked-asyncs #<procedure 7f5dd6953f40 at ice-9/thread…>) In ice-9/boot-9.scm: 1756:15 13 (with-exception-handler #<procedure 7f5dd6956fc0 at ice-9/boot-9.sc…> …) 1762:12 12 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) 2217:5 11 (%start-stack thread _) 2219:9 10 (_) 1762:12 9 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) In /home/chris/Projects/Guile/guile/put-char-exn.scm: 43:12 8 (_) In unknown file: 7 (simple-format #<output: file 1> "exception: ~A\n" #<&compound-excep…>) In ice-9/boot-9.scm: 1058:8 6 (default-record-printer #<&compound-exception components: (#<&exter…> …) In unknown file: 5 (write (#<&external-error> #<&origin origin: "fport_write"> #<&m…> …) …) In ice-9/boot-9.scm: 1050:4 4 (default-record-printer #<&origin origin: "fport_write"> #<output: f…>) In unknown file: 3 (display &origin #<output: file 1>) In ice-9/boot-9.scm: 1683:22 2 (raise-exception _ #:continuable? _) In /home/chris/Projects/Guile/guile/put-char-exn.scm: 29:25 1 (_ #<&compound-exception components: (#<&error> #<&origin origin: "p…>) In unknown file: 0 (make-stack #t) ERROR: In procedure display: ERROR: 1. &error 2. &origin: "put-char" 3. &message: "conversion to port encoding failed" 4. &irritants: 84 5. &exception-with-kind-and-args: kind: encoding-error args: ("put-char" "conversion to port encoding failed" 84 #<output: file 1> #\&) put-char-exn.scm:
put-char-exn.scm
(text/plain, 2.1 KB)
(use-modules (ice-9 suspendable-ports)
(ice-9 binary-ports)
(rnrs bytevectors)
(ice-9 exceptions)
(ice-9 threads)
(system repl debug))
(install-suspendable-ports!)
(setvbuf (current-output-port) 'line)
(setvbuf (current-error-port) 'line)
(define s
(socket PF_UNIX
(logior SOCK_STREAM SOCK_CLOEXEC SOCK_NONBLOCK)
0))
(simple-format (current-error-port)
"current-output-port: ~A (encoding: ~A)\n\n"
(current-output-port)
(port-encoding (current-output-port)))
(for-each
(lambda (i)
(call-with-new-thread
(lambda ()
(with-exception-handler
(lambda (exn)
(let ((stack (make-stack #t)))
(print-frames (stack->vector stack)
(current-error-port)
#:count (stack-length stack))
(print-exception
(current-error-port)
(stack-ref stack 3)
'%exception
(list exn)))
(force-output (current-error-port))
(primitive-exit 1))
(lambda ()
(while #t
(with-exception-handler
(lambda (exn)
(simple-format (current-output-port)
"exception: ~A\n"
exn))
(lambda ()
(with-throw-handler #t
(lambda ()
(put-bytevector s
(string->utf8 "foo")))
(lambda (key . args)
(let* ((stack (make-stack #t 3))
(backtrace
(call-with-output-string
(lambda (port)
(display-backtrace stack port)
(newline port)))))
(display
backtrace
(current-output-port))))))
#:unwind? #t)))))))
(iota 2))
(sleep 60)
signature.asc
(application/pgp-signature, 987 B)
-----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmerlxdfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XdzxQ/+MtlQYA16aqOLEszy2TbP6JYsw/PoTA3h 4vxiQOjUTHW4E3Gi5gS8dTXJ2za41vthBI/Z9iDFWoYhk4o2Vl82pj9kEcTfpEEd QZQ9cXgHAM0RfaO+jWnJMhyLnZs1ZsOL3lEcRKr0GKd0mDAn2jiyBfUGKwg3DyVN ZJbFgX2HtPAuRPYiaTOI1gxHS/fiXQqF1gLXh57hp8g3RjBJzlNANKtdkBFO/v73 NFNvbToS9ZLhrlxtc1tdye0jI0aX8MDU4XApuR85RY1a6khkKL1RHGFikHn7YBnS g1z24Uav/0F/1j0Z+osSWzbWEPoKvN0fPrhF34g/zaoFw7KgRnh3I51psChLuLjy 9JFPbAxe1PG8D/tZjz7fDlPD+914BI1Ge0qVgQcpwos7v3gPvUMJKidgJZFLjfYz 1QTzEnqasixJnTCMi8YN1sLDVfpvHo5JxigMv4euogtJ73MzmeSaru4/06akotjD xThGHJRkwzaV+LkqbG1OyQD618ty4OGbYyvXky0va7dr5scE/oVrGn9DnucZl9Gm igMFemFMKyugmY+zXtfVyfNWjZdXaqHIBXMD9TYribatfi4qehk+OPIXA3C/0niA bA00yNZbzQgmL/4n8B3t+jRHgMeasa8bFXPxMSupRTkB4VJ3bBxQhwdYr4WS0D+5 kJ6f+C2qTpg= =GMSO -----END PGP SIGNATURE-----