Skip to content
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

web3.eth.isSyncing in combination with web3.reset() kills go #1807

Closed
frozeman opened this issue Sep 15, 2015 · 5 comments
Closed

web3.eth.isSyncing in combination with web3.reset() kills go #1807

frozeman opened this issue Sep 15, 2015 · 5 comments
Labels

Comments

@frozeman
Copy link
Contributor

While trying web3.eth.isSyncing(), a function which gives you callbacks when the node start and stops syncing i found an issue when using it as follows:

web3.eth.isSyncing(function(error, sync){
 if(!error) {
    if(sync === true) {
       // stop all activity
       web3.reset(true); // <--- this seems to crash it
    } else if(sync) {
       // show sync info, stop app calls etc
       console.log(sync.highestBlock);
    } else {
       // regain app operation
    }
  }
});

This will crash the go node with the following:

runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow

see: https://gist.github.com/frozeman/d4df07d674150bddec8e

If you call it as follows, no problem appear:

web3.eth.isSyncing(function(error, sync){
 if(!error) {
    if(sync === true) {
       // stop all activity
       console.log('start syncing');
    } else if(sync) {
       // show sync info, stop app calls etc
       console.log(sync.currentBlock);
    } else {
       // regain app operation
       console.log('stop syncing');
    }
  }
});

@bas-vk could this have to do with the IPC?
@zsfelfoldi could this have to do with your implementation of the setInterval, as web3 is polling under the hood using setInterval?

@fjl
Copy link
Contributor

fjl commented Sep 16, 2015

Does it work with node.js? Does web3.reset cancel timers?

There is a known issue with canceling timers from inside a timer callback (#1083).

@frozeman
Copy link
Contributor Author

It doesn't cancel timers, but it removes all calls, which the interval would make.

@frozeman
Copy link
Contributor Author

It could be related, additionally the interval needs to return and interval/timeoutid, so that it can be cleared.

@frozeman
Copy link
Contributor Author

Just tested, it is still crashing on lates develop in the geth.attach console!

@fjl
Copy link
Contributor

fjl commented Jan 26, 2017

This doesn't seem to happen anymore with geth 1.5.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants