Skip to content

qa: Intermittent failure in feature_torcontrol.py #36934

Open

Description

@hebasto

On NetBSD, https://github.com/hebasto/bitcoin-core-nightly/actions/runs/44695205979/job/136150209517:

239/505 - feature_torcontrol.py failed (exit code 1), Duration: 16 s

stdout:
2026-11-20T08:08:19.631776Z TestFramework (INFO): PRNG seed is: 3002543142632938165
2026-11-20T08:08:19.633271Z TestFramework (INFO): Initializing test directory /root/test_runner_₿_🏃_20261120_080316/feature_torcontrol_260
2026-11-20T08:08:19.969142Z TestFramework (INFO): Test Tor control basic functionality
2026-11-20T08:08:20.575507Z TestFramework (INFO): Test a later ADD_ONION reply without a service ID
2026-11-20T08:08:22.814947Z TestFramework (INFO): Test that partial Tor control responses are buffered until complete
2026-11-20T08:08:25.403434Z TestFramework (INFO): Test that ADD_ONION retries without PoW on 512 error
2026-11-20T08:08:26.486979Z TestFramework (INFO): Test that Tor control does not disconnect with a MAX_LINE_LENGTH line.
2026-11-20T08:08:28.581094Z TestFramework (INFO): Test that Tor control disconnects with a MAX_LINE_LENGTH + 1 line
2026-11-20T08:08:30.115302Z TestFramework (INFO): Test that Tor control does not disconnect on receiving MAX_LINE_COUNT lines.
2026-11-20T08:08:32.279379Z TestFramework (INFO): Test that Tor control disconnects on receiving MAX_LINE_COUNT + 1 lines.
2026-11-20T08:08:35.597269Z TestFramework (ERROR): Unexpected exception:
Traceback (most recent call last):
  File "/root/bitcoin/test/functional/test_framework/test_framework.py", line 146, in main
    self.run_test()
    ~~~~~~~~~~~~~^^
  File "/root/build/test/functional/feature_torcontrol.py", line 367, in run_test
    self.test_overmany_lines()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/root/build/test/functional/feature_torcontrol.py", line 278, in test_overmany_lines
    with self.expect_disconnect(True, mock_tor):
         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/pkg/lib/python3.13/contextlib.py", line 148, in __exit__
    next(self.gen)
    ~~~~^^^^^^^^^^
  File "/root/build/test/functional/feature_torcontrol.py", line 153, in expect_disconnect
    ensure_for(duration=0.5, f=lambda: len(mock_tor.received_commands) == initial_len)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/bitcoin/test/functional/test_framework/util.py", line 422, in ensure_for
    raise AssertionError(f"Predicate {predicate_source} became false within {duration} seconds")
AssertionError: Predicate ''''
            ensure_for(duration=0.5, f=lambda: len(mock_tor.received_commands) == initial_len)
''' became false within 0.5 seconds
2026-11-20T08:08:35.709440Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
2026-11-20T08:08:35.709711Z TestFramework (WARNING): Not cleaning up dir /root/test_runner_₿_🏃_20261120_080316/feature_torcontrol_260
2026-11-20T08:08:35.709877Z TestFramework (ERROR): Test failed. Test logging available at /root/test_runner_₿_🏃_20261120_080316/feature_torcontrol_260/test_framework.log
2026-11-20T08:08:35.710733Z TestFramework (ERROR): 
2026-11-20T08:08:35.710832Z TestFramework (ERROR): Hint: Call /root/bitcoin/test/functional/combine_logs.py '/root/test_runner_₿_🏃_20261120_080316/feature_torcontrol_260' to consolidate all logs
2026-11-20T08:08:35.710917Z TestFramework (ERROR): 
2026-11-20T08:08:35.710958Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2026-11-20T08:08:35.711230Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
2026-11-20T08:08:35.711307Z TestFramework (ERROR): 


stderr:
[node 0] Cleaning up leftover process

The failure can be reliably reproduced on Linux with the following patch:

--- a/test/functional/feature_torcontrol.py
+++ b/test/functional/feature_torcontrol.py
@@ -6,6 +6,7 @@
 from contextlib import contextmanager
 import socket
 import threading
