fix(crawler-ws): Improve pre-checks on zk-getdata and improve logging - #95
Open
Wisienkas wants to merge 3 commits into
Open
fix(crawler-ws): Improve pre-checks on zk-getdata and improve logging#95Wisienkas wants to merge 3 commits into
Wisienkas wants to merge 3 commits into
Conversation
fmendezh
approved these changes
Jul 31, 2026
There was a problem hiding this comment.
Pull request overview
This PR improves the coordinator’s ZooKeeper status reads to better tolerate transient races (e.g., nodes disappearing or being cleared during concurrent cleanup) and refines how those conditions are logged, reducing unnecessary failures when assembling dataset process status.
Changes:
- Handle empty
crawl-infoZK node data as a transient cleanup race and treat the dataset as not currently being processed. - Make
getState()more robust to missing/vanishing nodes and to invalid enum values, returningnullstate instead of failing. - Improve batch status retrieval logging by distinguishing expected ZooKeeper-related failures from unexpected errors.
Suppressed comments (1)
crawler-coordinator/src/main/java/org/gbif/crawler/DatasetProcessServiceImpl.java:395
- The WARN log in getState() drops the exception stack trace by logging e.toString() into a placeholder. For unexpected failures (i.e., not the benign concurrent-deletion case), keeping the Throwable as the last argument will preserve the stack trace and improve diagnosability.
LOG.warn(
"Could not read process state for dataset [{}] at path [{}], treating as unknown: {}",
datasetKey, path, e.toString());
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+139
to
+151
| // The crawl-info node can legitimately be empty for a short window: it happens when | ||
| // CoordinatorCleanupService is in the middle of deleting a finished crawl's ZK subtree | ||
| // at the same time this method reads it (checkExists() above succeeded, but the data was | ||
| // cleared/removed by the time we called getData()). This is expected, transient, and not | ||
| // an error worth a stack trace - see https://github.com/gbif/crawler/issues/2. | ||
| if (crawlJobBytes == null || crawlJobBytes.length == 0) { | ||
| LOG.warn( | ||
| "Crawl info node for dataset [{}] at path [{}] was empty, most likely a concurrent " | ||
| + "cleanup deletion; treating this dataset as not currently being processed", | ||
| datasetKey, | ||
| crawlPath); | ||
| return null; | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Fixed other test not considering state of mocked service - applied gbif style formatting
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.
No description provided.