-
Notifications
You must be signed in to change notification settings - Fork 18
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
Create block filters before poll interval #152
Conversation
Signed-off-by: rodion <[email protected]>
Thanks for the PR @rodion-lim-partior - @Chengxuan could you take a look at this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rodion-lim-partior Thanks for spotting #151 !
The solution proposed is likely to make the problem happen less frequently as long as no transactions are submitted before the new block filter is created on the node.
However, there is still a race condition. I think a better fix here is to ensure the checkStartedLocked
function doesn't return until a block filter is established.
Please also add a test to catch future regressions.
@Chengxuan, noticed the following when I tried to fix the race condition:
Is there a reason why we acquire a lock before calling
|
@rodion-lim-partior It feels the problem is within the scope of The key problem to solve is synchronization between the Using a channel instead of a lock for go routine synchronization would be more idiomatic. |
Signed-off-by: rodion <[email protected]>
@Chengxuan, can you help to take a look at the current commit if this was what you referred to? |
@rodion-lim-partior Changes look great! I pointed out one possible issue in the code, you should be able to produce that error case in a test. Once tests are added, I'm happy to take another look. Thank you for the work! |
Thank @Chengxuan and @rodion-lim-partior for the collaboration on this one! Looking forward to seeing some tests |
@Chengxuan, the commit I pushed causes a deadlock in my local environment due to the reasons in my previous comments. I will have to shift the global locks downwards to resolve the deadlocks. From local testing, shifting the locks down does not seem to break the existing implementation. Let me know if that works, I will implement the tests and refactor based on your comments after. |
Hi @rodion-lim-partior I think you have a good understanding of the code now. So please feel free to try out different options and write tests. Please bear in mind the logic must ensure only 1 listener loop go routine can be created. Also, feel free to split global mutex to be resource specific if needed. |
@Chengxuan, got it. Will do some refactoring of the code and come back with the tests for another round of review. Thanks for the pointers! |
Signed-off-by: rodion <[email protected]>
88a0c3b
to
1031762
Compare
Signed-off-by: rodion <[email protected]>
6032fd2
to
676a441
Compare
@Chengxuan @EnriqueL8, apologies for the delay. I refactored the code and fixed some of the race conditions along the way. Added the tests as well for the edge case and the happy case. Some observations (correct me if I'm wrong):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good - a few thoughts
Signed-off-by: rodion <[email protected]>
@rodionlim logic looks good to me 👍 , some minor comments to clean up bits that are not necessary. |
Signed-off-by: rodion <[email protected]>
@Chengxuan, pushed a commit to clean up the code, left with one pending comment that needs a review |
@rodion-lim-partior thanks. For If there are something you'd like me to review, please let me know. |
@EnriqueL8, yep that's right. Rest of your review comments have been addressed. The pending one that needs a review, I need @Chengxuan to take a look. Removing the context will cause test failures. |
Signed-off-by: Chengxuan Xing <[email protected]>
@rodion-lim-partior I looked at the code closer and understood the need to have the context, here is the proposed change: partior-3p#1 6c15c1a has conflict with the proposal, so you'll need to take a look and resolve that. Otherwise, that PR is ready to go in. |
Signed-off-by: Chengxuan Xing <[email protected]>
Signed-off-by: Chengxuan Xing <[email protected]>
Signed-off-by: Chengxuan Xing <[email protected]>
Signed-off-by: Chengxuan Xing <[email protected]>
Hi @rodion-lim-partior I'm planning to do a release to pick up another bug fix tomorrow. I'd like to get this PR in as well, please take a look at partior-3p#1 and merge it if you are happy with it. I've sorted out the merge conflicts in that PR as well |
Signed-off-by: rodion <[email protected]>
6c15c1a
to
f9c618e
Compare
@Chengxuan, merged those changes in. Corrected some of the lint failures as well when you run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Thanks for your contribution @rodion-lim-partior 👍
Thanks both! Loved the discussion on this PR |
Cheers guys. |
Fixes: #151
Raising this PR to allow for block filters to be created on init instead of after the block polling interval.