Claus Ibsen created CAMEL-27949:
-----------------------------------

             Summary: camel-docling: CLI timeout does not apply to a hung 
process, output file lost for temp inputs, unused options and headers
                 Key: CAMEL-27949
                 URL: https://issues.apache.org/jira/browse/CAMEL-27949
             Project: Camel
          Issue Type: Bug
          Components: camel-docling
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-docling for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31192).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. processTimeout does not apply to a hung CLI process
{{DoclingProducer.executeDoclingCommand}} reads stdout to EOF before 
process.waitFor(processTimeout), so the timeout only starts once the process 
closes stdout, and a hung docling process blocks the producer thread forever.
Proposed change: read stdout in its own thread (as stderr already is), then 
waitFor with the timeout.

h4. 2. Output file is moved next to a temp or URL input
{{DoclingProducer.moveOutputFileToFinalLocation}} (CLI, contentInBody=false) 
moves the output next to the input file: for a String, byte[] or InputStream 
body the input is in the per-exchange temp dir, which is deleted when the 
exchange completes, so the path in the body points to a deleted file; for an 
http(s) input the move fails.
Proposed change: use a real output location, or put the content in the body, 
for temp and URL inputs.

h4. 3. CamelDoclingOutputFilePath breaks CLI conversions
With the CamelDoclingOutputFilePath header the CLI writes into that directory 
(it is the --output directory), but readGeneratedOutputFile and 
moveOutputFileToFinalLocation look in the temp dir, so the conversion fails 
with "No output file generated".

h4. 4. Options and headers without effect
asyncTaskTtl is only read from the component configuration 
(DoclingComponent.doStart, cleanupExpiredTasks). includeLayoutInfo adds 
--show-layout, which the CLI only uses for html_split_page, a format the 
component never requests. The chunking operations send no convert_options, so 
they ignore enableOCR, ocrLanguage, doOcr, pipeline and the other conversion 
options; EXTRACT_METADATA (docling-serve) and the chunking operations ignore 
useAsyncMode. The headers CamelDoclingProcessingOptions, 
CamelDoclingAsyncPollInterval and CamelDoclingAsyncTimeout are never read, and 
CamelDoclingMetadataLanguage is never set.
Proposed change: implement or deprecate them; pass ChunkDocumentRequest.options 
built by applyConfigurationToOptions.

h4. 5. Smaller issues
parseMetadataFromJson (CLI EXTRACT_METADATA) swallows a parse error with a WARN 
and returns metadata with only filePath, while the docling-serve path throws. 
outputFormat also accepts txt (not in the enum) and an unknown value silently 
becomes markdown. The ocrLanguage enum is a fixed list of ISO codes, while the 
OCR engines take engine-specific names and the CLI accepts lists. The Javadoc 
of DoclingOperations.EXTRACT_METADATA still mentions author and creation date.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to