ethereum / node-ethereum

[DEPRECATED] a simple standalone or embeddable Ethereum client written for Node.js
GNU General Public License v2.0
46 stars 38 forks source link

Seperate Child Db Server #20

Closed Latrasis closed 9 years ago

Latrasis commented 9 years ago

For Issue #14:

NOTES:

wanderer commented 9 years ago

awesome thanks @Latrasis! looks good, I added a few comments on the code.

Latrasis commented 9 years ago

Question: Would storing all child process in self.children be a better option? Such that when stopping them you would only need on execution reference. (childDB+ upnp + self.network). Using .send of cp.fork is synchronous compared to spawn as well.

wanderer commented 9 years ago

thats probably a good idea but lets get this working first then we can add the array when we have more children processes

On Thu, Dec 11, 2014 at 7:19 PM, Jacob Payne notifications@github.com wrote:

Question: Would storing all child process in self.children be a better option? Such that when stopping them you would only need on execution reference.

— Reply to this email directly or view it on GitHub https://github.com/ethereum/node-ethereum/pull/20#issuecomment-66713475.

Latrasis commented 9 years ago

I'll see if i can clear the bugs before tomorrow

Latrasis commented 9 years ago

Hi guys, i've been trying to fix this bug all day today. I'm not sure why, but I'm hitting a brick wall on EADDRINUSE, all the ports are open but it just doesn't budge.

Latrasis commented 9 years ago

This is what i'm constantly getting:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:904:11)
    at Server._listen2 (net.js:1042:14)
    at listen (net.js:1064:10)
    at Server.listen (net.js:1138:5)
    at createServer (/Users/jacobpayne/Documents/Repos/Github/node-ethereum/lib/db.js:37:6)
    at Array.startServer [as 1] (/Users/jacobpayne/Documents/Repos/Github/node-ethereum/lib/db.js:51:3)
    at listener (/Users/jacobpayne/Documents/Repos/Github/node-ethereum/node_modules/async/lib/async.js:493:46)
    at /Users/jacobpayne/Documents/Repos/Github/node-ethereum/node_modules/async/lib/async.js:444:17
    at Array.forEach (native)
    at _each (/Users/jacobpayne/Documents/Repos/Github/node-ethereum/node_modules/async/lib/async.js:46:24)
wanderer commented 9 years ago

do you have alethzero or any other ethereum clients running?

wanderer commented 9 years ago

also try changing the ports 3000,4000,5000 to something else. 3000 maybe a conflict

Latrasis commented 9 years ago

Seems like a leveldb problem, this is probably gonna take a week to fix, sorry guys :(

Latrasis commented 9 years ago

To get around the EADDRINUSE ~seems to be an open lock state for leveldb on accessing multiple multilevel db's. I got 3 sublevels going instead, but i'm getting header blocks unable to be properly created. Seems like either the db is not writable most likely. Still getting around using multilevel and sublevel together.

wanderer commented 9 years ago

sublevel looks like a good idea. Are you still getting header blocks problems using mutlilevel + sublevel?

Latrasis commented 9 years ago

Happy new years guys.

1.I'm getting an strange self.settings.path: /Users/username/.ethereum/node

  1. The 'close' method never seems to work.
Latrasis commented 9 years ago

Still Getting EADDRINUSE from the net server, but noticed it works on a second 'npm test' - weird.

Still having a problem with the stop though

Error: listen EADDRINUSE
    at errnoException (net.js:905:11)
    at Server._listen2 (net.js:1043:14)
    at listen (net.js:1065:10)
    at Server.listen (net.js:1139:5)
    at Array.startServer [as 1] (/Users/jacobpayne/Documents/Repos/Github/node-ethereum/lib/db.js:46:6)
    at listener (/Users/jacobpayne/Documents/Repos/Github/node-ethereum/node_modules/async/lib/async.js:493:46)
    at /Users/jacobpayne/Documents/Repos/Github/node-ethereum/node_modules/async/lib/async.js:444:17
    at Array.forEach (native)
    at _each (/Users/jacobpayne/Documents/Repos/Github/node-ethereum/node_modules/async/lib/async.js:46:24)
    at Object.taskComplete (/Users/jacobpayne/Documents/Repos/Github/node-ethereum/node_modules/async/lib/async.js:443:13)

  4 passing (6s)
  1 pending
  1 failing

  1) basic app functions should stop:
     Error: timeout of 5000ms exceeded
      at null.<anonymous> (/Users/jacobpayne/Documents/Repos/Github/node-ethereum/node_modules/mocha/lib/runnable.js:159:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)
Latrasis commented 9 years ago

Seems like the manifest is created before the sublevels can be included. Perhaps an async/sync problem?

Latrasis commented 9 years ago

Looks like the self.settings.path starts out as process.env.HOME + '/.ethereum/node' causing wierd problems.

Latrasis commented 9 years ago

Ok i (thought) finally got it:

Looking at the test, when Mocha runs, App.js instantiates five different instances that try using the same port ntp (3000 ex) for each multilevel server. This results in several EADDRINUSE errors.

I guess the solution would be setting a custom multilevel port for each test instance.

EDIT: Nope no catch.

Latrasis commented 9 years ago

It's a mess so i'm starting from scratch