guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Writing to closed network port causes guile to exit with error 141, not


From: Ryan Raymond
Subject: Writing to closed network port causes guile to exit with error 141, not error message
Date: Fri, 22 Mar 2024 10:22:03 -0400

Hello, all
I have a problem with my web-server.
If the network connection to the server is closed (by killing the client)
and one attempts to write data to that port in GUILE, the interpreter will
exit without an error message. echo "$?" says GUILE exited with error code
141 but google doesn't give any results for this.

This code is running in a separate thread so it shouldn't be causing the
main thread to die.
Wrapping the write in a try-catch doesn't work. Maybe a bug with the C?
It only happens on the second write though.

It is reproducible. Run this code as a guile script:

(define sock (socket PF_INET SOCK_STREAM 0))
(bind sock AF_INET INADDR_LOOPBACK 8081)
(listen sock 100)
(define c (car (accept sock)))
(sleep 5)
; Start curl and then cancel here
(display "I am a banana" c)
(display "Banana also, lol" c)
(display "I should run if this doesn't fail\n")

In another terminal run
curl localhost:8081 --http0.9

Make sure to cancel curl and then type echo $? to see the error code 141.
Any help would be welcome, thanks
Ryan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]