logspout icon indicating copy to clipboard operation
logspout copied to clipboard

TCP Connection reset cause program terminated

Open tanapoln opened this issue 7 years ago • 0 comments

Logspout version: 3.3-dev (master) Environment: Docker on Debian.


Problem

I used logspout to send a log with raw+tcp.

There is a case where connection is reset (at remote host) which cause logspout will terminate itself. I think the problem is at raw.go:77 which terminate a function if connection is not an UDP.

The log is shown below:

# logspout v3.3-dev by gliderlabs
# adapters: syslog tcp udp tls raw
# options : persist:/mnt/routes
# jobs    : routes http[logs,routes]:80 pump
# routes  :
#   ADAPTER	ADDRESS			CONTAINERS	SOURCES	OPTIONS
#   raw+tcp	logsrv.wndv.co:5555				map[]
2017/12/04 04:11:20 raw: write tcp 100.97.43.84:53034->10.0.105.10:5555: write: connection reset by peer
2017/12/04 04:11:20 routes ended: %!s(<nil>)

Suggested solution:

I think that connection initialization should not live in NewRawAdapter (raw.go:32), so that it would allow Stream to reconnect in case that connection is reset. Then raw.Stream function must not return in case of error.

I can work with this case. So, if there is a better way to handle this, please give me an advice so that I can implement it.

Thank you

tanapoln avatar Dec 04 '17 07:12 tanapoln