HystrixRuntimeException : timed out - java

I am getting this error:
com.netflix.hystrix.exception.HystrixRuntimeException:
getCatchmentsByAreaType timed-out and fallback failed.
When I try calling the same method though API it works. I don't know why!
I have set following properties in ZuulApplication:
hystrix.command.default.execution.timeout.enabled=false
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=2000000
hystrix.threadpool.default.coreSize=100
hystrix.threadpool.default.maxQueueSize=100
hystrix.threadpool.default.queueSizeRejectionThreshold=100
ribbon.IsSecured=true
ribbon.ConnectTimeout=2000000
ribbon.ReadTimeout=2000000
ribbon.maxAutoRetries=3

Related

Jersey, An I/O error has occurred while writing a response message

I use SpringBoot and Jersey into my project and I often tackle the following error :
[ERROR - ServerRuntime$Responder - 2018-02-13 13:16:45,983] An I/O error has occurred while writing a response message entity to the container output stream.
org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:92)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
It results with a 503 status response to my client.
Could you explain me why this error occured ?
Thanks
This kind of error usually happens servlet is writing data back on the stream and connection closed from client side.
It is like server in sending some data may be file, string, bytes etc.. but on client side like a browser has closed the connection, like you close the browser tab.
It cased early End of file exception on the server.
I have had this exception when I accidentally passed a null Response at the end of a call. You can verify this in the'caused by' section following the first exception:
Caused by: org.eclipse.jetty.io.EofException: null

Hystrix command fails with "timed-out and no fallback available"

I've noticed that some of the commands in my application fail with
Caused by: ! com.netflix.hystrix.exception.HystrixRuntimeException: GetAPICommand timed-out and no fallback available.
out: ! at com.netflix.hystrix.HystrixCommand.getFallbackOrThrowException(HystrixCommand.java:1631)
out: ! at com.netflix.hystrix.HystrixCommand.access$2000(HystrixCommand.java:97)
out: ! at com.netflix.hystrix.HystrixCommand$TimeoutObservable$1$1.tick(HystrixCommand.java:1025)
out: ! at com.netflix.hystrix.HystrixCommand$1.performBlockingGetWithTimeout(HystrixCommand.java:621)
out: ! at com.netflix.hystrix.HystrixCommand$1.get(HystrixCommand.java:516)
out: ! at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:425)
out: Caused by: ! java.util.concurrent.TimeoutException: null
out: !... 11 common frames omitted
This is my Hystrix configuration override:
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=210000
hystrix.threadpool.default.coreSize=50
hystrix.threadpool.default.maxQueueSize=100
hystrix.threadpool.default.queueSizeRejectionThreshold=50
What kind of timeout is this? Is it a read/connection timeout to the external application? How do I go about debugging this?
This is a Hystrix Command Timeout, this timeout is enabled by default per each command, you define the value using the property:
execution.isolation.thread.timeoutInMilliseconds:
This property sets the time in milliseconds after which the caller will
observe a timeout and walk away from the command execution. Hystrix marks > the HystrixCommand as a TIMEOUT, and performs fallback logic.
So you can increase your timeout value or disable the default time out (if apply in your case) for your command using the property:
#HystrixProperty(name = "hystrix.command.default.execution.timeout.enabled", value = "false")
You can find more information here: https://github.com/Netflix/Hystrix/wiki/Configuration#CommandExecution
It might be you are in debug or your connection too slow, default thread execution timeout is only 1 second, so you could get this message easily if you put a break-point in your command let's say
Although this is not your case but might help somebody else
After adding the following dependency
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-javanica</artifactId>
<version>1.5.18</version>
</dependency>
I would be able to resolve the timeout issue.
What you need to do is to set the hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=210000 property in the application.properties or bootstrap.properties
This works for me hopefully would work.
Looking at the stacktrace this is an exception thrown by Hystrix after the 210 seconds you defined above.
As TimeoutException is a checked exception that needs to be declared on each method that could throw this exception. You would see this declared in the run() method of your code.
You can debug this like any other program, but be aware that the run() method runs in a thread separate from the caller. After 210 seconds the caller will just continue despite your debugging session.
You should increase ur rest client httpclient readTimeout property

Java Casting Error Using CFPOP

