dterletskiy / carpc

Component Architecture RPC Framework
MIT License
2 stars 0 forks source link

Crash during sending to not connected socket. #3

Closed dterletskiy closed 2 years ago

dterletskiy commented 2 years ago

In SendReceive class there is no handling connection state for socket (e.g. socket to servicebrocker). In case of not connected socket there is a crash.

dterletskiy commented 2 years ago

It receives a SIGPIPE signal because the local end of the socket has been shut down. Read man 2 send, especially the EPIPE error case. (So, to be precise, your program is terminated due to an unhandled SIGPIPE signal.)

As the man 7 signal man page says, the default disposition for SIGPIPE is to terminate the process. To avoid the termination, either set a SIGPIPE signal handler, or use send(socket, buffer, length, MSG_NOSIGNAL).

dterletskiy commented 2 years ago

Fixed in version 3.5.4