ndb icon indicating copy to clipboard operation
ndb copied to clipboard

NDB Crashes with CharacterIdMap ran out of capacity!

Open Jamesernator opened this issue 6 years ago • 8 comments

Environment:

  • ndb version: 1.1.3
  • Platform / OS version: macOS 10.14.5
  • Node.js version: 10.16 (also 12.6)

Problem

After opening NDB it crashes within a few seconds with a "CharacterIdMap ran out of capacity!" error.

Full stack trace

Error: Error: CharacterIdMap ran out of capacity!
Error: CharacterIdMap ran out of capacity!
    at Common.CharacterIdMap.toChar (https://domain/ndb.js:1:141718)
    at https://domain/ndb.js:3:160732
    at Array.map ()
    at Persistence.PathEncoder.encode (https://domain/ndb.js:3:160711)
    at Persistence.Automapping.FilePathIndex.addPath (https://domain/ndb.js:3:142687)
    at Persistence.Automapping._onUISourceCodeAdded (https://domain/ndb.js:3:137592)
    at https://domain/ndb.js:3:135752
    at Workspace.Workspace.dispatchEventToListeners (https://domain/ndb.js:1:91157)
    at Persistence.FileSystemWorkspaceBinding.FileSystem.addUISourceCode (https://domain/ndb.js:1:658103)
    at Persistence.FileSystemWorkspaceBinding.FileSystem._fileChanged (https://domain/ndb.js:3:134868)
    at Rpc.dispatchMessageLocally_ (/Users/jamesernator/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/carlo/rpc/rpc.js:423:16)
    at Rpc.routeMessage_ (/Users/jamesernator/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/carlo/rpc/rpc.js:371:12)
    at process.emit (events.js:198:13)
    at emit (internal/child_process.js:832:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed at ChildProcess.target.send (internal/child_process.js:636:16) at Rpc.routeMessage_ (/Users/jamesernator/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/carlo/rpc/rpc.js:379:9) at page_.exposeFunction.data (/Users/jamesernator/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/carlo/lib/carlo.js:388:71) at Page._onBindingCalled (/Users/jamesernator/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Page.js:548:56) at CDPSession.Page.client.on.event (/Users/jamesernator/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Page.js:136:54) at CDPSession.emit (events.js:198:13) at CDPSession._onMessage (/Users/jamesernator/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Connection.js:200:12) at Connection._onMessage (/Users/jamesernator/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Connection.js:112:17) at PipeTransport._dispatch (/Users/jamesernator/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/PipeTransport.js:59:22) at Socket.PipeTransport._eventListeners.helper.addEventListener.buffer (/Users/jamesernator/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/PipeTransport.js:30:64) Emitted 'error' event at: at process.nextTick (internal/child_process.js:640:35) at process._tickCallback (internal/process/next_tick.js:61:11)

This is almost certainly due to the number of files in the repository (280687 or 100247 without node_modules/) as the issue does not occur in more narrow folders.

It's still a pain though because if navigating to inner folders npm scripts cannot be used from NDB and it also changes the working directory breaking some of the scripts.

Jamesernator avatar Jul 16 '19 04:07 Jamesernator

@aslushnikov and @JoelEinbinder can we fix it on DevTools side?

alexkozy avatar Jul 16 '19 15:07 alexkozy

I'm also having this issue. It fails in the same way after a few seconds. I've been using ndb with this project for a while and have never seen this issue. Could be our project just grew past some limit?

Environment:

  • ndb version: 1.1.5
  • Platform / OS version: macOS 10.14.5
  • Node.js version: 10.16.0

Problem:

➜  ndb
/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/lib/process_utility.js:14
    throw error;
    ^

Error: Error: CharacterIdMap ran out of capacity!
Error: CharacterIdMap ran out of capacity!
    at Common.CharacterIdMap.toChar (https://domain/ndb.js:1:141718)
    at https://domain/ndb.js:3:160732
    at Array.map (<anonymous>)
    at Persistence.PathEncoder.encode (https://domain/ndb.js:3:160711)
    at Persistence.Automapping.FilePathIndex.addPath (https://domain/ndb.js:3:142687)
    at Persistence.Automapping._onUISourceCodeAdded (https://domain/ndb.js:3:137592)
    at https://domain/ndb.js:3:135752
    at Workspace.Workspace.dispatchEventToListeners (https://domain/ndb.js:1:91157)
    at Persistence.FileSystemWorkspaceBinding.FileSystem.addUISourceCode (https://domain/ndb.js:1:658133)
    at Persistence.FileSystemWorkspaceBinding.FileSystem._fileChanged (https://domain/ndb.js:3:134868)
    at Rpc.dispatchMessageLocally_ (/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/carlo/rpc/rpc.js:423:16)
    at Rpc.routeMessage_ (/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/carlo/rpc/rpc.js:371:12)
    at process.emit (events.js:198:13)
    at emit (internal/child_process.js:832:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at ChildProcess.target.send (internal/child_process.js:636:16)
    at Rpc.routeMessage_ (/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/carlo/rpc/rpc.js:379:9)
    at page_.exposeFunction.data (/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/carlo/lib/carlo.js:388:71)
    at Page._onBindingCalled (/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Page.js:548:56)
    at CDPSession.Page.client.on.event (/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Page.js:136:54)
    at CDPSession.emit (events.js:198:13)
    at CDPSession._onMessage (/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Connection.js:200:12)
    at Connection._onMessage (/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Connection.js:112:17)
    at PipeTransport._dispatch (/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/PipeTransport.js:59:22)
    at Socket.PipeTransport._eventListeners.helper.addEventListener.buffer (/Users/ishaantaylor/.nvm/versions/node/v10.16.0/lib/node_modules/ndb/node_modules/puppeteer-core/lib/PipeTransport.js:30:64)
Emitted 'error' event at:
    at process.nextTick (internal/child_process.js:640:35)
    at process._tickCallback (internal/process/next_tick.js:61:11)

ishaantaylor avatar Oct 17 '19 18:10 ishaantaylor

Same issue. I'm actually running Babel in the code, maybe that's related? Do you run babel too @Jamesernator ?

I can't find a reference to CharacterIdMap in this code, not sure where this even happens.

wmertens avatar Jan 22 '20 10:01 wmertens

Do you run babel too @Jamesernator ?

No this happens simply opening the root directory of the project with ndb .

Jamesernator avatar Jan 23 '20 00:01 Jamesernator

So I just did a full update of where I keep ndb, and while ndb wasn't updated, it doesn't crash any more. Could be coincidence.

Another option I found was to reset the devtools but didn't try that.

wmertens avatar Jan 23 '20 06:01 wmertens

@wmertens What do you mean by?

full update of where I keep ndb

Where was it previously and where did you move it to? If you didn't install via npm i -g or yarn global, how did you install it?

Whoaa512 avatar Feb 19 '20 05:02 Whoaa512

@Whoaa512 I keep my "global" installs in my home directory, under ~/bin/node_modules, and I add ~/bin/node_modules/.bin to my PATH environment variable.

That way

  • I keep all my state in my home directory for easy backups (I also have a ~/Applications)
  • the node_modules aren't in the parent paths of development folders
  • I can use a clean path if I need it

wmertens avatar Feb 19 '20 08:02 wmertens

Getting this issue too. Running ndb against a bundle in a big repo. Unfortunately, just putting ndb in a different folder isn't a solution here as I'm using it as part of the debug mode for a tool I'm making and I don't know where the people using the tool are going to have ndb installed.

Version of ndb: v1.1.5 (latest) OS: MacOS 10.15.5

Crashes when files load, ether loading in the sidebar or when certain files are already open in the editor, but haven't been able to identify exact pattern.

Will crash when I try to load with sourcemaps, although it is possible that I'm loading them incorrectly. I can't check though because ndb keeps crashing before any sourcemaps have the ability to load!

Sometimes crashes in two stages, with Error: CharacterIdMap ran out of capacity! appearing first without the window crashing, and then when the window is closed normally it'll show Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed. Still haven't figured out the pattern for when it outright crashes and when it throws but doesn't crash.

If I just run ndb (no arguments) and leave the window open, it will eventually either err or completely crash.

maddie-j avatar Jun 30 '20 23:06 maddie-j