Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Slow websocket consumer problem #41

Open
majek opened this Issue · 0 comments

1 participant

@majek
Owner

SockJS-erlang fails on slow websocket consumer.

For example:

=ERROR REPORT==== 26-Nov-2012::14:20:55 ===
** Handler sockjs_cowboy_handler terminating in websocket_handle/3
   for the reason exit:{noproc,
                           {gen_server,call,
                               [<0.158.0>,{received,[<<"18">>]},infinity]}}
** Message was {text,<<"[\"18\"]">>}
** Options were {service,"/amplify",#Fun<cowboy_test_server.2.61145267>,state,
                         "http://cdn.sockjs.org/sockjs-0.2.js",false,true,
                         5000,25000,131072,5000,
                         #Fun<sockjs_handler.0.34008514>}
** Handler state was {websocket,<0.158.0>,{#Ref<0.0.0.8840>,5000}}
** Request was {http_req,#Port<0.2609>,cowboy_tcp_transport,keepalive,
                         <0.157.0>,'GET',
                         {1,1},
                         {{127,0,0,1},59316},
                         [<<"localhost">>],
                         undefined,<<"localhost">>,8081,
                         [<<"amplify">>,<<"0">>,<<"0">>,<<"websocket">>],
                         [<<"0">>,<<"0">>,<<"websocket">>],
                         <<"/amplify/0/0/websocket">>,undefined,<<>>,[],
                         [{<<"Sec-Websocket-Version">>,<<"13">>},
                          {<<"Sec-Websocket-Key">>,
                           <<"FVKay/apSU2ZytGQBD2aBw==">>},
                          {<<"Origin">>,<<"localhost:8081">>},
                          {'Host',<<"localhost">>},
                          {'Connection',<<"Upgrade">>},
                          {'Upgrade',<<"websocket">>}],
                         [{'Upgrade',[<<"websocket">>]},
                          {'Connection',[<<"upgrade">>]}],
                         undefined,
                         [{websocket_version,13}],
                         waiting,<<>>,done,[],<<>>,
                         {#Fun<cowboy_http.urldecode.2>,crash}}
** Stacktrace: [{gen_server,call,3},
                {sockjs_session,received,2},
                {sockjs_ws_handler,session_received,2},
                {sockjs_cowboy_handler,websocket_handle,3},
                {cowboy_http_websocket,handler_call,7},
                {cowboy_http_protocol,upgrade_protocol,3}]

To reproduce pip install websocket-client and:

from websocket import create_connection
ws = create_connection("ws://localhost:8081/amplify/0/0/websocket")

result =  ws.recv()
print "Received '%s'" % result


for i in range(10000):
    ws.send('["18"]')


#    ws.send('["18"]')
result =  ws.recv()
@majek majek referenced this issue from a commit
@majek majek #41 - don't disconnect websockets if 'receiver' doesn't come back in …
…5 seconds

Timeout mechanism is broken with regard to websockets. cowboy process might be overloaded by incoming messages (And session not being able to pick them up quickly enough). If that happens, it's quite likely that session process will receive a timeout after 5 seconds of not having the 'reply' call. This seems to be less of a big deal for non-ws transports as they don't neccesairly come via a signle bottleneck process - receiver is different than sender.
0485c18
@majek majek referenced this issue from a commit
@majek majek #41 - don't disconnect websockets if 'receiver' doesn't come back in …
…5 seconds

Timeout mechanism is broken with regard to websockets. cowboy process might be overloaded by incoming messages (And session not being able to pick them up quickly enough). If that happens, it's quite likely that session process will receive a timeout after 5 seconds of not having the 'reply' call. This seems to be less of a big deal for non-ws transports as they don't neccesairly come via a signle bottleneck process - receiver is different than sender.
d97f364
@gebi gebi referenced this issue from a commit in gebi/sockjs-erlang
@majek majek #41 - don't disconnect websockets if 'receiver' doesn't come back in …
…5 seconds

Timeout mechanism is broken with regard to websockets. cowboy process might be overloaded by incoming messages (And session not being able to pick them up quickly enough). If that happens, it's quite likely that session process will receive a timeout after 5 seconds of not having the 'reply' call. This seems to be less of a big deal for non-ws transports as they don't neccesairly come via a signle bottleneck process - receiver is different than sender.
bedc871
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.