Skip to content

Conversation

@DanielaIvanova
Copy link
Contributor

resolves #733
@cytadela8
We are having some problems with multi node sync test. Could you help us?

@thepiwo
Copy link
Collaborator

thepiwo commented Nov 22, 2018

@grzegorz225 could you help with the failing tests eventually?

@cytadela8
Copy link
Contributor

@DanielaIvanova The problem is you call Pool.garbage_collection inside Chain.handle_call(:add_validated_block, but Pool.garbage_collection calls Chain.top_height. Chain.top_height can't finish till the previous call finishes, but the previous call can't finish till Pool.garbage_collection finishes...

@cytadela8
Copy link
Contributor

I didn't trigger the bug when testing your code for some reason, but this should be it.

@cytadela8
Copy link
Contributor

To fix this you can change Pool.garbage_collect into a cast so it will be executed in parallel and won't block Chain.handle_call(:add_validated_block

@DanielaIvanova
Copy link
Contributor Author

DanielaIvanova commented Nov 23, 2018

@cytadela8
We call Pool.garbage_collection(height) inside Chain.handle_call(:add_validated_block) and we are passing the height of the incoming block, not Chain.top_height(). We switched to handle_cast but the problem still persists.

@DanielaIvanova
Copy link
Contributor Author

We tested with 3 synced nodes.

  1. Synced all of them
  2. Node2 added transaction to the pool with ttl = 4 (Node2 doesn't have money)
  3. Node1 added transaction to the pool as well, with ttl = 4 (Node3 doesn't have money)
  4. Node0 is the miner. Those transactions persist in the pool(currently height = 0).

On height = 4 the transactions are still in pool. On height = 5 the pool is empty.

This manual test proves that the garbage collector works as intended with synced nodes as well.
We don't know where the problem is coming from.

Changed: Pool.remove_transaction, Pool.garbage_collect
@thepiwo thepiwo removed the blocked label Nov 23, 2018
@thepiwo thepiwo merged commit 08673d0 into master Nov 23, 2018
@thepiwo thepiwo deleted the GH-733 branch November 30, 2018 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement garbage collection function for transactions pool

5 participants