[Bug 231848] accept4() doesn't return a socket address when threading is involved

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Nov 9 18:12:30 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231848

--- Comment #3 from Anoop C S <anoopcs at autistici.org> ---
See attachment for a client-server program and Compile it as follows to
reproduce the issue:

# cc sv.c -o sv
# cc cl.c -lpthread -o cl

Run server in one shell:
# ./sv

Execute client program from another shell with thread count value:
# ./cl 10

Output samples:
with thread count = 5

client:
-------
$ ./cl 5
hello world
hello world
hello world
hello world
hello world

server:
-------
$ ./sv 
1 CONNECTION/S ESTABLISHED
2 CONNECTION/S ESTABLISHED
3 CONNECTION/S ESTABLISHED
4 CONNECTION/S ESTABLISHED
5 CONNECTION/S ESTABLISHED
^C

with thread count = 10

client:
$ ./cl 10
Failed to connect to socket: Connection refused

server:
$ ./sv 
1 CONNECTION/S ESTABLISHED
2 CONNECTION/S ESTABLISHED
3 CONNECTION/S ESTABLISHED
4 CONNECTION/S ESTABLISHED
5 CONNECTION/S ESTABLISHED
6 CONNECTION/S ESTABLISHED
7 CONNECTION/S ESTABLISHED
8 CONNECTION/S ESTABLISHED
^C

client program is written in such a way that it terminates on receiving refusal
during a connect() to server.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-threads mailing list