-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrectly getting error "Collapser method must have one argument" from CollapserMetaHolderFactory #1458
Comments
I haven't heard any reports of this yet. @dmgcodevil - any idea what this might be? |
Just to add more info, I continued looking at the code of Hystrix and it seems unbelievable what I am seeing in the logs because I can see it uses Java reflection and checks if HystrixCommand is present.
but the fact is I got this error on 2 out of 5 servers running the exact same code. I restarted one of the failed servers and problem went away, still have the other server in "bad" state so I can reproduce the problem with every request but as soon as I restart it, the problem most likely will go away. This is not the first time we see this problem, about 2 months ago I noticed the same thing but restarted and couldn't reproduce. It's really interesting what's going on there. |
Hi, will take a look at all javanica issues on this weekend |
@ppetrosyan it's really weird, agree. It might be anything: JIT optimization that causes that issue, code cached since previous deployment (unlikely), concurrency issue and etc. I wonder if Collapser annotation is present in the method at this point either. Please continue updating the issue with your findings, I'll do the best from my side. |
I'm facing a similar issue with this code (Javanica 1.5.6, Spring Boot 1.4.2): @HystrixCommand(
threadPoolKey = "get-purchase-orders-thread-pool",
ignoreExceptions = {IllegalArgumentException.class, ResourceNotFoundException.class},
commandProperties = {
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "10000")
}, threadPoolProperties = {
@HystrixProperty(name = "maxQueueSize", value = "100"),
@HystrixProperty(name = "queueSizeRejectionThreshold", value = "100")
}
)
public Future<Optional<PurchaseOrder>> getPurchaseOrderByCode(final String code) {
...
} We have several nodes running the application. All worked fine for several days. Today requests bound to the command failed on all nodes with
A restart solved the issue but I couldn't reproduce it. As we don't use
doesn't find any annotation at all so that public MetaHolder create(Object proxy, Method collapserMethod, Object obj, Object[] args, final ProceedingJoinPoint joinPoint) {
HystrixCollapser hystrixCollapser = collapserMethod.getAnnotation(HystrixCollapser.class);
if (collapserMethod.getParameterTypes().length > 1 || collapserMethod.getParameterTypes().length == 0) {
throw new IllegalStateException("Collapser method must have one argument: " + collapserMethod);
}
Method batchCommandMethod = getDeclaredMethod(obj.getClass(), hystrixCollapser.batchMethod(), List.class); But I don't know how this could happen. One additional detail: |
What do you think about adding a sanity check to get more insights: private enum HystrixPointcutType {
COMMAND,
COLLAPSER;
static HystrixPointcutType of(Method method) {
if(method.isAnnotationPresent(HystrixCommand.class)){
return COMMAND;
} else if(method.isAnnotationPresent(HystrixCollapser.class)){
return COLLAPSER;
} else {
throw new IllegalStateException("no valid annotation found for ...");
}
}
} |
@ppetrosyan, @matterche could you please provide a bit more information:
the idea to add an extra info could help us but I want to reproduce the issue |
openjdk:8u91-b14-1-22
It implements an interface but not a generic one
JDK proxy
~ 30 lines
The method is run concurrently |
I gave up trying to reproduce the issue. I tried to analyze JIT compilation log but didn't find anything suspicious, tried different computation modes: parallel and sequential under heavy load, both are working fine. I added a sanity check to get more insights, it should help to find out the root cause in a next time. |
👍 |
Thanks for looking at this. During this time I encountered this problem couple more times but no solid clue was found because it was really rare and random. I changed the code to not use Hystrix until this problem is solved, so I won't have new updates for a while. Here is the info you requested from my side.
Hope the logs you added will help to find this issue. Thanks |
The log statement added above leads me to this discussion: Hope my logs can help to find the root cause. Please let me know if you see any obvious solution:
|
@mattrjacobs @dmgcodevil ... Below is the histrix and system info: Histrix: Java + JVM Info: Does a class with hystrix command implement a generic interface? What kind of proxy do you use in your project, e.g. : How big a command method is : 5, 10 or 100 lines Is a method executed concurrently under heavy load Below is the Histrix annotation we are using on the method:
Any insight will be helpful. Thank you in advance. |
@asamra-blurb thanks for the update, I'll take a look. |
Did you found any solution? I'm having same exception Thanks |
@shaswat09 tomorrow I'll figure it out, be online . |
Below Error I'm getting java.lang.IllegalStateException: '#1458' - no valid annotation found for: Flags: Return Type: Parameters: Exceptions:empty Annotations:empty
My Code: @FeignClient("config-client")
} |
it should not be a method from java Proxy class. Looks like there is a problem with cc: @shaswat09 |
The funny thing is that when I use an interface that contains a method annotated with |
I think that a temporary solution would be switch to CGLIB proxies, instead of JDK: |
today,i have faced this question ,do you solved this.give me some suggestion.below is the trace infomation: Flags: Return Type: Parameters: Exceptions: Annotations:empty my springboot version is 2.1.6 |
I just came across this error, and link in my Spring Boot application. Hopefully this might help someone else that gets directed here later. I was updating a library that was using spring cloud feign (
This was working as they expected (ie. using Hystrix) as they turned on Once a new library was added, that actually used Basically, removing the Using HystrixCommand on other beans, now also works. So from what I learned, if you get this exception in your logs, and you have the HystrixCommand on a Feign Client, then remove it and just use feign-hystrix. |
You can use @HystrixCommand annotation only on @service or @component class bean |
|
Why is this issue closed if there is no fix? |
…o controller (Open)feign already warp api by HystrixInvocationHandler if annotated @FeignClient, annotated @HystrixCommand again throws proxy Proxy's final method exception see Netflix/Hystrix#1458 (comment)
I am having a strange issue. I have a method which is annotated with HystrixCommand
`
@OverRide
@HystrixCommand(fallbackMethod = "getDataFallback",
commandProperties = {
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "60000"),
@HystrixProperty(name="execution.isolation.thread.interruptOnTimeout", value="TRUE"),
@HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "20"),
@HystrixProperty(name = "circuitBreaker.sleepWindowInMilliseconds", value = "10000"),
@HystrixProperty(name = "circuitBreaker.errorThresholdPercentage", value = "50")
},
threadPoolProperties = {
@HystrixProperty(name = "coreSize", value = "10")
})
public List getData(String id, Date date) {
return null;
}
`
it works most of the times, but rarely without changing anything I get the following exception
java.lang.IllegalStateException: Collapser method must have one argument: public java.util.List getData(String,Date)
I checked the code of Hystrix and found that the meta holder factory checks if the HystrixCommand annotation is present then it initializes CommandMetaHolderFactory, otherwise CollapserMetaHolderFactory. In my case, I have the HystrixCommand but it still tries to use CollapserMetaHolderFactory which complains about method not having 1 argument.
This happens rarely and it's possible no one has seen it yet, I was just wondering if there is a recent fix related to this issue. I am using hystrix 1.5.0.
Thanks in advance.
The text was updated successfully, but these errors were encountered: