Fix multiple test failures#13
Merged
5xuanwen merged 51 commits intoHuaweiCloudDeveloper:masterfrom Nov 26, 2025
Merged
Conversation
This commit addresses the following test failures: 1. Connection pool and timeout issues: - Fix timeout error in test_pool_04 - Fix timeout error in test_command_timeout_01 2. Execution-related failures: - Fix error message matching in test_execute_exceptions_1 - Fix result order assertion in test_executemany_client_failure_in_transaction 3. Database feature support: - Handle unsupported CREATE TABLE INHERITS feature - Fix column not found error message format matching 4. Codec-related issues: - Fix extension security warnings by proper enable_extension handling - Fix syntax error in void type handling
…fic) This commit addresses critical concurrency issues in the `COPY OUT` protocol implementation. These issues were specifically observed in Python 3.9.9 environments (likely due to differences in asyncio event loop scheduling compared to newer versions like 3.13), leading to deadlocks and data corruption. Changes: 1. Fix Data Loss (Backpressure Handling): - Issue: In Python 3.9, `_dispatch_result` could be triggered multiple times while the sink was paused, overwriting `_pending_result`. - Fix: Implemented data merging logic. New incoming data is now appended to the existing pending buffer instead of replacing it. 2. Fix State Pollution on Cancel: - Issue: Cancelling a `COPY` task left residual data in `_pending_result`. Subsequent queries (e.g., `SELECT 1`) would incorrectly consume this stale data, causing `AttributeError: 'tuple' object has no attribute '_init_types'`. - Fix: Added a `try...finally` block in `copy_out` to unconditionally clear `_pending_result` and reset protocol state upon exit. 3. Fix Deadlocks: - Issue: The connection could get stuck in a paused state if execution was interrupted or if `resume_reading` was missed. - Fix: Ensured `self.resume_reading()` is called immediately after consuming buffered data in `_new_waiter` and in the cleanup phase. 4. Fix Logic Errors: - corrected `_new_waiter` to prevent assigning completed Futures to `self.waiter`, avoiding `InternalClientError`. Fixes HuaweiCloudDeveloper#8
Author
|
Fix COPY OUT race conditions and state corruption (Python 3.9.9 specific) This commit addresses critical concurrency issues in the Changes:
Fixes #8 |
This was
linked to
issues
Nov 26, 2025
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix multiple test failures
This commit addresses the following test failures:
Connection pool and timeout issues:
Execution-related failures:
Database feature support:
Codec-related issues:
These fixes improve test suite stability and code robustness.