When attempting to create a connect a socket in a VM running on a vxWorks system I'm getting a rather odd SocketException thrown intermittently. I have not been able to isolate what is causing the exception to occur. Without modifying any external factors successful connection is seemingly random.
Here's the top of the stack trace (from where it enters java.net):
(0000069317) java.net.SocketException: errno2: 68, error: errno = 0x44 for fd: 38
(0000069323) at java.net.PlainSocketImpl.socketConnect(Native Method)
(0000069326) at java.net.PlainSocketImpl.doConnect(Unknown Source)
(0000069329) at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
(0000069366) at java.net.PlainSocketImpl.connect(Unknown Source)
(0000069372) at java.net.Socket.connect(Unknown Source)
The block throwing the exception is as below:
socket = new Socket();
socket.connect(addr, CONNECT_TIMEOUT);
Where addr is a java.net.SocketAddress.
Can anyone provide some insight into what errno 0x44 is?
vxWorks have different errno code numbering than Unix systems.
In vxWorks errno 0x44 (68) is EINPROGRESS.
EINPROGRESS may be set by the following routines:
aio_read(), aio_return(), aio_write()
EINPROGRESS is not usually error. With asynchronous IO, it just indicate that something is started, but it is not yet completed.
Maybe Java translates 68 incorrectly to EADV.
Try to use:
socket.connect(addr);
instead of
socket.connect(addr, CONNECT_TIMEOUT);
Maybe that is enough for avoid AIO and EINPROGRESS.
Related
Facing one strange issue, we are connecting from oracle database to Oracle Essbase Server using JAPI connection (its http connection and no jdbc).
We are able to execute the program till 300 seconds then we get below error: -
invokeMethod localException11111 ::: java.net.SocketTimeoutException: recv() timed out
Resource temporarily unavailable
java.net.SocketTimeoutException: recv() timed out
Resource temporarily unavailable
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:128)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:740)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:683)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1280)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
at com.essbase.api.session.EssOrbPluginHttp.invokeMethod(EssOrbPluginHttp.java:139)
at com.essbase.api.session.EssOrbPluginHttp.invokeMethod(EssOrbPluginHttp.java:109)
at com.essbase.api.session.EssOrbPlugin.essMainCalc(Unknown Source)
at com.essbase.api.datasource.EssCube.calcWithRunTimeSubVars(Unknown Source)
at com.essbase.api.datasource.EssCube.calculate(Unknown Source)
at com.ing.mass.essconnect.Database.calculate(Database.java:314)
at com.ing.mass.essconnect.Database.calculate(Database.java:300)
at com.ing.mass.services.Cubes.calculateNow(Cubes.java:1704)
at com.ing.mass.services.Cubes.calculate(Cubes.java:1510)
invokeMethod finally :::
TESTING .....com.essbase.api.base.EssException: Cannot connect to Provider Server. java.net.SocketTimeoutException: recv() timed out
Resource temporarily unavailable
at com.essbase.api.session.EssOrbPl uginHttp.invokeMethod(EssOrbPluginHttp.java:244)
at com.essbase.api.session.EssOrbPluginHttp.invokeMethod(EssOrbPluginHttp.java:109)
at com.essbase.api.session.EssOrbPlugin.essMainCalc(Unknown Source)
at com.essbase.api.datasource.EssCube.calcWithRunTimeSubVars(Unknown Source)
at com.essbase.api.datasource.EssCube.calculate(Unknown Source)
at com.ing.mass.essconnect.Database.calculate(Database.java:314)
at com.ing.mass.essconnect.Database.calculate(Database.java:300)
at com.ing.mass.services.Cubes.calculateNow(Cubes.java:1704)
at com.ing.mass.services.Cubes.calculate(Cubes.java:1510)
Calculation completed
Calculation completed 111
Cubes calculateNow method finallly
It has been a week scratching our heads to resolve this issue but no luck so far.
Looking forward to hear back with your expert advise.
thanks in advance
Pankaj
this issue is now resolved -
problem was with new java code which required to add a timeout parameter like this
sun.net.client.defaultReadTimeout (set in miliseconds)
I have the following Route definition:
#Override
public void configure() throws Exception {
from(String.format("direct:%s", this.connector))
.id("Route1")
.threads()
.maxPoolSize(10)
.keepAliveTime(3000)
.timeUnit(TimeUnit.MICROSECONDS)
.poolSize(1)
.rejectedPolicy(ThreadPoolRejectedPolicy.Abort)
.log("Calling WS")
.maxQueueSize(1)
.to("http://10.8.4.9:8080/service");
}
And the request snipet above:
InputStream exchange = (InputStream) template
.requestBodyAndHeaders(url, AppUtil.parse(this.body, input), this.headers);
The endpoint is intentionally unavaliable. So, I expected my request wait for 3 seconds and throws some exception as response. Insted, the following behaviour happens:
2018-08-24 16:55:55,048 DEBUG http-nio-8081-exec-2 httpclient.HttpMethodDirector:443 - Connection timed out: connect
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
... more stack...
at java.lang.Thread.run(Unknown Source)
2018-08-24 16:56:38,333 INFO http-nio-8081-exec-2 httpclient.HttpMethodDirector:445 - Retrying request
2018-08-24 16:56:38,417 DEBUG http-nio-8081-exec-2 httpclient.HttpConnection:692 - Open connection to 10.8.4.9:8080/service
Camel retries for 3 times and do not respect the timeout.
I've tried to use:
onException(ConnectException.class)
.maximumRedeliveries(0);
No success...
What I missed?
The .keepAliveTime(3000) is not for HTTP endpoints, its an API for the JVM thread pool in Java itself. You can read about this option in the Java API for thread pools, and there is also a bit of javadoc on that method in Camel DSL.
If you need HTTP connection timeout etc, then you need to set specific option on the http endpoint.
https://github.com/apache/camel/blob/master/components/camel-http4/src/main/docs/http4-component.adoc#using-client-timeout---so_timeout
I have a weak connection with database server and time consuming query which is sometimes fails with exception:
Caused by: java.sql.SQLException: I/O Error: Socket closed
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2481)
at net.sourceforge.jtds.jdbc.TdsCore.getNextRow(TdsCore.java:805)
at net.sourceforge.jtds.jdbc.JtdsResultSet.next(JtdsResultSet.java:611)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.io.DataInputStream.readFully(DataInputStream.java:195)
at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:885)
at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:731)
at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477)
at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:146)
at net.sourceforge.jtds.jdbc.TdsData.readData(TdsData.java:901)
at net.sourceforge.jtds.jdbc.TdsCore.tdsRowToken(TdsCore.java:3175)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2433)
How can connection interruption be handled? currently I have to manually re-run the operation until it executes successfully, maybe it could be done at jdbc driver level
ps socketTimeout property doesn't seem to affect this
Are you sure this is because of query/procedure taking long time ? As Socket closed error normally means something went wrong with the network connection itself, basically something that your driver could not control...
In general, I would suggest to move to a Pool based mechanism, which allows greater control on your persistence layer interaction.
We post messages to queue from our Java application. Recently we moved to new high availabulity Production server with same configuration as our old. But now we see a new issue whenever we are trying to post messages. After posting few messages we are getting:
"MQJMS2005: failed to create MQQueueManager An MQException occurred:
Completion Code 2, Reason 2059 MQJE011: Socket connection attempt
refused"
we did telnet and everything looks fine.The other part is whenever our MQ team tries to enable trace to capture error it works fine.
org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'AXMQMTIMSPRDHA:AXMQMTIMSPRDHA_QM'; nested exception is com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2, Reason 2059
MQJE011: Socket connection attempt refused
at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469)
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:534)
at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:641)
at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:630)
at com.lowes.trf.rerate.jms.MessageSender.sendMessageAsXml(MessageSender.java:54)
at com.lowes.trf.rerate.jms.MessageSender$$FastClassByCGLIB$$b52d5402.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
at com.lowes.trf.rerate.jms.MessageSender$$EnhancerByCGLIB$$c88e6908.sendMessageAsXml(<generated>)
at com.lowes.trf.rerate.service.ReRateService.sendMessageAsXml(ReRateService.java:151)
at com.lowes.trf.rerate.batch.controller.ReRateBatchController.postResponseToEsbAsXml(ReRateBatchController.java:300)
at com.lowes.trf.rerate.batch.controller.ReRateBatchController.execute(ReRateBatchController.java:229)
at com.lowes.trf.rerate.batch.controller.ReRateBatchController$$FastClassByCGLIB$$66bcc521.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:627)
at com.lowes.trf.rerate.batch.controller.ReRateBatchController$$EnhancerByCGLIB$$44b4ed47.execute(<generated>)
at com.lowes.trf.rerate.batch.controller.ReRateBatchController.main(ReRateBatchController.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'AXMQMTIMSPRDHA:AXMQMTIMSPRDHA_QM'
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:586)
at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:2110)
at com.ibm.mq.jms.MQConnection.createQMNonXA(MQConnection.java:1532)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:150)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:185)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:112)
at com.ibm.mq.jms.MQQueueConnectionFactory.createConnection(MQQueueConnectionFactory.java:1050)
at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
at org.springframework.jms.core.JmsTemplate.access$500(JmsTemplate.java:85)
at org.springframework.jms.core.JmsTemplate$JmsTemplateResourceFactory.createConnection(JmsTemplate.java:1031)
at org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:297)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:453)
... 27 more
IBM Documentation says the remote MQ Manager is possibly down, and make sure the channels you are using are fine. Also when you see the connection being refused, run dspmq on the remote machine to ensure the MQManager is really up.
This question already has answers here:
java.net.SocketException: Connection reset
(14 answers)
Closed 7 years ago.
I am getting the following error frequently while retrieving file object from database column. How can I resolve this problem?
May 8, 2009 3:18:14 PM org.apache.catalina.core.StandardHostValve status
WARNING: Exception Processing ErrorPage[errorCode=404, location=/error.jsp]
ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:327)
at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:293)
at org.apache.catalina.connector.Response.flushBuffer(Response.java:537)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:286)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:746)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:433)
at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:304)
at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:991)
at org.apache.coyote.Response.action(Response.java:182)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:322)
... 13 more
Your HTTP client disconnected.
This could have a couple of reasons:
Responding to the request took too long, the client gave up
You responded with something the client did not understand
The end-user actually cancelled the request
A network error occurred
... probably more
You can fairly easily emulate the behavior:
URL url = new URL("http://example.com/path/to/the/file");
int numberOfBytesToRead = 200;
byte[] buffer = new byte[numberOfBytesToRead];
int numberOfBytesRead = url.openStream().read(buffer);
Your log indicates ClientAbortException, which occurs when your HTTP client drops the connection with the server and this happened before server could close the server socket Connection.
I have got this error on open page from Google Cache.
I think, cached page(client) disconnecting on page loading.
You can ignore this error log with try-catch on filter.
Windows Firewall could cause this exception, try to disable it or add a rule for port or even program (java)