-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LevelDown version > 5.0.2
with PouchDB => MacOS crash with MaxListenersExceededWarning (once called more than once)
#686
Comments
I also doubt it's an issue in Some notes:
|
Thanks for the quick feedback / tips! :) |
Regarding |
@danielweck Let's keep the discussion in a single thread; reposting a comment in multiple issues (pouchdb/pouchdb#7819 (comment), pouchdb/pouchdb#7825 (comment), pouchdb/pouchdb#7848 (comment)) doesn't help to fix it sooner. Only makes it harder to follow. Thanks! |
I'm unable to reproduce on any version of |
I felt it was necessary to revive the closed PouchDB issues, so that developers who encountered the problem would get the "heads-up" and report back about their findings. Naturally, I hate duplication too, so I would rather be able to focus on a single comment thread. |
This "MaxListenersExceededWarning" MacOS-specific definitely needs a minimal repro test-case. I suspect that the issue filed here for Cheers. |
My money would be on |
Thanks :) |
I got curious and was able to reproduce running this on a mac. Somehow, because there are two I was also able to reproduce outside of pouchdb. I will push a repro to GitHub once I confirm it's really a In the case of pouchdb, the reason it only happens when you installed stuff with So it might not be the version that matters (maybe all of 5.x has a bug), but that two versions are loaded side by side. |
Note that our project uses the Npm CLI, not Yarn. |
OK. Could you share the output of |
Might have something to do with So how can these two addons end up sharing state? 🤔 |
Dependency-free repro: https://github.com/vweevers/yarn-macos-pouchdb-error/tree/low-level |
|
|
Follow-up:
|
Added the ability (to the The problematic version seems to be 5.0.2.
|
I lack the (mac) tools and skills to figure this out, so I suggest sending a PR to pouchdb to update |
@vweevers The problem seems to be related to callbacks in general, right? Maybe it's related to the functionality in |
@vweevers There is a pattern between "newer version" vs "older version" above. Note that the version pairs
behave exactly the same as
I'm betting you'll get the same result if you replace I'm thinking it could be related to different class function memory layout, given that we have changed a bit how some methods are pure virtual, adding |
It looks like you are on the right track! :) Meanwhile, I have found a better workaround that does not require pinning to version |
…code level during NPM install, precompiled binaries of NodeJS plugins were loaded several times (Fixes #496 Also see Level/leveldown#686 )
@ralphtheninja Yeah. I first noticed the problem on Where do we go from here? Test more versions and combinations? Even if only 5.0.2 turns out to have the problem, it's a severe problem. If we don't figure it out, it might bite us later. But I have no idea how to further investigate this. |
We sleep on it. |
Updated the |
This comment has been minimized.
This comment has been minimized.
First breaks on 5.3.0 (should not happen):
Then on 5.0.2:
|
On any combination of versions, I found that node calls @ralphtheninja Can that have anything to do with the fact that |
@vweevers It sounds like it could have something to do with this. I'm thinking we'd like to namespace the functions somehow so they are considered different, if that makes sense. Now it's like they are calling each other. Maybe there is a way to modify the code for this or pass some flag to the linker when building the cc @oleavr Any ideas? |
Atm the symbols don't have unique names. Is that it?
|
Repro without Expected output:
Actual:
I'll see if adding a namespace (macro) fixes it. |
This works: #define CONCAT_(a,b) a##b
#define CONCAT(a,b) CONCAT_(a,b)
#define NS CONCAT(NODE_GYP_MODULE_NAME,VERSION)
namespace NS {
// ..
} This way symbols get prefixed with a versioned namespace. Better yet, use random bytes, hex-encoded, so it always produces valid identifiers. |
FYI, I have updated |
Fixed in 5.4.1. |
As reported in PouchDB:
pouchdb/pouchdb#7819
pouchdb/pouchdb#7825
pouchdb/pouchdb#7848
I narrowed-down the bug to the
leveldown
transition from version5.0.2
to5.0.3
(ALL other package versions arelatest
, currentlylevelup
=4.3.2
,pouchdb-adapter-leveldb
=7.1.1
,pouchdb-adapter-leveldb
=7.1.1
, etc.)In other words, ONLY
leveldown
needs to be pinned to version5.0.2
. In my case, thepackage.json
looks like:LevelDown diff between version
5.0.2
and5.0.3
:v5.0.2...v5.0.3
Note my app stacktrace:
So, I am not certain that the problem actually stems from the
leveldown
implementation, but I thought I'd post this here as well as in the PouchDB issue tracker, just in case somebody here has a clue as to why theleveldown
code change introduced in version5.0.3
trips the PouchDB LevelDB adapter.I should point out that my app is built with Electron version
6.0.12
(NodeJS12
), but I had the exact same problem with earlier Electron/NodeJS versions. LevelDown is built withnpm rebuild --runtime=electron --target=6.0.12 --disturl=https://atom.io/download/atom-shell --build-from-source
.Thank you!
The text was updated successfully, but these errors were encountered: