Message from discussion
High number of event handlers problematic?
Received: by 10.180.74.79 with SMTP id r15mr4827354wiv.4.1352971341284;
Thu, 15 Nov 2012 01:22:21 -0800 (PST)
X-BeenThere: nodejs@googlegroups.com
Received: by 10.180.20.78 with SMTP id l14ls205656wie.41.gmail; Thu, 15 Nov
2012 01:22:04 -0800 (PST)
Received: by 10.204.145.140 with SMTP id d12mr23537bkv.6.1352971324031;
Thu, 15 Nov 2012 01:22:04 -0800 (PST)
Received: by 10.204.145.140 with SMTP id d12mr23536bkv.6.1352971324016;
Thu, 15 Nov 2012 01:22:04 -0800 (PST)
Return-Path: <fe...@f76.eu>
Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169])
by gmr-mx.google.com with ESMTPS id v13si1267335bkw.0.2012.11.15.01.22.03
(version=TLSv1/SSLv3 cipher=OTHER);
Thu, 15 Nov 2012 01:22:03 -0800 (PST)
Received-SPF: neutral (google.com: 209.85.217.169 is neither permitted nor denied by best guess record for domain of fe...@f76.eu) client-ip=209.85.217.169;
Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 209.85.217.169 is neither permitted nor denied by best guess record for domain of fe...@f76.eu) smtp.mail=fe...@f76.eu
Received: by mail-lb0-f169.google.com with SMTP id gk1so1015607lbb.28
for <nodejs@googlegroups.com>; Thu, 15 Nov 2012 01:22:03 -0800 (PST)
d=google.com; s=20120113;
h=mime-version:sender:x-originating-ip:from:date:x-google-sender-auth
:message-id:subject:to:content-type:x-gm-message-state;
bh=VqLVA9u13Uh8HlxZENh5ExSDzEpknlRuYBzYLpH7V+w=;
b=OxBWhUizFTmTuyXAJT+PIF6k5xC+rAdgKxcDRwjYfvtEHHdQ9HmEiIHfxsQI+kOE7h
secppDvStZ1PVQdNXWIeUBr+hXcBtF747vQ5Tprr+39IWPReC4l42zo4Wz4Tdq9+t51p
hwUbBmmfp0QbzqMXiICRq/113rScUEE+O4Nm1sAX/cJZIyDyPh820w53gkOdSUVeRDlr
KY6iQSV+u3gTPKGp75NcUTlaa2ONj8nT8lJRT0RB3iDfdu4pR5zVR513Ot1MPAVO/f44
W7RtSBedEW64x/aIc4Yrh8FQ09H4onNV+HgrwGJj0D8/1UzO/BAKBBrIuy4gc+N1zN8Y
Ylbg==
Received: by 10.112.40.42 with SMTP id u10mr316242lbk.124.1352971323283; Thu,
15 Nov 2012 01:22:03 -0800 (PST)
MIME-Version: 1.0
Sender: fe...@f76.eu
Received: by 10.114.26.165 with HTTP; Thu, 15 Nov 2012 01:21:32 -0800 (PST)
X-Originating-IP: [87.178.151.163]
From: "Felix E. Klee" <felix.k...@inka.de>
Date: Thu, 15 Nov 2012 10:21:32 +0100
Message-ID: <CA+m_8J04Wan-yNnZvzWo4hxB21Ogbuh+KPM9Lt1EtjQHzzo...@mail.gmail.com>
Subject: High number of event handlers problematic?
To: nodejs@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1
X-Gm-Message-State: ALoCoQkUwpKLjalrByI0eeG9dI5GQFO1Fyvnrp7VrLlSzEGJKkWV2WVe+wtNXFCXR3XXl36g4qrw
Node reports:
(node) warning: possible EventEmitter memory leak detected. 11
listeners added. Use emitter.setMaxListeners() to increase limit.
That there are more than 10 event listeners in my app is no surprise:
For every Socket.IO socket, I set up `n` listeners on "connect" to the
Redis database. The number `n` is around 10 (it corresponds to the
number of certain Redis keys).
To sum up, with every client (browser) connect, about 10 listeners for
the Redis "connect" event are added. So in the end, there may be
thousands of listeners for the Redis "connect" event.
I'd like to keep it that way, as the solution appears simple and robust.
However the above warning makes me suspicious: Is the solution no so
robust after all? Are there potential problems?
Or could I just do `emitter.setMaxListeners(0)`, and that's it?