Getting I/O exception (java.net.SocketException) caught when processing request - java

I have been using optimizely 'core-api', version:'3.3.0' and 'core-httpclient-impl', version:'3.3.0'
for my java app. I frequently see this exception in my info log
"I/O exception (java.net.SocketException) caught when processing request to {s}->https://cdn.optimizely.com: Connection reset".
This is logged part of optimizely SDK. I'm not able to find why this shows up as the http calls from the sdk are succeeding. If someone can give me some leads that will be great help. Thanks.

It means that the other side or a network component in the line dropped the connection unexpectedly.

Related

MultipartException and IOFileUploadException when requests receives MultipartFile

I'm developing a spring API and I have an endpoint that receives a MultipartFile as parameter but in the production environment I'm receiving the following error in some cases:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.impl.IOFileUploadException: Processing of multipart/form-data request failed. java.io.EOFException
I'm using spring-boot-starter-tomcat:2.4.7 that uses tomcat:9.0.46
I'm having some difficulty to debug this error because it throws before the code starts so it never reaches the logs that I put.
Thank you.
Regards.
If this does not happen all the time and only sometimes, its probably because the upload got interrupted ( browser got closed for example ). Therefore, there is nothing for you to change in the code.
You can get more details if you enable Spring MVC debug logging
application.properties
logging.level.org.springframework.web: DEBUG
Here's additional info about how you can efficiently log these kinds of errors.

ResourceAccessException: I/O error on POST request for .. read timed out ERROR

When I call the rest end point (Rest Template http client) "myservice..com/rest/api/" i get the below error sometime .What can be the cause of this error? And is this client or server error?
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "myservice..com/rest/api/": read timed out;
exception is java.net.SocketTimeoutException: read timed out
Well, the exception is declarative in nature. That exception signals that a timeout has occurred on a socket read or accept, as per Java API describes. In shorter words, there is a network connectivity issue that has nothing to do with your code.
A couple of questions that you may want to figure out first:
Is the service myservice..com/rest/api/ up? Is it visible from you computer/host?
Can you hit it an status endpoint to check if it is alive?
Can you make a different HTTP request to the API GET, DELETE?
What happens if you query the endpoint with cURL or Postman?

javax.jms.JMSException: Could not post command: KeepAliveInfo

Short description of the issue:
I'm using ActiveMQ 5.10.2 (AMQ) in a project where I have Application A sending data over to Application B via amq and saw this exception :
javax.jms.JMSException: Could not post command: KeepAliveInfo
Here's the full stack trace:
ERROR JMSConsumer:148 - Consumer Exception
javax.jms.JMSException: Could not post command: KeepAliveInfo {} due to: java.net.SocketTimeoutException: Read timed out
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:54)
...
Caused by: java.io.IOException: Could not post command: KeepAliveInfo {} due to: java.net.SocketTimeoutException: Read timed out
at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33)
at org.apache.activemq.transport.http.HttpClientTransport.oneway(HttpClientTransport.java:138)
...
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
That exception was seen in App B and due to this exception it could not connect to the AMQ. Restarting the app allowed it to talk to the AMQ again.
Does anyone know how I can reproduce that exception so I can do proper error handling/recovery?
More details about the issue:
As mentioned above, I'm trying to recreate the exception to do proper error handling/recovery. But so far I'm unable to reproduce it.
I've looked online and don't see too much on this specific exception nor on the keepaliveinfo message other than from activemq's own site.
Per its link https://activemq.apache.org/activemq-inactivitymonitor if the useInactivityMonitor parameter is set to true, which is the default value, then the apps connecting to that AMQ on the same topic/queue will have that keepaliveinfo message sent if it doesn't detect any normal traffic. In my environment that parameter is set to true
My thought is, with this value set to true, something happened in my environment (perhaps the AMQ got in a funky state or was low in memory) that it failed to handle a keepaliveinfo message sent from my apps and then that jms exception occurred.
In trying to reproduce that exception I have done the following tests to no avail:
Test 1:
Start App A, App B and the AMQ. After everything is up and running and data is flowing I would then stop the AMQ broker.
I got this exception :
javax.jms.JMSException: Failed to perform GET on: <my amq ip>:443 Reason: Connection refused: connect
Which isn't the exception I noticed before.
Test 2:
I would start App A, App B, and the AMQ, and then after everything is up and running I would then stop App A (which sends data to App B via AMQ).
I did not witness any keepaliveinfo messages getting sent and more importantly I don't see the specific jms exception above.
Test 3:
I started App B and the AMQ. I modified App A to connect to the AMQ but commented out the code that sends data to App B on the queue/topic.
Again I did not witness this message JMSException: could not post command: keepaliveinfo
Test 4
I modified the AMQ broker activemq.xml file to have its <memoryUsage> <storeUsage> and <tempUsage> values to be really low. In a way to simulate that the ActiveMQ is super busy and can't handle more data being sent. More info on those parameters are mentioned here https://activemq.apache.org/producer-flow-control.html
After restarting AMQ and App A and App B, I still didn't witness that exception message.
End of tests
So again, does anyone know what is the setup/conditions on reproducing this issue?
Extra note:
It seems like I can avoid this exception altogether if I set the useInactivityMonitor parameter to false. With that set then no keepaliveinfo messages are sent if no normal traffic occurs over a connection. But I don't want to change it to false.
And here is my pom file defining the amq artifact id's:
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.10.2</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-http</artifactId>
<version>5.10.2</version>
</dependency>

java.rmi.RemoteExeption: CORBA NO_RESPONSE root cause analysis

We have an EJB application deployed on WebSphere 8.5, We are getting the following exception on console,
java.rmi.Exception:CORBA NO_RESPONSE 0x4942fb01 Maybe: nested exception is:
RESPONSE: Request 221370 timed out vmcid: IBM minor code: B01 Completed maybe
I can also see the root cause of exception as below:
caused by: org.omg.CORBA.NO_RESPONSE: Request timed out vmcid: B01 Completed maybe
at com.ibm.rmi.iiop.Connection.getCallStream(Connection.java:2493)
The effect of it is end user is unable to connect to the application.
Upon doing some analysis: I found out that main reason could be the connection pool settings.
So Can someone please help me on following:
possible root causes of above exception
possible way to fix this exception
Request timed out means that the EJB request timed out (default 180 seconds): https://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.multiplatform.doc/ae/uorb_rsetg.html
This may have many causes, but in general, it's best to analyze the performance of the EJB backend service (e.g. garbage collection, long response times due to a database, etc.). Here is a place to start on investigating general WAS performance problems: https://publib.boulder.ibm.com/httpserv/cookbook/Recipes-WAS_Traditional_Recipes-General_WAS_Traditional_Performance_Problem.html
A key item is step 8 which gathers thread dumps and basic OS statistics during the problem. If you are stuck analyzing that data, you may open an IBM support request with that MustGather data.

I/O exception <java.net.SocketException> in Solr startup

When I start up Solr, I get the following error
I/O exception caught when connecting to https://localhost:;
java.security.NoSuchAlgorithmException:
Error construct:sun.security.ssl.SSLContextImpl$DefaultSSLContext
Did anyone ever come across the same issue before?
What is causing this error and how can I fix it?
Try to connect using http://localhost. You are using https and it requires proper certificates and extra configuration. For localhost http is ok but is high recommend that you use https on production.

Categories