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

fix p2p taskStatus disappear issue #881

Merged
merged 2 commits into from
Apr 25, 2019
Merged

fix p2p taskStatus disappear issue #881

merged 2 commits into from
Apr 25, 2019

Conversation

AionJayT
Copy link
Collaborator

Notice

It is not allowed to submit your PR to the master branch directly, please submit your PR to the master-pre-merge branch.

Description

Please include a brief summary of the change that this pull request proposes. Include any relevant motivation and context. List any dependencies required for this change.

  • This PR is trying to solve the thread p2p-ts stuck issue. Currently, the p2p-ts is using scheduled threads pool with the other thread task. I suspect the p2p-ts stuck due to the reqnodestasks thread blocking the pool. Therefore, I use dedicated thread instead of using the sharing thread pool to avoid the blocking.

Fixes Issue # .

Type of change

Insert x into the following checkboxes to confirm (eg. [x]):

  • Bug fix.
  • New feature.
  • Enhancement.
  • Unit test.
  • Breaking change (a fix or feature that causes existing functionality to not work as expected).
  • Requires documentation update.

Testing

Please describe the tests you used to validate this pull request. Provide any relevant details for test configurations as well as any instructions to reproduce these results.

  • Modified the existing test case with new implementation

Verification

Insert x into the following checkboxes to confirm (eg. [x]):

  • I have self-reviewed my own code and conformed to the style guidelines of this project.
  • New and existing tests pass locally with my changes.
  • I have added tests for my fix or feature.
  • I have made appropriate changes to the corresponding documentation.
  • My code generates no new warnings.
  • Any dependent changes have been made.

@AionJayT AionJayT added the bug Something isn't working label Apr 16, 2019
@AionJayT AionJayT added this to the 0.4.0 milestone Apr 16, 2019
@AionJayT AionJayT self-assigned this Apr 16, 2019
@@ -23,6 +23,7 @@ public TaskRequestActiveNodes(final IP2pMgr _mgr, final Logger p2pLOG) {
public void run() {
INode node = mgr.getRandom();
if (node != null) {
Thread.currentThread().setName("p2p-reqNodes");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we have to set the thread's name, would it make sense for TaskRequestActiveNodes to extend Thread instead of implement Runnable? I feel like we're assuming things about which thread this Runnable will be in, so why not just make it a Thread?

alternatively, make the thread-name-setting happen in P2pMgr line 231 instead (set the name before starting threadStatus)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the purpose to use runnable is for saving the memory overhead, cause the task only executing run() method. you don't need to create a lot of objects by extending it to a Thread.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set the thead name mainly for more readable when you are using jstack to debug the thread info.

@AionJayT AionJayT merged commit f3d1fad into master-pre-merge Apr 25, 2019
@AionJayT AionJayT deleted the p2p-ts branch April 25, 2019 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants