日々精進

新しく学んだことを書き留めていきます

long pollingでsocket.ioサーバに接続しているクライアントがあるとログが出まくる

以下のようなメッセージが出まくり、1,2日でログが8GBぐらいたまってしまうという現象が起きた。

debug: setting request GET /socket.io/1/xhr-polling/xIPscInKp3pX77b0NeGy?t=1377280474574
debug: setting poll timeout
debug: clearing poll timeout
debug: xhr-polling writing 7:::1+0
debug: set close timeout for client xIPscInKp3pX77b0NeGy
warn: client not handshaken client should reconnect
info: transport end (error)
debug: cleared close timeout for client xIPscInKp3pX77b0NeGy
debug: discarding transport

エラーメッセージで検索すると、接続を確立しているサーバと違うサーバに接続しに行ってるから(ロードバランサが違うサーバにリクエストを振り分けるから)だという情報があったが、動かしているサーバは一つだけだし。。
なんか原因がはっきりせず気持ち悪いがとりあえずログレベルを下げることで対処した。

io = io.listen(http, {'log level': 1})

参考:A Node in Nodes - Socket.IOのログレベルを変更する