MicronautStreamHandler closes MongoClient after processing request which is undesirable #1177
mayurtanna
started this conversation in
General
Replies: 1 comment 5 replies
-
@sdelamo did you get a chance to look at this ? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @sdelamo
Like I mentioned in the issue #1077, when I use MicronautRequestStreamHandler, it seems to be destroying the MongoClient (so ultimately connectionpool) once processing the request and hence we get an exception like below for subsequent request.
So, what I believe is it might be due to StreamFunctionExecutor class's execute method which is getting called internally when we use MicronautRequestStreamHandler. In that method it is closing the applicationContext in finally clause which seem to be destroying MongoClient internally.
I would like to understand, is it desirable to close the applicationContext post handling the request ? Because in case of MicronautRequestHandler I didn't find like we are closing applicationContext post handling of the request. Also, what should I do to keep the connection open ?
Can you provide your thoughts here ?
----------------Exception---------------
Connection pool shut down: java.lang.IllegalStateException
java.lang.IllegalStateException: Connection pool shut down
at org.apache.http.util.Asserts.check(Asserts.java:34)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.requestConnection(PoolingHttpClientConnectionManager.java:269)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at software.amazon.awssdk.http.apache.internal.conn.ClientConnectionManagerFactory$Handler.invoke(ClientConnectionManagerFactory.java:8
Beta Was this translation helpful? Give feedback.
All reactions