+import time
 from test_framework.test_framework import BitcoinTestFramework
 from test_framework.util import (
     assert_equal,
@@ -278,6 +279,7 @@ class TorControlTest(BitcoinTestFramework):
         with self.expect_disconnect(True, mock_tor):
             for _ in range(MAX_LINE_COUNT + 1):
                 mock_tor.send_raw("250-Continuing\r\n")
+            time.sleep(1.5)
 
         mock_tor.stop()
 

Activity

  1. hebasto commented on Nov 21, 2026

    @hebasto
    MemberAuthor

    https://github.com/hebasto/bitcoin-core-nightly/actions/runs/44880018311/job/136773031364:

    240/505 - feature_torcontrol.py failed (exit code 1), Duration: 20 s
    
    stdout:
    2026-11-21T08:19:42.003371Z TestFramework (INFO): PRNG seed is: 6825479609072239518
    2026-11-21T08:19:42.058526Z TestFramework (INFO): Initializing test directory /root/test_runner_₿_🏃_20261121_081333/feature_torcontrol_260
    2026-11-21T08:19:42.424070Z TestFramework (INFO): Test Tor control basic functionality
    2026-11-21T08:19:43.028325Z TestFramework (INFO): Test a later ADD_ONION reply without a service ID
    2026-11-21T08:19:45.247632Z TestFramework (INFO): Test that partial Tor control responses are buffered until complete
    2026-11-21T08:19:48.178223Z TestFramework (INFO): Test that -torpassword is sent hex-encoded, so special characters survive
    2026-11-21T08:19:48.664202Z TestFramework (INFO): Test that ADD_ONION retries without PoW on 512 error
    2026-11-21T08:19:50.771952Z TestFramework (INFO): Test that Tor control does not disconnect with a MAX_LINE_LENGTH line.
    2026-11-21T08:19:52.955265Z TestFramework (INFO): Test that Tor control disconnects with a MAX_LINE_LENGTH + 1 line
    2026-11-21T08:19:55.194426Z TestFramework (INFO): Test that Tor control does not disconnect on receiving MAX_LINE_COUNT lines.
    2026-11-21T08:19:57.292276Z TestFramework (INFO): Test that Tor control disconnects on receiving MAX_LINE_COUNT + 1 lines.
    2026-11-21T08:20:01.661000Z TestFramework (ERROR): Unexpected exception:
    Traceback (most recent call last):
      File "/root/bitcoin/test/functional/test_framework/test_framework.py", line 149, in main
        self.run_test()
        ~~~~~~~~~~~~~^^
      File "/root/build/test/functional/feature_torcontrol.py", line 404, in run_test
        self.test_overmany_lines()
        ~~~~~~~~~~~~~~~~~~~~~~~~^^
      File "/root/build/test/functional/feature_torcontrol.py", line 314, in test_overmany_lines
        with self.expect_disconnect(True, mock_tor):
             ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
      File "/usr/pkg/lib/python3.13/contextlib.py", line 148, in __exit__
        next(self.gen)
        ~~~~^^^^^^^^^^
      File "/root/build/test/functional/feature_torcontrol.py", line 153, in expect_disconnect
        ensure_for(duration=0.5, f=lambda: len(mock_tor.received_commands) == initial_len)
        ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/bitcoin/test/functional/test_framework/util.py", line 422, in ensure_for
        raise AssertionError(f"Predicate {predicate_source} became false within {duration} seconds")
    AssertionError: Predicate ''''
                ensure_for(duration=0.5, f=lambda: len(mock_tor.received_commands) == initial_len)
    ''' became false within 0.5 seconds
    2026-11-21T08:20:01.721111Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
    2026-11-21T08:20:01.721366Z TestFramework (WARNING): Not cleaning up dir /root/test_runner_₿_🏃_20261121_081333/feature_torcontrol_260
    2026-11-21T08:20:01.721481Z TestFramework (ERROR): Test failed. Test logging available at /root/test_runner_₿_🏃_20261121_081333/feature_torcontrol_260/test_framework.log
    2026-11-21T08:20:01.721726Z TestFramework (ERROR): 
    2026-11-21T08:20:01.721910Z TestFramework (ERROR): Hint: Call /root/bitcoin/test/functional/combine_logs.py '/root/test_runner_₿_🏃_20261121_081333/feature_torcontrol_260' to consolidate all logs
    2026-11-21T08:20:01.721999Z TestFramework (ERROR): 
    2026-11-21T08:20:01.722067Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    2026-11-21T08:20:01.722270Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
    2026-11-21T08:20:01.722370Z TestFramework (ERROR): 
    
    
    stderr:
    [node 0] Cleaning up leftover process
    
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions