# Displaying huge job logs without running out of memory

**URL:** <https://forum.xwiki.org/t/displaying-huge-job-logs-without-running-out-of-memory/19156>\
**Category:** Development\
**Tags:** proposal\
**Created:** [November 30, 2026, 4:10pm UTC](https://forum.xwiki.org/t/displaying-huge-job-logs-without-running-out-of-memory/19156 "2026-11-30T16:10:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichaelHamann](https://forum.xwiki.org/user_avatar/forum.xwiki.org/michaelhamann/32/3813_2.png) [@MichaelHamann](https://forum.xwiki.org/u/MichaelHamann)\
**Post date:** [November 30, 2026, 4:10pm UTC](https://forum.xwiki.org/t/displaying-huge-job-logs-without-running-out-of-memory/19156/1 "2026-11-30T16:10:45Z")

</div>

Hi everyone,

huge job logs are currently displayed as a whole, which can lead to an OOM on the server (see [XWIKI-16647](https://jira.xwiki.org/browse/XWIKI-16647)). Most likely they also cause unresponsiveness and high memory usage in the browser. The reason is that every display path turns the whole log into one big string, often several times: the Velocity output, then the wiki parser, then the HTML cleaner. The extension manager does this again every second while a job is running, because its refresh loop re-renders the whole extension display including the log. I would like to work on this as part of the December roadmap for the stabilization of XWiki 18.10.x. There are several possible options, and I would like your opinion on them.

## Option 0: Raw output for script macros

The cheapest improvement is the one I proposed in [Raw output for the Velocity and other script macros](https://forum.xwiki.org/t/raw-output-for-the-velocity-and-other-script-macros/19155). It would avoid parsing and copying the log HTML as wiki syntax, which is where the reported OOM seems to happen. It would still render the whole log as one string on every refresh, though, so I don’t think it’s enough on its own, and it might just move the OOM or still lead to slowness due to high memory usage.

## Option 1: Live Data

As discussed [before](https://forum.xwiki.org/t/logging-warning-stacktraces-in-debug-mode/18728), we could move the whole job log to Live Data. This fits relatively well for displaying the logs of finished jobs. With the current file-based storage, a filter by level would be cheap, but text search or sorting would need to read the whole log file. For running jobs, the table layout is paginated, so following new log entries would mean going to the last page and refreshing it regularly. A continuously scrolling log that follows new entries would need a custom Live Data layout that loads and caches its own ranges of entries. That’s possible, but it basically means writing a full log component inside Live Data.

I think this becomes a better fit once job logs move to a shared store as part of [XCOMMONS-3249](https://jira.xwiki.org/browse/XCOMMONS-3249). However, XCOMMONS-3249 is far too big a change for 18.10.x. So even though Live Data is the solution I would favor long-term, I don’t think it’s a good short-term fix.

## Option 2: Load only part of the job log

Initially, display only a limited number of the most recent log entries, say, 100. Above the first displayed entry, a notice says that there are more entries, with a button to load 100 more. New entries of a running job are appended by their index instead of re-rendering the log. The server can render any range of entries one by one and stream them to the response, so it never holds the whole log in memory. This would apply to all places that display job logs (extension manager, copy/rename/delete, wiki creation, etc.), not just extensions.

For extensions, we would also need to change the extension refresh loop so that it stops replacing the whole extension display, including the log, every second. If that turns out to be too invasive for a first step, a fallback is to keep refreshing the whole display, but with the log capped to the last 100 entries, and to show the “load more” button only once the job has finished.

**Question 1: How can users access the full log?**

Users should still be able to display the full log at once, for example to search in it. I see two options, which aren’t exclusive:

1. Add a “Load all N entries” button. This won’t cause an OOM on the server, since the entries can be streamed (this is not possible in the initial load where we render a full page, but it seems possible for refreshes/loading of more entries). On really huge logs it would still create a huge page in the browser, but only on an explicit click, with the number of entries shown on the button.
2. Add a link to download the full log as plain text, also streamed.

**Question 2: Limit new log entries per refresh?**

Should we limit the number of new entries added at a time, and add a gap marker (which can be clicked to load the missing entries) if there are, e.g., more than 100 new entries in a single refresh?

**Question 3: Limit the total displayed log size?**

If a job runs for a long time, the displayed log could still grow quite big, even with the initial limit and a limit per refresh. Should we discard the oldest displayed entries in that case, to keep, say, at most 1000 entries? To make this work with “load all” from question 1, we could discard entries only while following a running job, and stop discarding once the user has explicitly loaded older entries.

**Question 4: Load stack traces on demand?**

To further reduce the size of the displayed log, we could stop rendering stack traces by default and load them only when the user clicks on the log entry. This matters especially if we decide to log more/all stack traces (see [Logging warning stacktraces in debug mode](https://forum.xwiki.org/t/logging-warning-stacktraces-in-debug-mode/18728)). Each log entry would carry its index, plus a check that it’s still the same entry, since some jobs reuse their identifier and replace their log. Searching the page with Ctrl+F already misses collapsed stack traces today, so this wouldn’t change much. The plain-text download from question 1 would be the way to search them.

## Option 3: Client-side rendering without Live Data

For completeness: we could also write a dedicated client-side log component, for example in Vue. The server would provide pages of structured log entries, and the component would display only the visible entries (virtualized list) and keep a limited number of pages in memory. This gives the best control over memory and following a running job. However, it’s a lot of new code next to Live Data, and it needs the same work on the server (paging by level, serializing log arguments) as Live Data would. I don’t think it’s worth it compared to option 1 in the long term and option 2 in the short term.

## Summary

My current plan would be option 2 now, to be backported to stable-18.10.x, and option 1 once XCOMMONS-3249 is done. Which of the answers to questions 1–4 would you prefer? Do you have any other ideas or feedback on this topic?

Note that these questions and ideas are based on a preliminary analysis with Claude Opus 5.5. Neither Claude nor I have fully verified that each option can be implemented. With this proposal, I mainly want to gather your opinions on which of these options I should pursue further.

Disclaimer: this proposal was written with the help of Claude Opus 5.5, based on an initial draft written by me.

---

<div class="post-metadata">

**Author:** ![mleduc](https://forum.xwiki.org/user_avatar/forum.xwiki.org/mleduc/32/2328_2.png) [@mleduc](https://forum.xwiki.org/u/mleduc)\
**Post date:** [December 1, 2026, 11:18am UTC](https://forum.xwiki.org/t/displaying-huge-job-logs-without-running-out-of-memory/19156/2 "2026-12-01T11:18:23Z")

</div>

Thanks for the proposal.  
+1 for option 2 now with a 18.10.x backport  
-1 for option 3.  
+1 for option 0 as well

I quickly checked other tools, and they never render a whole large log. They:

- Show a truncated most recent logs + fetch new content incrementally
- Offer a raw download.

On your questions:

1. I’d do both. 1 for really huge logs and for searching stack traces locally, 2 sounds more straightforward for medium size logs
2. +1
3. +1
4. +1 but could just be a follow-up imo

Also, would it be interesting to have a test with a large log?

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [December 1, 2026, 11:35am UTC](https://forum.xwiki.org/t/displaying-huge-job-logs-without-running-out-of-memory/19156/3 "2026-12-01T11:35:55Z")

</div>

I agree that option 2 is the most manageable solution for 18.10.x.

And yes option 1 offer of a lot of possibilities the current view is lacking (filtering, etc.) but I also think we would really need two different views depending if the job is finished or still running (standard livedata pages are pretty much unusable for following a running job).

> [@MichaelHamann](#):
>
> **Question 1: How can users access the full log?**

Same as @mleduc I feel we need both.

> [@MichaelHamann](#):
>
> **Question 2: Limit new log entries per refresh?**

The gap marker idea sounds good.

> [@MichaelHamann](#):
>
> **Question 3: Limit the total displayed log size?**

+1

> [@MichaelHamann](#):
>
> **Question 4: Load stack traces on demand?**

+1, stack traces are already collapsed, so loading them on demand makes a lot of sense

---

<div class="post-metadata">

**Author:** ![lucaa](https://forum.xwiki.org/user_avatar/forum.xwiki.org/lucaa/32/2537_2.png) [@lucaa](https://forum.xwiki.org/u/lucaa)\
**Post date:** [December 1, 2026, 6:47pm UTC](https://forum.xwiki.org/t/displaying-huge-job-logs-without-running-out-of-memory/19156/4 "2026-12-01T18:47:15Z")

</div>

+1 for 0

> It would still render the whole log as one string on every refresh, though, so I don’t think it’s enough on its own, and it might just move the OOM or still lead to slowness due to high memory usage.

I’m not sure this is the case. IIRC, the increase of memory required for the parsing of the result text was 100 fold (100 times more bytes were needed for the memory structures needed for rendering the HTML macro). I would seriously give it a try just without html rendering, my guess is that it would already cover a good number of cases and would bring a significant improvement, with a moderate amount of changes.

-1 for 1  
-0 for 2, with  
question 1 : both options are needed  
question 2 : I don’t understand it  
question 3 : why would we need this? I have the feeling it’s complicating the UI (stuff that was displayed before is disappearing but not always) and I’m not sure what benefit it’s supposed to bring  
question 4: I’m not sure it’s a great idea, in the sense that it adds extra dynamic which may create issues without knowing whether it will bring issues or not.

**Now, related to the proposed options (and related to option 0):**

I believe that it makes a LOT of sense to have a rest service that can provide a representation of the logs of a job, in html ( at least).

There is [https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HJobresources](https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HJobresources) that can display a log, but only as XML. An option or similar rest service that would provide the logs of the job in the html format expected by the extension manager would largely do the job, no? This way, the rendering of the job status is not made from a wiki page script, using wiki macros (it’s not bringing anything).

This service could also provide the serialization of a job log as plain text, which would be a great amazing addition to its current XML job log representation, allowing users to see it and search in it, or feed it (live!) to some analysis tools.

Is there any reason this was not in the proposed solutions?

Hope this helps,  
Anca

---

<div class="post-metadata">

**Author:** ![mflorea](https://forum.xwiki.org/user_avatar/forum.xwiki.org/mflorea/32/49_2.png) [@mflorea](https://forum.xwiki.org/u/mflorea)\
**Post date:** [December 2, 2026, 10:25am UTC](https://forum.xwiki.org/t/displaying-huge-job-logs-without-running-out-of-memory/19156/5 "2026-12-02T10:25:08Z")

</div>

> [@lucaa](#):
>
> I believe that it makes a LOT of sense to have a rest service that can provide a representation of the logs of a job, in html ( at least).

I wouldn’t generate the HTML in the REST resource. I’d return JSON or plain text instead, and let the client-side handle the display. REST resource works for a finished job. For a running job I’d look into using a WebSocket end-point that streams the existing job log entries on connect and then sends the rest as soon as they are generated by the job. So I agree with Thomas that it may be best to handle the two cases (finished and running job) differently.

Thanks,  
Marius

---

<div class="post-metadata">

**Author:** ![MichaelHamann](https://forum.xwiki.org/user_avatar/forum.xwiki.org/michaelhamann/32/3813_2.png) [@MichaelHamann](https://forum.xwiki.org/u/MichaelHamann)\
**Post date:** [December 2, 2026, 3:06pm UTC](https://forum.xwiki.org/t/displaying-huge-job-logs-without-running-out-of-memory/19156/6 "2026-12-02T15:06:23Z")

</div>

> [@lucaa](#):
>
> I believe that it makes a LOT of sense to have a rest service that can provide a representation of the logs of a job, in html ( at least).
> 
> There is [https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HJobresources](https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HJobresources) that can display a log, but only as XML. An option or similar rest service that would provide the logs of the job in the html format expected by the extension manager would largely do the job, no? This way, the rendering of the job status is not made from a wiki page script, using wiki macros (it’s not bringing anything).
> 
> This service could also provide the serialization of a job log as plain text, which would be a great amazing addition to its current XML job log representation, allowing users to see it and search in it, or feed it (live!) to some analysis tools.
> 
> Is there any reason this was not in the proposed solutions?

I think it is a bit orthogonal to the proposed solutions: What I’ve proposed in option 2 is mostly about the display and the user experience, not so much how the data is fetched after the initial load. Basically all parts of option 2 require some API to load job log entries - it could be defined in a template (the most straightforward way, as all the code for displaying job log entries is in Velocity), a resource reference handler or a REST API. All of these options can stream the log entries to the client without storing them all in memory. My initial idea was to stay close to the original solution for backwards compatibility but to be honest I haven’t checked the code much myself yet to understand how much we could change without losing compatibility.

Almost independent of that there is also the point to re-implement job log entry rendering in Java (to turn `EntityReference` parameters into links etc.) - a Java renderer could still be called from Velocity, and the Velocity implementation could be called from Java.

> [@mflorea](#):
>
> I wouldn’t generate the HTML in the REST resource. I’d return JSON or plain text instead, and let the client-side handle the display. REST resource works for a finished job. For a running job I’d look into using a WebSocket end-point that streams the existing job log entries on connect and then sends the rest as soon as they are generated by the job. So I agree with Thomas that it may be best to handle the two cases (finished and running job) differently.

Thank you for the input. Note that plain text won’t be enough to render, e.g., links to pages that are mentioned in log parameters. The `WebSocket` idea sounds interesting, but might add quite a lot of complexity for a bug fix that is supposed to fix memory issues.
