Skip to content

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

Closed
@frozeman

Description

@frozeman

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions