(I received this bug report by a user who shall remain anonymous)
curl 7.68.0 seems to have problems sending large data on macOS over unix domain sockets. You can reproduce by using netcat as a server like this:
rm -rf /tmp/foofoo.sock && nc -U -l /tmp/foofoo.sock
And then invoke curl:
curl -v --unix-sock /tmp/foofoo.sock -H "$(python -c 'print "x"*90000'): OK" http://localhost:8888/
(This has curl send a very long single header that ends with OK)
If you look at the output from curl, you’ll notice that it never gets around to sending the OK part of the string. This seems to be specific to recent curls and to macOS
Taking a look at dtrace it seems like curl stops asking select whether the socket is writable
$ sudo dtrace -n 'syscall::sendto:entry / execname == "curl" && arg0 == 5 / { printf("%s(%d): %d, %s, %d", execname, pid, arg0, copyinstr(arg1), arg2); } syscall::sendto:return / execname == "curl" / { printf("return %d %d", arg1, errno); } syscall::select:entry / execname == "curl" / { printf("select(%d, %p, %p, %p)\n", arg0, arg1, arg2, arg3); printf("READ:\n"); tracemem(copyin(arg1, 128), 16); printf("WRITE:\n"); tracemem(copyin(arg2, 128), 128); } syscall::select:return / execname=="curl" / { printf("%s return: %d %d", probefunc, arg1, errno); }'
Password:
dtrace: description 'syscall::sendto:entry ' matched 4 probes
CPU ID FUNCTION:NAME
2 347 select:entry select(4, 7ffeebbdf230, 7ffeebbdf2b0, 7ffeebbdf330)
READ:
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
0: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
WRITE:
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
2 348 select:return select return: 0 0
2 347 select:entry select(6, 7ffeebbdf170, 7ffeebbdf0f0, 7ffeebbdf1f0)
READ:
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
WRITE:
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
0: 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...............
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
2 348 select:return select return: 1 0
2 427 sendto:entry curl(4116): 5, GET / HTTP/1.1
Host: localhost:8888
User-Agent: curl/7.68.0
Accept: */*
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 90084
2 428 sendto:return return 8192 0
6 347 select:entry select(6, 7ffeebbdf230, 7ffeebbdf1b0, 7ffeebbdf2b0)
READ:
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
0: 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...............
WRITE:
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
6 348 select:return select return: 1 0
(This is a printout of the send calls and then the fdsets passed to select, the relevant FD is 5 so 0x20)
(I received this bug report by a user who shall remain anonymous)
curl 7.68.0 seems to have problems sending large data on macOS over unix domain sockets. You can reproduce by using netcat as a server like this:
And then invoke curl:
(This has curl send a very long single header that ends with OK)
If you look at the output from curl, you’ll notice that it never gets around to sending the
OKpart of the string. This seems to be specific to recent curls and to macOSTaking a look at dtrace it seems like curl stops asking select whether the socket is writable
(This is a printout of the send calls and then the fdsets passed to select, the relevant FD is 5 so 0x20)