Skip to content

Eliminate race conditions in mongoose_wpool_SUITE - #4602

Merged
telezynski merged 1 commit into
masterfrom
fix-max-worker-queue-len-test
Dec 16, 2025
Merged

telezynski merged 1 commit into
masterfrom
fix-max-worker-queue-len-test

Conversation

@chrzaszcz

@chrzaszcz chrzaszcz commented Dec 16, 2025 •

Copy link
Copy Markdown
Member

The max_worker_queue_len_with_two_workers test was flaky because even if a worker is not busy and has an empty queue, a new request occupies the queue for a short time.

As a result, a subsequent call to mongoose_wpool:cast/4 might assume that there are more requests in the queue than expected.

The solution is to ensure {waiting, Worker} is received before moving forward.

The test for one worker is just updated for consistency.

I checked both tests locally with a repetition of 1000x. Previously, there were 20-30 failures. Now there are none.

@chrzaszcz
chrzaszcz force-pushed the fix-max-worker-queue-len-test branch from 530bd29 to fb49721 Compare December 16, 2025 11:30
The max_worker_queue_len_with_two_workers test was flaky because even
if a worker is not busy and has an empty queue, a new request occupies
the queue for a short time.

As a result, a subsequent call to mongoose_wpool:cast/4 might assume
that there are more requests in the queue than expected.

The solution is to ensure {waiting, Worker} is received before moving
forward.

The test for one worker is just updated for consistency.
@chrzaszcz
chrzaszcz force-pushed the fix-max-worker-queue-len-test branch from fb49721 to 8ca811f Compare December 16, 2025 11:32
@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

mongoose-im commented Dec 16, 2025 •

Copy link
Copy Markdown
Collaborator

elasticsearch_and_cassandra_28 / elasticsearch_and_cassandra_mnesia / fb49721
Reports root/ big
OK: 683 / Failed: 0 / User-skipped: 72 / Auto-skipped: 0


small_tests_27 / small_tests / fb49721
Reports root / small


small_tests_28 / small_tests / fb49721
Reports root / small


small_tests_28_arm64 / small_tests / fb49721
Reports root / small


ldap_mnesia_27 / ldap_mnesia / fb49721
Reports root/ big
OK: 2358 / Failed: 0 / User-skipped: 1368 / Auto-skipped: 0


ldap_mnesia_28 / ldap_mnesia / fb49721
Reports root/ big
OK: 2358 / Failed: 0 / User-skipped: 1368 / Auto-skipped: 0


internal_mnesia_28 / internal_mnesia / fb49721
Reports root/ big
OK: 2502 / Failed: 0 / User-skipped: 1224 / Auto-skipped: 0


dynamic_domains_mysql_redis_28 / mysql_redis / fb49721
Reports root/ big
OK: 5192 / Failed: 0 / User-skipped: 157 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / fb49721
Reports root/ big
OK: 5227 / Failed: 0 / User-skipped: 122 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_28 / pgsql_mnesia / fb49721
Reports root/ big
OK: 5227 / Failed: 0 / User-skipped: 122 / Auto-skipped: 0


pgsql_cets_28 / pgsql_cets / fb49721
Reports root/ big
OK: 5317 / Failed: 0 / User-skipped: 198 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_28 / odbc_mssql_mnesia / fb49721
Reports root/ big
OK: 5222 / Failed: 0 / User-skipped: 127 / Auto-skipped: 0


pgsql_mnesia_28 / pgsql_mnesia / fb49721
Reports root/ big
OK: 5620 / Failed: 0 / User-skipped: 138 / Auto-skipped: 0


pgsql_mnesia_27 / pgsql_mnesia / fb49721
Reports root/ big
OK: 5620 / Failed: 0 / User-skipped: 138 / Auto-skipped: 0


mysql_redis_28 / mysql_redis / fb49721
Reports root/ big
OK: 5609 / Failed: 0 / User-skipped: 149 / Auto-skipped: 0


cockroachdb_cets_28 / cockroachdb_cets / fb49721
Reports root/ big
OK: 5315 / Failed: 2 / User-skipped: 198 / Auto-skipped: 3

pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3737@localhost/res1">>,
          escalus_tcp,<0.115310.0>,
          [{event_manager,<0.115290.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3737">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.115290.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3737">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3737">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3737">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"dabcfeaa05c2a8ad">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,444}]},
     {pubsub_tools,receive_and_c...

Report log

pubsub_SUITE:tree+hometree_specific:can_create_node_with_existing_parent_path
{error,{{badmatch,false},
    [{pubsub_tools,check_response,2,
             [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
            {line,455}]},
     {pubsub_tools,receive_response,3,
             [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
            {line,445}]},
     {pubsub_tools,receive_and_check_response,4,
             [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
            {line,435}]},
     {pubsub_SUITE,'-can_create_node_with_existing_parent_path/1-fun-0-',
             1,
             [{file,"/home/circleci/project/big_tests/tests/pubsub_SUITE.erl"},
            {line,1830}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,75}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1796}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1305}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1237}]}]}}

Report log


mssql_mnesia_28 / odbc_mssql_mnesia / fb49721
Reports root/ big
OK: 5615 / Failed: 0 / User-skipped: 143 / Auto-skipped: 0

@codecov

codecov Bot commented Dec 16, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.05%. Comparing base (0c2755f) to head (8ca811f).
⚠ïļ Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4602      +/-   ##
==========================================
- Coverage   86.07%   86.05%   -0.03%     
==========================================
  Files         565      565              
  Lines       33929    33929              
==========================================
- Hits        29206    29196      -10     
- Misses       4723     4733      +10     

☔ View full report in Codecov by Sentry.
ðŸ“Ē Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄ïļ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • ðŸ“Ķ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chrzaszcz
chrzaszcz marked this pull request as ready for review December 16, 2025 13:30

@telezynski telezynski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK!

@telezynski
telezynski merged commit d4f881e into master Dec 16, 2025
4 checks passed
@telezynski
telezynski deleted the fix-max-worker-queue-len-test branch December 16, 2025 14:11
@chrzaszcz chrzaszcz added this to the 6.6.0 milestone Mar 16, 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.

3 participants