Review Board 1.7.16


Increase WebSocket frame size and improve large read handling

Review Request #4431 - Created Feb. 18, 2015 and submitted

David Lee
/branches/11
Reviewers
asterisk-dev
Asterisk
Some WebSocket applications, like [chan_respoke][], require a larger
frame size than the default 8k; this patch bumps the default to 16k.
This patch also fixes some problems exacerbated by large frames.

The sanity counter was decremented on every fread attempt in
ws_safe_read(), regardless of whether data was read from the socket or
not. For large frames, this could result in loss of sanity prior to
reading the entire frame. (16k frame / 1448 bytes per segment = 12
segments).

This patch changes the sanity counter so that it only decrements when
fread() doesn't read any bytes. This more closely matches the original
intention of ws_safe_read(), given that the error message is
"Websocket seems unresponsive".

This patch also properly logs EOF conditions, so disconnects are no
longer confused with unresponsive connections.

 [chan_respoke]: https://github.com/respoke/chan_respoke
Ran a Node app that continuously send large WebSocket frame to Asterisk.

https://gist.github.com/leedm777/ba6d86468d7646073286

Without the patch, Asterisk fails in less than 10 frames. With the patch, it runs like a boss.
Total:
4
Open:
0
Resolved:
4
Dropped:
0
Status:
From:
Review request changed
Updated (Feb. 25, 2015, 3:25 p.m.)
  • changed from pending to submitted
Committed in revision 432257

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.