feat: make concurrent CDK record queue unlimited to prevent deadlock#951
Draft
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Draft
feat: make concurrent CDK record queue unlimited to prevent deadlock#951devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Conversation
Co-Authored-By: unknown <>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1773333604-increase-queue-size#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1773333604-increase-queue-sizePR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
4 tasks
Co-Authored-By: unknown <>
…s default Setting DEFAULT_MAX_QUEUE_SIZE=0 broke ThreadPoolManager because it is also used as the default for max_concurrent_tasks. With max_concurrent_tasks=0, prune_to_validate_has_reached_futures_limit() always returns True (len >= 0), causing infinite warning spam and preventing any records from being processed. Fix: keep DEFAULT_MAX_QUEUE_SIZE=10_000 (used for futures limit) and only change the Queue(maxsize=0) in concurrent_source.py and concurrent_declarative_source.py (unlimited queue to prevent deadlock). Co-Authored-By: unknown <>
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.
feat: make concurrent CDK record queue unlimited to prevent deadlock
Summary
Makes the internal record queue unlimited (
maxsize=0) across the concurrent CDK to prevent a deadlock observed in Airbyte Cloud.Context: In Cloud, when the platform pauses reading from the source container's stdout pipe (e.g., due to destination backpressure), the main thread blocks on
print(), stops consuming from the internal queue, and the queue fills to capacity. Once full, all worker threads block onqueue.put(), causing a complete deadlock. A previous attempt withmaxsize=50_000was still insufficient — the queue filled before the platform resumed reading. Settingmaxsize=0(unlimited) prevents workers from ever blocking onqueue.put().Changes (2 files):
concurrent_source.py:Queue(maxsize=10_000)→Queue(maxsize=0)concurrent_declarative_source.py:Queue(maxsize=10_000)→Queue(maxsize=0)Note:
DEFAULT_MAX_QUEUE_SIZEinthread_pool_manager.pyis intentionally left at10_000. It controlsmax_concurrent_tasks(the futures/concurrency limit), which is a separate concern from the queue capacity. An earlier revision mistakenly set it to0, which brokeThreadPoolManagerentirely —prune_to_validate_has_reached_futures_limit()would always returnTrue(sincelen(futures) >= 0is always true), preventing any work from being submitted.Updates since last revision
thread_pool_manager.pychange from the previous revision.DEFAULT_MAX_QUEUE_SIZEstays at its original value of10_000to preserve themax_concurrent_tasksdefault. Only theQueue(maxsize=...)calls in the two source files are changed to0(unlimited). This cleanly separates queue capacity from the concurrency/futures limit.Review & Testing Checklist for Human
DEFAULT_MAX_PARTITIONS_NUMBERinConcurrentPerPartitionCursor— its docstring states it "needs to be higher thanThreadPoolManager.DEFAULT_MAX_QUEUE_SIZE". SinceDEFAULT_MAX_QUEUE_SIZEremains10_000(unchanged), this invariant is still satisfied, but worth confirming during review.Notes
Requested by @AnatoliiYatsuk.
Devin session