I built a custom connector using the connector bui...
# replication-troubleshooting
g
I built a custom connector using the connector builder and it has been running great for months and then about a month ago started timing out and I just noticed it. I see some tables are changing from status RUNNING to COMPLETE but they remain in the async queue list. Some of the tables are empty. The state manager comment looks wrong:
Copy code
[ASYNC QUEUE INFO] Global: max: 593.92 MB, allocated: 10 MB (9.9977445602417 MB), % used: 0.016833345242386704 | Queue .................... | State Manager memory usage: Allocated: 9 MB, Used: -2365 bytes, percentage Used -0.000226
It just runs forever and never finishes. It used to take (consistently) ~5 minutes. I tried deleting the connection and recreating it but that did not work. I also tested each endpoint in the connection builder to see if it had any changes, but it everything works as it should. There is one table in the connection that has ~140k records so I disabled that and re-ran. It finished but took ages. I saw lots of comments like:
Copy code
gs://my_bucket/airbyte/my_table/2025/09/16/15/c29bb93c-80dc-47e7-9115-92f43ea8a485/0.csv.gz
gs://my_bucket/airbyte/my_table/2025/09/16/15/c29bb93c-80dc-47e7-9115-92f43ea8a485/1.csv.gz
...
Where there is one file with 42KB of data and then there are like 900 files with 0 bytes. So, something weird is happening here but I'm not sure what it is.
k
Based on the information in your question and the provided knowledge sources, it appears you are experiencing issues similar to those reported in other Airbyte syncs, particularly with the async queue and state manager reporting negative or unexpected memory usage, and the generation of many empty files during syncs. Key observations from the knowledge sources: - There are multiple reports of syncs hanging indefinitely, with the async queue showing 0 records and 0 bytes, and the state manager reporting negative memory usage (e.g., "Allocated: 9 MB, Used: -2365 bytes") or other nonsensical values. This is seen in both custom and official connectors, including destination-bigquery and destination-s3-data-lake. In some cases, the sync never finishes, and the process appears stuck even though no data is being processed or written, and the worker threads are idle [[destination-bigquery] Infinite synchronisation - negativ memory allocation](https://github.com/airbytehq/airbyte/issues/42109), [[destination-bigquery][source-jira] Sync hangs forever, saying nothing to do](https://github.com/airbytehq/airbyte/issues/58082). - The logs often show repeated attempts to flush empty batches, with messages like "Batch contains: 0 records, 0 bytes bytes" and warnings about trying to flush or close when "no printer is initialized." This is accompanied by the creation of many 0-byte files in the destination storage, which matches your observation of hundreds of empty files being generated [[destination-bigquery] Infinite synchronisation - negativ memory allocation](https://github.com/airbytehq/airbyte/issues/42109). - Disabling large tables or reducing the data volume sometimes allows the sync to complete, but it is much slower than expected, and the underlying issue with the async queue and state manager persists. What does this mean? - The negative or incorrect memory usage in the state manager and the creation of many empty files suggest a bug in the async queue or buffer management logic, possibly related to how empty streams or tables are handled. - This issue is not resolved by deleting and recreating the connection, and it is not specific to your custom connector, as similar symptoms are reported with official connectors. - The problem may be triggered or exacerbated by empty tables/streams or by changes in the connector or Airbyte platform version. What can you do? - There is no definitive fix documented in the knowledge sources. However, the issue is known and has been reported to the Airbyte team. - As a temporary workaround, you might try to avoid syncing empty tables/streams if possible, as this sometimes allows the sync to complete (albeit slowly). - If you are running a self-hosted Airbyte instance, consider upgrading to the latest version, as bug fixes may have been released since the time of the reported issues. - If the problem persists, you should open a GitHub issue (if you haven't already) and include detailed logs, especially the async queue and state manager output, as well as information about your Airbyte version and connector versions. Summary: Your issue matches known Airbyte bugs involving the async queue, state manager, and handling of empty tables/streams, resulting in syncs that hang, negative memory usage, and many empty files. There is no documented fix in the knowledge sources, but the problem is recognized by the Airbyte community and team [[destination-bigquery] Infinite synchronisation - negativ memory allocation](https://github.com/airbytehq/airbyte/issues/42109), [[destination-bigquery][source-jira] Sync hangs forever, saying nothing to do](https://github.com/airbytehq/airbyte/issues/58082).
g
This is running 1.8.2 which I upgraded to from 1.5 series to see if this would resolve. I'm on BQ connector (for destination) 0.4.2 and I'll try upgrading to 0.4.4.
Still getting stuck. In cloud storage I am seeing that the 0.csv files have data for all tables. Things just kind of hang for a while even though it looks like everything is processed and then I bunch of text flies by in the log about a flush worker and the StreamTransferManager uploading all of the 1.csv.gz and then a few minutes later the 2.csv.gz
Copy code
gsutil ls -r gs://my_bucket/airbyte  | grep airbyte_internal_my_prefix_ | grep 2.csv | xargs gsutil stat | grep Content-Leng
    Content-Length:         0
    Content-Length:         0
    Content-Length:         0
    Content-Length:         0
    Content-Length:         0
    Content-Length:         0
    Content-Length:         0
    Content-Length:         0
They are all 0 byte files.
Looks like one of the streams gets stuck in an extracted and the rest are loaded... I'm guessing this is just a swallowed error somewhere?
Yeah... if I remove just one of the streams (the one that gets stuck in "extracted") I can get the connection to sync.
h
Based on the information you've provided, it seems you're experiencing a complex issue with your custom connector. Let's break down the problem and explore some potential causes and solutions: 1. Timeout and Stuck Streams: The issue where some tables change from RUNNING to COMPLETE but remain in the async queue list suggests a problem with the state management or the completion of the sync process. This could be related to the state manager comment you've shared, which shows some unusual values:
Copy code
[ASYNC QUEUE INFO] Global: max: 593.92 MB, allocated: 10 MB (9.9977445602417 MB), % used: 0.016833345242386704 | Queue .................... | State Manager memory usage: Allocated: 9 MB, Used: -2365 bytes, percentage Used -0.000226
The negative values for used memory and percentage used are particularly concerning and might indicate a bug in the memory management or reporting. 2. Empty Tables and Zero-Byte Files: The presence of numerous zero-byte files (900 files with 0 bytes) alongside a single file with actual data (42KB) suggests that the connector is creating file placeholders but failing to write data to most of them. This could be due to: • A problem with the data extraction process • Issues with the file writing mechanism • Potential rate limiting or API errors that are not being properly handled 3. Stuck Stream: The fact that removing one specific stream (the one stuck in "extracted" state) allows the connection to sync indicates that this particular stream is causing the issue. This could be due to: • A change in the API or data structure for this specific stream • A bug in the connector's code for handling this stream • An edge case in the data that the connector isn't prepared to handle To address these issues, here are some steps you can take: 1. Review Connector Logs: Examine the detailed logs for the problematic stream. Look for any error messages, warnings, or unusual patterns that might explain why it's getting stuck. 2. Check for API Changes: Verify if there have been any recent changes to the API you're connecting to, especially for the problematic stream. Ensure your connector is still compatible with the current API version. 3. Validate Data Structure: Examine the data in the problematic stream. Look for any unusual records, data types, or volumes that might be causing issues. 4. Update Connector Builder: If you're using an older version of the connector builder, consider updating to the latest version. There might be bug fixes or improvements that address your issue. 5. Adjust Batch Size or Rate Limiting: Try adjusting the batch size for data extraction or implementing rate limiting if it's not already in place. This could help if the issue is related to processing large volumes of data. 6. Memory Management: The unusual state manager memory usage suggests a potential memory management issue. Review your connector's code for any memory leaks or inefficient memory usage, especially in the problematic stream.