ast_carefulwrite error when doing "sip show peers"

When I do a sip show peers on my server I get the following message right after the output every time, doesn’t seem to cause a problem, but would like to know the cause.

[Jan 26 21:50:14] NOTICE[18117]: utils.c:938 ast_carefulwrite: Timed out trying to write

We are running asterisk

The network is congested. There was a lot of output and the receiving system’s TCP window closed. You didn’t set an appropriate write timeout for your environment.

I seem to remember that write timeouts do result in lost data, or lost end of output markers.

Not sure how the network congestion would relate to seeing this message on the console of the machine were asterisk is running, no network involved. I Will look at some of the network settings, but at the time when this message appeared the network was not busy at all.

Carefulwrite is also used by AMI, which can be on a different machine. It means that the socket write between the console process/thread and the Asterisk core didn’t complete quickly enough. Which would mean that a socket queue overflowed. I suppose, it is possible to get this with just a very long response.

We have over 1300 peers, could that cause a long response?

That could well produce a reply that exceeded the kernel buffering for local sockets.

Is there a way to increase the buffer? Or is this not really anything to worry about. Could it effect anything else?


Change the kernel source code!

It probably is worth worrying about, as I believe that that write will fail, but it is not of sufficient concern for the way I use Asterisk to make it worth looking at the code in detail. If you can confirm that there is no means to change the timeout for the console write, it may justify a (minor) bug report.