[
https://issues.apache.org/jira/browse/SLING-11458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17567402#comment-17567402
]
Andreas Schaefer commented on SLING-11458:
------------------------------------------
I encountered that issue in AEM when using the AEM GraphiQL UI:
15.07.2022 13:36:29.907 *ERROR* [127.0.0.1 [1657917208499] POST
/content/cq:graphql/as-conf-1/endpoint.json HTTP/1.1]
org.apache.sling.engine.impl.SlingRequestProcessorImpl Writer has already been
closed.
org.apache.sling.engine.impl.SlingHttpServletResponseImpl$WriterAlreadyClosedException:
null
at
org.apache.sling.engine.impl.SlingHttpServletResponseImpl$1.checkClosed(SlingHttpServletResponseImpl.java:191)
[org.apache.sling.engine:2.9.0]
at
org.apache.sling.engine.impl.SlingHttpServletResponseImpl$1.flush(SlingHttpServletResponseImpl.java:228)
[org.apache.sling.engine:2.9.0]
at
org.apache.sling.rewriter.impl.RewriterResponse.flushBuffer(RewriterResponse.java:126)
[org.apache.sling.rewriter:1.3.2]
at
org.apache.sling.engine.impl.request.SlingRequestDispatcher.forward(SlingRequestDispatcher.java:151)
[org.apache.sling.engine:2.9.0]
at
com.day.cq.wcm.core.impl.WCMComponentFilter$ForwardRequestDispatcher.forward(WCMComponentFilter.java:503)
[com.day.cq.wcm.cq-wcm-core:5.14.46]
at
com.adobe.aem.graphql.sites.adapters.sling.SlingGraphQLForwardingServlet.forwardRequest(SlingGraphQLForwardingServlet.java:80)
[com.adobe.aem.graphql.sling-adapter:0.1.42]
at
com.adobe.aem.graphql.sites.adapters.sling.SlingGraphQLForwardingServlet.doPost(SlingGraphQLForwardingServlet.java:67)
[com.adobe.aem.graphql.sling-adapter:0.1.42]
It does not affect the output but it is pretty noisy.
> Regress - "Writer has already been closed" exception in GraphQLServlet
> ----------------------------------------------------------------------
>
> Key: SLING-11458
> URL: https://issues.apache.org/jira/browse/SLING-11458
> Project: Sling
> Issue Type: Bug
> Components: GraphQL
> Affects Versions: GraphQL Core 0.0.4
> Reporter: Evgeny Tugarev
> Assignee: Andreas Schaefer
> Priority: Major
> Fix For: GraphQL Core 0.0.6
>
>
> The GraphQLServlet shouldn't call {{response.getWriter().flush()}} as the
> {{JsonWriter}} used by the {{JsonSerializer}} implements {{Closeable}} and as
> such [closes the
> Writer|https://github.com/jdereg/json-io/blob/cf849f15460decf10a8a320390de11965bb5996b/src/main/java/com/cedarsoftware/util/io/JsonWriter.java#L2413].
> This causes a "Writer has already been closed" Exception when {{flush()}} is
> called.
> This was fixed in commit d27f4bb7 but then this commit: 11c7e389 did undo the
> fix as now the JsonWriter is closed when existing the try-catch block.
> I will undo it and prevent the premature closure as this is causing issues
> like when the call to this servlet is made through a dispatcher.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)