Andrea Cosentino created CAMEL-23105:
----------------------------------------
Summary: camel-docling - Fix broken async conversion workflow
(discarded result and error masking)
Key: CAMEL-23105
URL: https://issues.apache.org/jira/browse/CAMEL-23105
Project: Camel
Issue Type: Bug
Affects Versions: 4.18.0
Reporter: Andrea Cosentino
Assignee: Andrea Cosentino
Fix For: 4.18.1, 4.19.0
In DoclingProducer.processSubmitAsyncConversion(), the
CompletionStage<ConvertDocumentResponse> returned by
doclingServeApi.convertSourceAsync(request) is obtained but immediately
discarded. A fabricated task ID ("task-" + timestamp + "-" + hashCode) is
returned that has no correlation to any server-side async task.
When CHECK_CONVERSION_STATUS is subsequently called with this fabricated task
ID, pollTaskStatus fails because the server has no record of it. The failure is
then silently masked by the related bug in checkConversionStatusInternal(),
which returns COMPLETED on any exception - making it appear as though the
conversion succeeded.
In DoclingProducer.checkConversionStatusInternal(), when an exception occurs
during the task status poll (server unavailable, invalid task ID, network
error), the catch block silently returns ConversionStatus.Status.COMPLETED as a
fallback:
} catch (Exception e) {
LOG.warn("Failed to check task status for {}: {}", taskId,
e.getMessage());
return new ConversionStatus(taskId, ConversionStatus.Status.COMPLETED);
}
This causes callers to believe the conversion finished successfully when in
reality the status check failed. Combined with TASK-18 (fabricated task IDs),
this makes the entire async conversion workflow silently broken.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)