My CF9 application running on a windows server pops mail. When I attempt to retrieve the entire body of the message, I sometimes get the following error...
Error:
An exception occurred while retrieving mail.
The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart.
Location:
Line 335 in controllers\Submissions.cfc
Not sure if this is pertinent, but FYI every message will have an image attached and the whole process usually works fine. This problem is intermittent.
My Questions
Any idea what causes this?
Any idea how to catch and resolve this issue?
I suspect I'll need to drop down into java, but not sure where to start.
Code Fragments
<cfscript>
// setup variables array for all cfpop calls
CFPopAttributes = {
server = request.pop.server,
port = request.pop.port,
username = request.pop.username,
password = request.pop.password,
timeout = 300
};
</cfscript>
<cfpop
action="getall"
name="entireEmail"
uid="#uid#"
attachmentpath="#originalsPath#"
attributecollection="#CFPopAttributes#" // Line 335
generateuniquefilenames="true"
/>
NOTE: I added the comment "Line 335" above to communicate exactly where in the code the template is breaking. If I move the attributecollection up or down (before/after other attributes), the error always breaks at the attributecollection line.
Stack Trace
struct [Filtered - 1 of 8 keys hidden]
Detail: An exception occurred while invoking an event handler method from Application.cfc. The method name is: onRequest.
Message: Event handler exception.
RootCause:
[struct]
Detail: The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart.
Message: An exception occurred while retrieving mail.
RootCause:
[struct]
Message: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart
StackTrace: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart
at coldfusion.mail.EmailTable.getAttachmentName(EmailTable.java:819)
at coldfusion.mail.EmailTable.populate(EmailTable.java:283)
at coldfusion.mail.PopImpl.getMails(PopImpl.java:241)
at coldfusion.tagext.net.PopTag$1.run(PopTag.java:433)
at java.security.AccessController.doPrivileged(Native Method)
at coldfusion.tagext.net.PopTag.doStartTag(PopTag.java:429)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2799)
at cfSubmissions2ecfc1952269377$funcGETEMAIL.runFunction(D:\home\wwwroot\controllers\Submissions.cfc:335)

How to resolve Error org.omg.CORBA.BAD_OPERATION exception in java ?

When I invoke method on client side, for distributed reference object, I have this message error:
Exception in thread "main" org.omg.CORBA.BAD_OPERATION:
at org.omg.CORBA.portable.ObjectImpl._get_delegate(ObjectImpl.java:18)
at org.omg.CORBA.portable.ObjectImpl._is_local(ObjectImpl.java:130)
at fr.esiag.commun._ManageDemandStub.createDemand(_ManageDemandStub.java
:28)
at fr.esiag.commun.resource.MyInvocationHandler.invoke(MyInvocationHandl
er.java:29)
at com.sun.proxy.$Proxy0.createDemand(Unknown Source)
at org.TD.TransactionDriver.main(TransactionDriver.java:55)
Can someone tell me what that means ?
BAD_OPERATION expception happens when you try to call a method that dosen't exist in the servant. I think you cast (instead of narrow) the remote object wrong. Maybe it's is relative to your previous question

Problem with remote JMX connection and Notifications

I'm trying to follow one example from the Java API documentation (http://download.oracle.com/javase/1.5.0/docs/api/java/lang/management/MemoryPoolMXBean.html#Notification) related to the UsageThreshold property of the Memory Pool Beans and notifications. My intention is to do something every time the pool overcomes the threshold. This is the sample code:
MemoryPoolMXBean remoteOldGenMemoryPool =
ManagementFactory.newPlatformMXBeanProxy(
jmxServer,
"java.lang:type=MemoryPool,name=PS Old Gen",
MemoryPoolMXBean.class);
class MyListener implements javax.management.NotificationListener {
public void handleNotification(Notification notification, Object handback) {
String notifType = notification.getType();
if (notifType.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED)) {
// Do Something
println "Threshold passed";
}
}
}
// Register MyListener with MemoryMXBean
MemoryMXBean remoteMemory =
ManagementFactory.newPlatformMXBeanProxy(
jmxServer,
ManagementFactory.MEMORY_MXBEAN_NAME,
MemoryMXBean.class);
NotificationEmitter emitter = remoteMemory as NotificationEmitter;
MyListener listener = new MyListener();
emitter.addNotificationListener(listener, null, null);
remoteOldGenMemoryPool.setUsageThreshold 500000000;
When I execute the code and connect to my JVM I can see the following:
Threshold passed
02-Feb-2011 16:30:00 ClientCommunicatorAdmin restart
WARNING: Failed to restart: java.io.IOException: Failed to get a RMI stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
java.net.SocketException: Connection reset]
02-Feb-2011 16:30:03 RMIConnector RMIClientCommunicatorAdmin-doStop
WARNING: Failed to call the method close():java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
java.net.SocketException: Connection reset
02-Feb-2011 16:30:03 ClientCommunicatorAdmin Checker-run
WARNING: Failed to check connection: java.net.SocketException: Connection reset
02-Feb-2011 16:30:03 ClientCommunicatorAdmin Checker-run
WARNING: stopping
For some reason (that I don't understand yet) the code is trying to restart the connection to JVM. Any ideas why this can be happening or how to prevent it? Am I doing somehing wrong?
Thanks
May be you can add a variable to the jmx enviroment, like this:
m.put("jmx.remote.x.client.connection.check.period", 0L);
But, what i have encountered is little different from this.
you can see : http://chainhou.iteye.com/blog/1906688.

Categories

Resources