refactor: refactor StatefulApiExtractor to fix busy buffer and EOF errors#8405
Merged
Conversation
3 tasks
klesh
reviewed
Apr 28, 2025
Contributor
klesh
left a comment
There was a problem hiding this comment.
Does the error disappear after this patch?
I would recommend to use db.Pluck to fetch all ids at once instead of using db.Cursor
09dd090 to
c040a3b
Compare
c040a3b to
09dd090
Compare
09dd090 to
522728d
Compare
Contributor
Author
Good idea, done a32009a Yes, I tested it locally and the error disappeared. mysql:
image: mysql:8
volumes:
- mysql-storage:/var/lib/mysql
restart: always
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: lake
MYSQL_USER: merico
MYSQL_PASSWORD: merico
TZ: UTC
command: --character-set-server=utf8mb4
--collation-server=utf8mb4_bin
--skip-log-bin
--max_allowed_packet=9M
--net_read_timeout=6
--net_write_timeout=6Without this fix, this scenario was already enough to have the error in subsequent executions. |
klesh
approved these changes
Apr 29, 2025
Contributor
|
Nice work. Thanks for your contribution. |
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.
Summary
This PR updates the
StatefulApiExtractor.Execute()method to avoid using a long-lived cursor while writing to the database. Previously, the cursor was kept open during data iteration and insertions, which led to errors likeunexpected EOFandbusy buffer. This change introduces a two-phase process: first, we collect all raw data IDs using a cursor and then close it. After that, each row is loaded individually by ID and processed safely. This avoids concurrency issues with the database connection and improves stability for high-volume data extractions.Does this close any open issues?
Closes #7826
Screenshots
Testing with Github connection

Testing with Jira connection

Other Information
This issue was observed during the
extractIssuesstep in the Jira plugin. It occurred consistently on subsequent executions of the task, but not on the first run after restarting the application.This change ensures a more robust extraction flow without requiring increased
max_allowed_packetsettings or other MySQL tuning.