unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Writing to closed network port causes guile to exit with error 141, not error message
@ 2024-03-22 14:22 Ryan Raymond
  2024-03-22 16:05 ` Tomas Volf
  0 siblings, 1 reply; 4+ messages in thread
From: Ryan Raymond @ 2024-03-22 14:22 UTC (permalink / raw)
  To: Guile User

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-23 12:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-22 14:22 Writing to closed network port causes guile to exit with error 141, not error message Ryan Raymond
2024-03-22 16:05 ` Tomas Volf
2024-03-22 23:00   ` Ryan Raymond
2024-03-23 12:09     ` Chris Vine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).