• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pouchdb / pouchdb / 9577 / 29
100%
master: 100%

Build:
DEFAULT BRANCH: master
Ran 04 Jun 2017 03:21PM UTC
Files 1
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Jun 2017 12:30PM UTC coverage: 100.0%. Remained the same
COMMAND=report-coverage COVERAGE=1 SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find

push

travis-ci

daleharvey
 (#6504) - fix possible "EventEmitter memory leak detected"

Problem
-------

With the idb adapter (default in Chrome), calling `.changes()` or
`.replicate()` with `{live: true}` multiple times results in this error,
even when the handler is nicely terminated with `.cancel()`.

    (node) warning: possible EventEmitter memory leak detected. 11
    listeners added. Use emitter.setMaxListeners() to increase limit.

Related to #4176, #4141, #4093, #3848, #2667, #2311, #2205, and maybe
others.

How to reproduce the bug?
-------------------------

Run this plunkr: http://plnkr.co/edit/JKCbQ6vwlYClAp6ZSAf4?p=preview

Alternatively, you can create + cancel a `.changes()` feed a few times:

    changesHandler = db.changes({live: true});
    changesHandler.cancel();
    repeat

About this fix
--------------

The bug comes from the `_change()` API call from the idb adapter [1]
returning `undefined` instead of the `{cancel: function() {...}}` object
it should return [2]. Because of that, the cleanup function in the core
module doesn't call the adapter's `cancel()` function [3], letting a
listener into the wild.

This commit fixes that and adds a test to check for the presence of the
error log line.

[1]: https://github.com/pouchdb/pouchdb/blob/49e4945/packages/node_modules/pouchdb-adapter-idb/src/index.js#L420-L422
[2]: https://github.com/pouchdb/pouchdb/blob/49e4945/packages/node_modules/pouchdb-adapter-idb/src/changes.js#L29-L33
[3]: https://github.com/pouchdb/pouchdb/blob/49e4945/packages/node_modules/pouchdb-core/src/changes.js#L201-L209

2793 of 3001 branches covered (93.07%)

5763 of 5763 relevant lines covered (100.0%)

23105.79 hits per line

Source Files on job 9577.29 (COMMAND=report-coverage COVERAGE=1 SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find)
  • Tree
  • List 0
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 9577
  • Travis Job 9577.29
  • 01ba42da on github
  • Prev Job for COMMAND=report-coverage COVERAGE=1 SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find on master (#9574.29)
  • Next Job for COMMAND=report-coverage COVERAGE=1 SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find on master (#9578.29)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc