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

pouchdb / pouchdb / 9577
100%

Build:
DEFAULT BRANCH: master
Ran 04 Jun 2017 03:21PM UTC
Jobs 1
Files 1
Run time 1s
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

pending completion
9577

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

Jobs
ID Job ID Ran Files Coverage
29 9577.29 (COMMAND=report-coverage COVERAGE=1 SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find) 04 Jun 2017 03:21PM UTC 0
100.0
Travis Job 9577.29
Source Files on build 9577
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #9577
  • 01ba42da on github
  • Prev Build on master (#9574)
  • Next Build on master (#9578)
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