I am using socat as a bridge between some devices and running socat (a couple hundreds of instances) like this:
socat -d -d -d -x -d -lf "/var/log/some_log_file" TCP4-LISTEN:6126,fork,max-children=1,su=nobody,reuseaddr,sndtimeo=30,rcvtimeo=30 TCP4-LISTEN:6127,reuseaddr,sndtimeo=30,rcvtimeo=30
And I keep getting Resource temporarily unavailable
2015/12/18 04:48:25 socat[1868] D malloc() -> 0x1097990
2015/12/18 04:48:25 socat[1868] I setting option "fork" to 1
2015/12/18 04:48:25 socat[1868] I setting option "max-children" to 1
2015/12/18 04:48:25 socat[1868] I setting option "substuser" to 65534
2015/12/18 04:48:25 socat[1868] I setting option "so-reuseaddr" to 1
2015/12/18 04:48:25 socat[1868] D malloc(896)
2015/12/18 04:48:25 socat[1868] D malloc() -> 0x1099cf0
2015/12/18 04:48:25 socat[1868] D sigaction(17, 0x7fff3aa1a790, (nil))
2015/12/18 04:48:25 socat[1868] D sigaction() -> 0
2015/12/18 04:48:25 socat[1868] D socket(2, 1, 6)
2015/12/18 04:48:25 socat[1868] I socket(2, 1, 6) -> 4
2015/12/18 04:48:25 socat[1868] D setsockopt(4, 1, 2, {0x1}, 4)
2015/12/18 04:48:25 socat[1868] D setsockopt() -> 0
2015/12/18 04:48:25 socat[1868] D setsockopt(4, 1, 21, {0x0000001e,00000000}, 16)
2015/12/18 04:48:25 socat[1868] D setsockopt() -> 0
2015/12/18 04:48:25 socat[1868] D setsockopt(4, 1, 20, {0x0000001e,00000000}, 16)
2015/12/18 04:48:25 socat[1868] D setsockopt() -> 0
2015/12/18 04:48:25 socat[1868] D fcntl(4, 2, 1)
2015/12/18 04:48:25 socat[1868] D fcntl() -> 0
2015/12/18 04:48:25 socat[1868] D bind(4, AF=2 0.0.0.0:6126, 16)
2015/12/18 04:48:25 socat[1868] D bind() -> 0
2015/12/18 04:48:25 socat[1868] D getsockname(4, 0x7fff3aa1aee0, 0x7fff3aa1a854{16})
2015/12/18 04:48:25 socat[1868] D getsockname(, {AF=2 0.0.0.0:6126}, {16}) -> 0
2015/12/18 04:48:25 socat[1868] D listen(4, 5)
2015/12/18 04:48:25 socat[1868] D listen() -> 0
2015/12/18 04:48:25 socat[1868] I starting accept loop
2015/12/18 04:48:25 socat[1868] N listening on AF=2 0.0.0.0:6126
2015/12/18 04:48:25 socat[1868] D accept(4, 0x7fff3aa1a900, 0x7fff3aa1a860)
2015/12/18 04:48:55 socat[1868] D accept(,,) -> -1
2015/12/18 04:48:55 socat[1868] E accept(4, 0x7fff3aa1a900, {16}): Resource temporarily unavailable
2015/12/18 04:48:55 socat[1868] N exit(1)
2015/12/18 04:48:55 socat[1868] I shutdown(4, 2)
2015/12/18 04:48:55 socat[1868] D shutdown() -> 0
I have already tried to increase the number of open files and connections:
ulimit -n 99999
ulimit -u 20000
ulimit -i 15000
sysctl -w fs.file-max=100000
sysctl net.core.somaxconn=10000
However it does not seem to be the problem.
It seems to me that socat
cannot open a connection on the socket it was listening to.
I have tried to google this error, however "Resource temporarily unavailable" is a quite broad term.
What might be happening? How can I fix this?
User contributions licensed under CC BY-SA 3.0