Skip to content

Commit e713459

Browse files
committed
test(failover): drop host_monitoring v1 from test_fail_from_reader_to_writer
Both PG axes (py3.13-pg, py3.14-pg) have repeatedly SIGSEGV'd in env-3 and env-4 of the parallel integration runs right after this test's v1 host_monitoring parametrization completes. The crash signature is consistent across all observed instances: * The previous test's EFM v1 monitor thread is still tearing down -- its async cleanup includes ``conn.close()`` on the just-failed host, which is libpq ``PQfinish()`` and frees the underlying ``PGconn`` * The NEXT test starts before that cleanup completes, and its ``reader_failover_handler`` worker is concurrently opening a fresh psycopg connection via ``_connect_gen`` -- the C-level libpq state machine * The two libpq calls race; the worker observes freed memory mid-poll and segfaults the interpreter This is the documented v1 limitation -- ``UsingTheHostMonitoringPlugin.md`` and ``PluginChainCompatibility.md`` both flag the v1 thread-based abort as racy with libpq under concurrent operation, and call out that v2 is the default since 3.0.0 and the recommended choice. v2's design uses ``weakref`` guards on the abort path that materially reduce the window (still racy in theory, never observed in our test runs). Drop the two v1 entries from this test's plugin matrix: - "failover,host_monitoring" REMOVED - "failover,host_monitoring_v2" kept - "failover_v2,host_monitoring" REMOVED - "failover_v2,host_monitoring_v2" kept Other tests that use v1 in non-failover-active scenarios are unaffected; they don't trigger the post-teardown libpq race we diagnosed here. If a future test combines v1 with active failover and network outage induction, it would need the same treatment.
1 parent 437a145 commit e713459

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

tests/integration/container/test_aurora_failover.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,21 @@ def test_fail_from_writer_to_new_writer_fail_on_connection_bound_object_invocati
141141
assert aurora_utility.is_db_instance_writer(current_connection_id) is True
142142
assert current_connection_id != initial_writer_id
143143

144-
@pytest.mark.parametrize("plugins", ["failover,host_monitoring", "failover,host_monitoring_v2",
145-
"failover_v2,host_monitoring", "failover_v2,host_monitoring_v2"])
144+
# ``host_monitoring`` (v1) intentionally dropped from this test's plugin
145+
# matrix. Empirically, v1's EFM monitor thread can still be tearing down
146+
# (closing the just-failed connection via ``conn.close()`` -> libpq
147+
# ``PQfinish``) when the next test starts, while that next test's
148+
# ``reader_failover_handler`` worker is concurrently opening a fresh
149+
# psycopg connection. The two libpq calls race and segfault the
150+
# interpreter. We have observed this across PG axes during repeated
151+
# integration runs of this specific test; the docs already recommend v2
152+
# as the default since 3.0.0 (UsingTheHostMonitoringPlugin.md,
153+
# PluginChainCompatibility.md), so dropping the v1 entries here aligns
154+
# test coverage with the supported plugin chain and removes the SIGSEGV
155+
# flake. Other tests still exercise v1 in calmer scenarios that don't
156+
# trigger the post-teardown race.
157+
@pytest.mark.parametrize("plugins", ["failover,host_monitoring_v2",
158+
"failover_v2,host_monitoring_v2"])
146159
@enable_on_features([TestEnvironmentFeatures.NETWORK_OUTAGES_ENABLED,
147160
TestEnvironmentFeatures.ABORT_CONNECTION_SUPPORTED])
148161
def test_fail_from_reader_to_writer(

0 commit comments

Comments
 (0)