From: Stefan Sperling Subject: Re: use polling read in gotsh/got-fetch-pack To: gameoftrees@openbsd.org Date: Fri, 3 May 2024 11:11:36 +0200 On Fri, May 03, 2024 at 11:10:42AM +0200, Stefan Sperling wrote: > This patch attempts to avoid an issue seen on got.g.o where a gotsh > process was stuck forever trying to read from stdin, which is a socket. Forgot to show the backtrace of gotsh hanging: #3 0x000004926786d642 in got_pkt_readn (off=0x701b34512510, fd=0, buf=0x701b3451251c, n=4) at /home/stsp/src/got/gotsh/../lib/pkt.c:35 35 r = read(fd, buf + *off, n - *off); (gdb) bt #0 _thread_sys_read () at /tmp/-:2 #1 0xc05383ec271dd147 in ?? () #2 0x00000494a8c0abc2 in _libc_read_cancel (fd=0, buf=0x701b3451251c, nbytes=4) at /usr/src/lib/libc/sys/w_read.c:27 #3 0x000004926786d642 in got_pkt_readn (off=0x701b34512510, fd=0, buf=0x701b3451251c, n=4) at /home/stsp/src/got/gotsh/../lib/pkt.c:35 #4 0x000004926786d952 in got_pkt_readhdr (datalen=0x701b34512564, fd=0, chattygot=0) at /home/stsp/src/got/gotsh/../lib/pkt.c:99 #5 0x000004926786dab2 in got_pkt_readpkt (outlen=0x701b345125dc, fd=0, buf=0x701b34522640 "", buflen=65536, chattygot=0) at /home/stsp/src/got/gotsh/../lib/pkt.c:130 #6 0x000004926786ea1a in serve_read (infd=0, outfd=1, gotd_sock=3, repo_path=0x495664a4fe0 "got.git", chattygot=0) at /home/stsp/src/got/gotsh/../lib/serve.c:795 #7 0x000004926786e8c6 in got_serve (infd=0, outfd=1, command=0x495664c6580 "git-upload-pack", repo_path=0x495664a4fe0 "got.git", gotd_sock=3, chattygot=0) at /home/stsp/src/got/gotsh/../lib/serve.c:1391 #8 0x000004926786c755 in main (argc=3, argv=0x701b345327c8) at /home/stsp/src/got/gotsh/gotsh.c:120 (gdb)