Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Серверный JavaScript (Node.js, Ringo, Nitro, Sling) [игнор отключен] [закрыт для гостей] / [nodejs] Как бороться с EventEmitter memory leak detected? / 1 сообщений из 1, страница 1 из 1
20.12.2012, 14:15
    #38086748
INOKENTiY
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
[nodejs] Как бороться с EventEmitter memory leak detected?
Привет!
Сделал небольшое приложение которое подписывается на редис канал и как только получит сообщение отправляет его нужному клиенту. Все работает нормально, но приходит перезапускать приложение 4-5 раз в сутки, в логах вижу постоянно ошибку
автор(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
код приложения
Код: javascript
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
client.on("auth", function(sessId, userId){
      console.log('AUTH: userId ' + userId)
      var userIdFromRedis;
      redis1.get('PHPREDIS_SESSION:' + sessId, function (err , reply) {

          if (reply){
              reply = reply.toString();
              var result = reply.match(/s:2:\"id\";i:(\d+);/);

              if (result) {
                  userIdFromRedis = result[1]
                  console.log('AUTH: userIdFromRedis ' + userIdFromRedis)
              } 

              if (userIdFromRedis == userId) {
                  client.userId = userId;
                  subscribe.subscribe(channelPrefix + userId);
                  clients[userId] = client;
                  client.emit("auth", {"success":true});
                  console.log('AUTH: result - ok')
              } else {
                client.disconnect();
                console.log('AUTH: result - fail')
              }
            } else {
              client.disconnect();
            }
      });
  })

  subscribe.on("message", function(channel, message) {
      var userId = Math.round(channel.substr(channelPrefix.length));
      if (client.userId == userId) {
          console.log('Subscriber: ' + message)
          client.send(message);
      }
  });

  client.on("message", function(text){
           client.send(text);
  })


Подскажите, в какую сторону смотреть?

Модератор: Тема перенесена из форума "HTML, JavaScript, VBScript, CSS".
...
Рейтинг: 0 / 0
Форумы / Серверный JavaScript (Node.js, Ringo, Nitro, Sling) [игнор отключен] [закрыт для гостей] / [nodejs] Как бороться с EventEmitter memory leak detected? / 1 сообщений из 1, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]