Skip to content

Tests: Flakyness with "active servers" logic within test suite #404

Closed

Description

@amotl

Hi,

on [1] and [2], I just observed a flakyness on a single job when running the tests on #397 and #402.

File "/home/runner/work/crate-python/crate-python/src/crate/client/doctests/http.txt", line 41, in http.txt
Failed example:
    http_client._active_servers
Expected:
    ['http://127.0.0.1:44209']
Got:
    ['http://invalid_host:9999', 'http://127.0.0.1:44209']

With kind regards,
Andreas.

[1] https://github.com/crate/crate-python/actions/runs/687059879
[2] https://github.com/crate/crate-python/runs/2195227267#step:5:199

Activity

  1. amotl commented on Mar 25, 2021

    @amotl
    ContributorAuthor

    Maybe this happens because the retry interval is set to a very low value when running the tests.

    def setUp(self):
    self.client = Client(self.servers)
    self.client.retry_interval = 0.1 # faster retry

    So, the invalid_host might have gotten swapped out and back in again too quickly.

    I actually recognized that this specific job was executing very slow, so it probably has been scheduled on a CI machine currently experiencing more load than others.

  2. changed the title [-]Flakyness with "active servers" logic[/-] [+]Flakyness with "active servers" logic within test suite[/+] on Mar 25, 2021
  3. amotl commented on Mar 26, 2021

    @amotl
    ContributorAuthor

    Observed this again when running the tests on behalf of #402. So, I added 89507a0 there.

  4. amotl commented on Apr 8, 2021

    @amotl
    ContributorAuthor

    The same thing happened again at https://github.com/crate/crate-python/runs/2297326550#step:6:184.

    File "/home/runner/work/crate-python/crate-python/src/crate/client/doctests/http.txt", line 41, in http.txt
    Failed example:
        http_client._active_servers
    Expected:
        ['http://127.0.0.1:44209']
    Got:
        ['http://invalid_host:9999', 'http://127.0.0.1:44209']
    
  5. reopened this on Apr 8, 2021
  6. amotl commented on Apr 8, 2021

    @amotl
    ContributorAuthor

    Now also, slightly different but the same issue, at https://github.com/crate/crate-python/runs/2297736340#step:6:166.

    File "/home/runner/work/crate-python/crate-python/src/crate/client/doctests/http.txt", line 61, in http.txt
    Failed example:
        http_client._get_server()
    Expected:
        'http://invalid_host:9999'
    Got:
        'http://even_more_invalid_host:9999'
    
  7. changed the title [-]Flakyness with "active servers" logic within test suite[/-] [+]Tests: Flakyness with "active servers" logic within test suite[/+] on Apr 26, 2022
  8. amotl commented on Apr 28, 2022

    @amotl
    ContributorAuthor

    Same thing happens again 12:

    File "/home/runner/work/crate-python/crate-python/src/crate/client/doctests/http.txt", line 41, in http.txt
    Failed example:
        http_client._active_servers
    Expected:
        ['http://127.0.0.1:44209/']
    Got:
        ['http://invalid_host:9999', 'http://127.0.0.1:44209/']
    

    Footnotes

    1. https://github.com/crate/crate-python/runs/6210356011#step:6:283 ↩

    2. https://github.com/crate/crate-python/runs/6300072011#step:5:287 ↩

  9. amotl commented on Sep 29, 2022

    @amotl
    ContributorAuthor

    I did not observe this flaw recently, so I am closing this issue.

  10. amotl commented on Oct 6, 2022

    @amotl
    ContributorAuthor

    It still happens when runners seem to be slow.

    File "/home/runner/work/crate-python/crate-python/src/crate/client/doctests/http.txt", line 41, in http.txt
    Failed example:
        http_client._active_servers
    Expected:
        ['http://127.0.0.1:44209/']
    Got:
        ['http://invalid_host:9999', 'http://127.0.0.1:44209/']
    

    -- https://github.com/crate/crate-python/actions/runs/3198965176/jobs/5224159502#step:4:338

  11. reopened this on Oct 6, 2022
  12. 1 remaining item

  13. amotl commented on Dec 16, 2022

    @amotl
    ContributorAuthor
  14. amotl commented on Jun 17, 2024

    @amotl
    ContributorAuthor

    Still happening occasionally. One re-run usually fixes the fluke.

    -- https://github.com/crate/crate-python/actions/runs/9545350897/job/26305926214#step:4:651

  15. amotl commented on Oct 25, 2024

    @amotl
    ContributorAuthor

    This issue has not been observed recently, so I am closing this.

  16. amotl commented on Dec 10, 2025

    @amotl
    ContributorAuthor

    @surister shared an evaluation about this fluke at #747 (comment):

    My hypothesis is that either:

    • The tests are not correctly written to take into account the driver's multi-threading behavior.
    • There is a subtle bug in the multi-threading part of the code.

    Having the right result but different order in multi-threading python code is common imo.

    Thanks, that's an excellent assessment. Do you see a chance to fix this issue positively?

  17. reopened this on Dec 10, 2025
  18. amotl commented on Dec 16, 2025

    @amotl
    ContributorAuthor
    >       self.assertRegex(layer.crate_servers[0], r"[http://127.0.0.1:442\d\d](http://127.0.0.1:442/d/d)")
                             ^^^^^^^^^^^^^^^^^^^^^^
    E       IndexError: list index out of range

    -- https://github.com/crate/crate-python/actions/runs/20072360014/job/57577711112?pr=741#step:6:235

    >       sql_uri = layer.crate_servers[0] + "/_sql"
                      ^^^^^^^^^^^^^^^^^^^^^^
    E       IndexError: list index out of range

    -- https://github.com/crate/crate-python/actions/runs/20072361183/job/57577715457?pr=745#step:6:250

  19. amotl commented on Jan 20, 2026

    @amotl
    ContributorAuthor

    Apparently, after a few refactorings, the problem is mostly happening on macOS now, see also GH-772?

    Image
  20. amotl commented on Jan 20, 2026

    @amotl
    ContributorAuthor

    Another sample from GH-750, also occurring on macOS.

    FAILED tests/testing/test_layer.py::LayerTest::test_cluster - AssertionError: 1 != 2
    FAILED tests/testing/test_layer.py::LayerTest::test_default_settings - AssertionError: 'http://127.0.0.1:4201/' != 'http://127.0.0.1:4200/'
    - http://127.0.0.1:4201/
    ?                     ^
    + http://127.0.0.1:4200/
    ?                     ^
    

    -- https://github.com/crate/crate-python/actions/runs/21177084017/job/60908800502?pr=750#step:6:4296

  21. amotl commented on Feb 7, 2026

    @amotl
    ContributorAuthor

    I think this spot is a leftover. Let's close this issue, and carry things forward on the new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions