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

peers.remove called with wrong parameters on Node start #2406

Closed
MaciejBaj opened this issue Sep 19, 2018 · 1 comment
Closed

peers.remove called with wrong parameters on Node start #2406

MaciejBaj opened this issue Sep 19, 2018 · 1 comment

Comments

@MaciejBaj
Copy link
Contributor

@MaciejBaj MaciejBaj commented Sep 19, 2018

Problem description

When Node starts, transactions are being loaded from a network:
https://github.com/LiskHQ/lisk/blob/development/modules/loader.js#L254

When invalid transactions are present in a network and Node returns them:
https://github.com/LiskHQ/lisk/blob/development/modules/loader.js#L269

the validation fails and Peer that returned it is being removed:
https://github.com/LiskHQ/lisk/blob/development/modules/loader.js#L308

The call passes wrong parameters to modules.peers.remove function - a string instead of Peer object, which results in a Node crash with the following error message:
[WRN] 2018-09-16 01:26:28 | Transaction is not valid, peer removed - 94.237.40.141:8001
[FTL] 2018-09-16 01:26:28 | System error - {"message":"Cannot create property 'wsPort' on string '94.237.40.141'","stack":"TypeError: Cannot create property 'wsPort' on string '94.237.40.141'\n at Peer.normalize (/home/lisk/lisk-main/logic/peer.js:80:15)\n at Peer.accept (/home/lisk/lisk-main/logic/peer.js:47:15)\n at new Peer (/home/lisk/lisk-main/logic/peer.js:35:15)\n at Peers.create (/home/lisk/lisk-main/logic/peers.js:81:10)\n at Peers.remove (/home/lisk/lisk-main/logic/peers.js:285:14)\n at Peers.remove (/home/lisk/lisk-main/modules/peers.js:512:29)\n at async.eachSeries.e (/home/lisk/lisk-main/modules/loader.js:309:22)\n at /home/lisk/lisk-main/node_modules/async/dist/async.js:3060:16\n at replenish (/home/lisk/lisk-main/node_modules/async/dist/async.js:946:17)\n at Immediate.iterateeCallback (/home/lisk/lisk-main/node_modules/async/dist/async.js:931:17)\n at Immediate.<anonymous> (/home/lisk/lisk-main/node_modules/async/dist/async.js:906:16)\n at Immediate.args.(anonymous function) (/home/lisk/lisk-main/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:133:29)\n at runCallback (timers.js:672:20)\n at tryOnImmediate (timers.js:645:5)\n at processImmediate [as _immediateCallback] (timers.js:617:5)"}

How to fix it?

Attempt to remove Peer in the loader should pass a full Peer object as a parameter - modules.peers.remove(peer);

Which version(s) does this affect? (Environment, OS, etc...)

>=1.0.0

@MaciejBaj

This comment has been minimized.

Copy link
Contributor Author

@MaciejBaj MaciejBaj commented Sep 19, 2018

Closed by b796c7d

@MaciejBaj MaciejBaj closed this Sep 19, 2018
@MaciejBaj MaciejBaj added this to Open Issues in Version 1.0.0 via automation Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Version 1.0.0
  
Open Issues
1 participant
You can’t perform that action at this time.