You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by "littlexyw (via GitHub)" <gi...@apache.org> on 2024/06/07 05:25:18 UTC

[PR] [CELEBORN-1453] Fix the thread safety bug in getMetrics [celeborn]

littlexyw opened a new pull request, #2548:
URL: https://github.com/apache/celeborn/pull/2548

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     - Make sure the PR title start w/ a JIRA ticket, e.g. '[CELEBORN-XXXX] Your PR title ...'.
     - Be sure to keep the PR description updated to reflect all changes.
     - Please write your PR title to summarize what this PR proposes.
     - If possible, provide a concise example to reproduce the issue for a faster review.
   -->
   
   ### What changes were proposed in this pull request?
   Fix the thread safety bug in getMetrics of AbstractSource by changing the lock scope
   
   
   ### Why are the changes needed?
   When two threads access the getMetrics method in AbstractSource at the same time, one of the threads may get fewer metrics than the actual value, because the actual execution order may be like this: Thread A gets the lock, adds the metrics of the worker source to the innerMetrics queue and releases the lock, Thread B gets the lock, adds the metrics of the worker source to the innerMetrics queue and releases the lock, Thread A gets the lock, adds the metrics of other sources to the innerMetrics queue, assembles the values of innerMetrics, clears innerMetrics and releases the lock, Thread B gets the lock, adds the metrics of other sources to the innerMetrics queue, assembles the values of innerMetrics, clears innerMetrics and releases the lock. The result of this is that Thread A gets two sets of metrics data from the worker source, while Thread B doesn't get any.
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   manual test
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1453] Fix the thread safety bug in getMetrics [celeborn]

Posted by "littlexyw (via GitHub)" <gi...@apache.org>.
littlexyw commented on PR #2548:
URL: https://github.com/apache/celeborn/pull/2548#issuecomment-2154417685

   test code: (rename test.txt to test.go and run "go run test.go")
   [test.txt](https://github.com/user-attachments/files/15727671/test.txt)
   correct result:
   <img width="696" alt="image" src="https://github.com/apache/celeborn/assets/157120263/fef85ab7-4cba-446f-8067-fe08689abd43">
   incorrect metrics:
   <img width="780" alt="image" src="https://github.com/apache/celeborn/assets/157120263/5c973435-ff9e-44c4-ad41-4b1b1aacf8ce">
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1453] Fix the thread safety bug in getMetrics [celeborn]

Posted by "SteNicholas (via GitHub)" <gi...@apache.org>.
SteNicholas commented on PR #2548:
URL: https://github.com/apache/celeborn/pull/2548#issuecomment-2154187617

   @littlexyw, could you provide the result of manual test?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1453] Fix the thread safety bug in getMetrics [celeborn]

Posted by "waitinfuture (via GitHub)" <gi...@apache.org>.
waitinfuture closed pull request #2548: [CELEBORN-1453] Fix the thread safety bug in getMetrics
URL: https://github.com/apache/celeborn/pull/2548


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org