Skip to content
Snippets Groups Projects
user avatar
Matthew Jordan authored
When a client takes a long time to process information received from Asterisk,
a write operation using fwrite may fail to write all information. This causes
the underlying file stream to be in an unknown state, such that the socket
must be disconnected. Unfortunately, there are two problems with this in
Asterisk's existing websocket code:
1. Periodically, during the read loop, Asterisk must write to the connected
   websocket to respond to pings. As such, Asterisk maintains a reference to
   the session during the loop. When ast_http_websocket_write fails, it may
   cause the session to decrement its ref count, but this in and of itself
   does not break the read loop. The read loop's write, on the other hand,
   does not break the loop if it fails. This causes the socket to get in a
   'stuck' state, preventing the client from reconnecting to the server.
2. More importantly, however, is that the fwrite in ast_http_websocket_write
   fails with a large volume of data when the client takes awhile to process
   the information. When it does fail, it fails writing only a portion of
   the bytes. With some debugging, it was shown that this was failing in a
   similar fashion to ASTERISK-12767. Switching this over to ast_careful_fwrite
   with a long enough timeout solved the problem.

ASTERISK-23917 #close
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/3624/



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@417310 65c4cc65-6c06-0410-ace0-fbb531ad65f3
32d684ee
History
Name Last commit Last update
..
acl.conf.sample
adsi.conf.sample
agents.conf.sample
alarmreceiver.conf.sample
alsa.conf.sample
amd.conf.sample
app_mysql.conf.sample
app_skel.conf.sample
asterisk.adsi
asterisk.conf.sample
calendar.conf.sample
ccss.conf.sample
cdr.conf.sample
cdr_adaptive_odbc.conf.sample
cdr_custom.conf.sample
cdr_manager.conf.sample
cdr_mysql.conf.sample
cdr_odbc.conf.sample
cdr_pgsql.conf.sample
cdr_sqlite3_custom.conf.sample
cdr_syslog.conf.sample
cdr_tds.conf.sample
cel.conf.sample
cel_custom.conf.sample
cel_odbc.conf.sample
cel_pgsql.conf.sample
cel_sqlite3_custom.conf.sample
cel_tds.conf.sample
chan_dahdi.conf.sample
chan_mobile.conf.sample
cli.conf.sample
cli_aliases.conf.sample
cli_permissions.conf.sample
codecs.conf.sample
confbridge.conf.sample
config_test.conf.sample
console.conf.sample
dbsep.conf.sample
dnsmgr.conf.sample
dsp.conf.sample
dundi.conf.sample
enum.conf.sample
extconfig.conf.sample
extensions.ael.sample
extensions.conf.sample
extensions.lua.sample
extensions_minivm.conf.sample
features.conf.sample
festival.conf.sample
followme.conf.sample
func_odbc.conf.sample
gtalk.conf.sample
h323.conf.sample
http.conf.sample
iax.conf.sample
iaxprov.conf.sample
indications.conf.sample
jabber.conf.sample
jingle.conf.sample
logger.conf.sample
manager.conf.sample
meetme.conf.sample
mgcp.conf.sample
minivm.conf.sample
misdn.conf.sample
modules.conf.sample
motif.conf.sample
musiconhold.conf.sample
muted.conf.sample
ooh323.conf.sample
osp.conf.sample
oss.conf.sample
phone.conf.sample
phoneprov.conf.sample
queuerules.conf.sample
queues.conf.sample
res_config_mysql.conf.sample
res_config_sqlite.conf.sample
res_config_sqlite3.conf.sample
res_corosync.conf.sample
res_curl.conf.sample
res_fax.conf.sample
res_ldap.conf.sample
res_odbc.conf.sample
res_pgsql.conf.sample
res_pktccops.conf.sample
res_snmp.conf.sample
res_stun_monitor.conf.sample
rtp.conf.sample
say.conf.sample
sip.conf.sample
sip_notify.conf.sample
skinny.conf.sample
sla.conf.sample
smdi.conf.sample
telcordia-1.adsi
udptl.conf.sample
unistim.conf.sample
users.conf.sample
voicemail.conf.sample
vpb.conf.sample
xmpp.conf.sample