golang unix socket error. dial: resource temporarily unavailable -
so i'm trying use unix sockets fluentd logging task , find randomly, once in while error
dial: {socket_name} resource temporarily unavailable
any ideas why might occurring?
i tried adding "retry" logic, reduce error, still occurs @ times.
also, fluntd using default config unix sockets communication
func connect() { var connection net.conn var err error := 0; < retry_count; i++ { connection, err = net.dial("unix", path_to_socket) if err == nil { break } time.sleep(time.duration(math.exp2(float64(retry_count))) * time.millisecond) } if err != nil { fmt.println(err) } else { connection.write(data_to_send_socket) } defer connection.close() }
go creates sockets in non-blocking mode, means system calls block instead. in cases transparently handles eagain error (what indicated "resource temporarily unavailable" message) waiting until socket ready read/write. doesn't seem have logic connect call in dial though.
it possible connect return eagain when connecting unix domain socket if listen queue has filled up. happen if clients connecting faster accepting them. go should wait on socket until becomes connectable in case , retry similar read/write, doesn't seem have logic.
so best bet handle error waiting , retrying dial call. that, or work out why server isn't accepting connections in timely manner.
Comments
Post a Comment