Commit 22a687b
authored
CAMEL-23459: Add TTL cleanup for pending async tasks to prevent memory leak
Fix a memory leak in the camel-docling component where pending async
conversion tasks accumulated indefinitely in the shared
`pendingAsyncTasks` map (e.g. when the consumer that would normally
poll the result is removed or never started).
Each pending task is now wrapped in an `AsyncTaskEntry` carrying a
creation timestamp. A background scheduler — interval = 10% of the
TTL, floor 1s — evicts entries older than `asyncTaskTtl` (default
24h). The eviction is additive and backward-compatible: normal task
consumption is unchanged, and only tasks that would never be claimed
are removed. Lifecycle/eviction logging is at DEBUG.
Includes a new `DoclingAsyncTaskTtlTest` (Awaitility-based, no
`Thread.sleep`) covering eviction-after-TTL, no-eviction-before-TTL,
and multi-task eviction. Pre-existing `DoclingAsyncConversionTest`
was updated to use the new `AsyncTaskEntry` wrapper (was throwing
`ClassCastException`). Top-level catalog/DSL artifacts regenerated.
Closes #231251 parent b2c58eb commit 22a687b
15 files changed
Lines changed: 535 additions & 180 deletions
File tree
- catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components
- components/camel-ai/camel-docling/src
- generated
- java/org/apache/camel/component/docling
- resources/META-INF/org/apache/camel/component/docling
- main
- docs
- java/org/apache/camel/component/docling
- test/java/org/apache/camel/component/docling
- dsl
- camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl
- camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl
Lines changed: 81 additions & 79 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
| 149 | + | |
| 150 | + | |
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
| |||
253 | 257 | | |
254 | 258 | | |
255 | 259 | | |
| 260 | + | |
| 261 | + | |
256 | 262 | | |
257 | 263 | | |
258 | 264 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| 137 | + | |
| 138 | + | |
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
| |||
236 | 240 | | |
237 | 241 | | |
238 | 242 | | |
| 243 | + | |
| 244 | + | |
239 | 245 | | |
240 | 246 | | |
241 | 247 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
| 139 | + | |
| 140 | + | |
137 | 141 | | |
138 | 142 | | |
139 | 143 | | |
| |||
240 | 244 | | |
241 | 245 | | |
242 | 246 | | |
| 247 | + | |
| 248 | + | |
243 | 249 | | |
244 | 250 | | |
245 | 251 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
0 commit comments