This change was prompted by an issue where if the websocket peer to
which ARI or chan_websocket is connected stops consuming TCP packets,
its TCP receive buffer will begin to fill and ultimately cause the
client's TCP send buffer to start filling. When the send buffer is
completely filled, further writes to the websocket will block. This can
cause a cascading lock situation with chan_websocket because it sends
large amounts of data very quickly but can also affect ARI.
* Added "write_timeout" parameters to websocket_client.conf and
chan_websocket.conf. ari.conf already had the
"websocket_write_timeout" parameter. See notes below.
* Updated chan_websocket to use the write_timeout set in
chan_websocket.conf for incoming/server connections if set and to use
AST_DEFAULT_WEBSOCKET_WRITE_TIMEOUT (100ms) as the default if not set.
* Updated chan_websocket to use the write_timeout set in
websocket_client.conf for outgoing/client connections if set and to use
write_timeout from chan_websocket.conf if not set. If neither is set,
AST_DEFAULT_WEBSOCKET_WRITE_TIMEOUT (100ms) is used as the default.
* Set non-blocking mode on the websocket in chan_websocket for both
client and server connections. ARI already sets it. This is required
for the timeouts to operate correctly.
* Updated sample config files and XML documentation for all 3 areas.
Resolves: #2140
UpgradeNote: A new "write_timeout" parameter has been added to
websocket_client.conf that allows setting the maximum amount of time a
write operation can take before returning an error.
UpgradeNote: A new "write_timeout" parameter has been added to
chan_websocket.conf setting the maximum amount of time a write operation
can take before returning an error. Outgoing/client connections can
override this with the new "write_timeout" parameter that was also added
to websocket_client.conf.
DeveloperNote: A new "write_timeout" field has been added to the
ast_websocket_client_options structure that allows setting the maximum
amount of time a write operation can take before returning an error.
The websocket session must be set to nonblocking for this to take effect.
releases/24
George Joseph1 month agocommitted byAsterisk Development Team