Skip to content

test: add ConcurrentSyncInvoke test to reproduce invoke_curl data rac…#737

Closed
Codingisinmyblud wants to merge 2 commits into
metacall:developfrom
Codingisinmyblud:fix/rpc-invoke-curl-thread-safety-test
Closed

test: add ConcurrentSyncInvoke test to reproduce invoke_curl data rac…#737
Codingisinmyblud wants to merge 2 commits into
metacall:developfrom
Codingisinmyblud:fix/rpc-invoke-curl-thread-safety-test

Conversation

@Codingisinmyblud
Copy link
Copy Markdown

@Codingisinmyblud Codingisinmyblud commented Mar 27, 2026

Description

I added a test that spawns 4 threads making concurrent synchronous metacallht_s('divide') calls, which would then trigger the data race on the shared invoke_curl handle in function_rpc_interface_invoke.

Fixes #693

Type of change

  • [] Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests/screenshots (if any) that prove my fix is effective or that my feature works.
  • I have tested the tests implicated (if any) by my own code and they pass (make test or ctest -VV -R <test-name>).
  • If my change is significant or breaking, I have passed all tests with ./docker-compose.sh test &> output and attached the output.
  • I have tested my code with OPTION_BUILD_ADDRESS_SANITIZER or ./docker-compose.sh test-address-sanitizer &> output and OPTION_TEST_MEMORYCHECK.
  • I have tested my code with OPTION_BUILD_THREAD_SANITIZER or ./docker-compose.sh test-thread-sanitizer &> output.
  • I have tested with Helgrind in case my code works with threading.
  • I have run make clang-format in order to format my code and my code follows the style guidelines.

If you are unclear about any of the above checks, have a look at our documentation here.

@Codingisinmyblud Codingisinmyblud force-pushed the fix/rpc-invoke-curl-thread-safety-test branch from d1cb8be to 22297bb Compare March 27, 2026 05:46
@Codingisinmyblud
Copy link
Copy Markdown
Author

With the new tests added, I built with ThreadSanitizer and ran the new ConcurrentSyncInvoke test and outputted the results in a txt file to clearly see the data race.
Here's a screenshot to see the data race:

image

@viferga
Copy link
Copy Markdown
Member

viferga commented Mar 27, 2026

this is the test only without the fix, right?

@viferga
Copy link
Copy Markdown
Member

viferga commented Mar 27, 2026

I'm running the CI to trigger the issue.

@viferga
Copy link
Copy Markdown
Member

viferga commented Mar 27, 2026

It worked, tests are failing with data races and heap-use-after-free, if you PR the fix I will merge it.

@Codingisinmyblud
Copy link
Copy Markdown
Author

Thanks, I am working on the fix now, I'll commit the changes soon hopefully.

@viferga
Copy link
Copy Markdown
Member

viferga commented Apr 11, 2026

@anasbarg finally updated it: #765

I am closing this one in favor of the other, but thank you so much for pointing out the issue.

@viferga viferga closed this Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

function_rpc_interface_invoke is not thread-safe (shared invoke_curl handle causes data race)

2 participants