[ https://issues.apache.org/jira/browse/CAMEL-20948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Grzegorz Grzybek resolved CAMEL-20948. -------------------------------------- Resolution: Fixed > camel-util-json doesn't handle streaming correctly > -------------------------------------------------- > > Key: CAMEL-20948 > URL: https://issues.apache.org/jira/browse/CAMEL-20948 > Project: Camel > Issue Type: Improvement > Components: tooling > Affects Versions: 4.7.0 > Reporter: Grzegorz Grzybek > Assignee: Grzegorz Grzybek > Priority: Major > Fix For: 4.7.0 > > > I was checking Jolokia with different JSON libraries: > * https://github.com/jolokia/jolokia/issues/686 > * https://github.com/jolokia/jolokia/issues/252 > and I decided to check [~davsclaus] > [suggestion|https://github.com/jolokia/jolokia/issues/686#issuecomment-2151669446]. > I am using Artemis instance with Hawtio 4, Jolokia 2 and different JSON > libraries. I have 10K queues (which means 20K MBeans for the queues alone) > and I check Jolokia {{list()}} operation. Initially I got: > {noformat} > java.lang.OutOfMemoryError: Java heap space > at java.base/java.util.Arrays.copyOf(Arrays.java:3537) ~[?:?] > at > java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:228) > ~[?:?] > at > java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:802) > ~[?:?] > at java.base/java.lang.StringBuffer.append(StringBuffer.java:425) ~[?:?] > at java.base/java.io.StringWriter.write(StringWriter.java:77) ~[?:?] > at org.apache.camel.util.json.JsonObject.toJson(JsonObject.java:768) > ~[?:?] > at org.apache.camel.util.json.JsonObject.toJson(JsonObject.java:747) > ~[?:?] > at org.apache.camel.util.json.Jsoner.serialize(Jsoner.java:946) ~[?:?] > at org.apache.camel.util.json.Jsoner.serialize(Jsoner.java:924) ~[?:?] > at org.apache.camel.util.json.JsonObject.toJson(JsonObject.java:773) > ~[?:?] > at > org.jolokia.server.core.util.IoUtil.streamResponseAndClose(IoUtil.java:33) > ~[?:?] > at > org.jolokia.server.core.http.AgentServlet.sendStreamingResponse(AgentServlet.java:575) > ~[?:?] > at > org.jolokia.server.core.http.AgentServlet.sendResponse(AgentServlet.java:558) > ~[?:?] > at > org.jolokia.server.core.http.AgentServlet.handle(AgentServlet.java:359) ~[?:?] > at > org.jolokia.server.core.http.AgentServlet.doPost(AgentServlet.java:298) ~[?:?] > at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:520) > ~[jakarta.servlet-api-5.0.0.jar:5.0.0] > at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587) > ~[jakarta.servlet-api-5.0.0.jar:5.0.0] > at > org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1419) > ~[jetty-servlet-11.0.18.jar:11.0.18] > ... > {noformat} > but I quickly realized there's a problem about String / Writer handling in > camel-util-json. PR pending. -- This message was sent by Atlassian Jira (v8.20.10#820010)