{"action":"created","issue":{"url":"https://api.github.com/repos/apache/incubator-skywalking/issues/1238","repository_url":"https://api.github.com/repos/apache/incubator-skywalking","labels_url":"https://api.github.com/repos/apache/incubator-skywalking/issues/1238/labels{/name}","comments_url":"https://api.github.com/repos/apache/incubator-skywalking/issues/1238/comments","events_url":"https://api.github.com/repos/apache/incubator-skywalking/issues/1238/events","html_url":"https://github.com/apache/incubator-skywalking/issues/1238","id":323956511,"number":1238,"title":"NPE when use hystrix in spring ","user":{"login":"candyleer","id":11530760,"avatar_url":"https://avatars1.githubusercontent.com/u/11530760?v=4","gravatar_id":"","url":"https://api.github.com/users/candyleer","html_url":"https://github.com/candyleer","followers_url":"https://api.github.com/users/candyleer/followers","following_url":"https://api.github.com/users/candyleer/following{/other_user}","gists_url":"https://api.github.com/users/candyleer/gists{/gist_id}","starred_url":"https://api.github.com/users/candyleer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candyleer/subscriptions","organizations_url":"https://api.github.com/users/candyleer/orgs","repos_url":"https://api.github.com/users/candyleer/repos","events_url":"https://api.github.com/users/candyleer/events{/privacy}","received_events_url":"https://api.github.com/users/candyleer/received_events","type":"User","site_admin":false},"labels":[{"id":830850387,"url":"https://api.github.com/repos/apache/incubator-skywalking/labels/agent","name":"agent","color":"c2e0c6","default":false},{"id":283421094,"url":"https://api.github.com/repos/apache/incubator-skywalking/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"ascrutae","id":12436447,"avatar_url":"https://avatars3.githubusercontent.com/u/12436447?v=4","gravatar_id":"","url":"https://api.github.com/users/ascrutae","html_url":"https://github.com/ascrutae","followers_url":"https://api.github.com/users/ascrutae/followers","following_url":"https://api.github.com/users/ascrutae/following{/other_user}","gists_url":"https://api.github.com/users/ascrutae/gists{/gist_id}","starred_url":"https://api.github.com/users/ascrutae/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ascrutae/subscriptions","organizations_url":"https://api.github.com/users/ascrutae/orgs","repos_url":"https://api.github.com/users/ascrutae/repos","events_url":"https://api.github.com/users/ascrutae/events{/privacy}","received_events_url":"https://api.github.com/users/ascrutae/received_events","type":"User","site_admin":false},"assignees":[{"login":"ascrutae","id":12436447,"avatar_url":"https://avatars3.githubusercontent.com/u/12436447?v=4","gravatar_id":"","url":"https://api.github.com/users/ascrutae","html_url":"https://github.com/ascrutae","followers_url":"https://api.github.com/users/ascrutae/followers","following_url":"https://api.github.com/users/ascrutae/following{/other_user}","gists_url":"https://api.github.com/users/ascrutae/gists{/gist_id}","starred_url":"https://api.github.com/users/ascrutae/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ascrutae/subscriptions","organizations_url":"https://api.github.com/users/ascrutae/orgs","repos_url":"https://api.github.com/users/ascrutae/repos","events_url":"https://api.github.com/users/ascrutae/events{/privacy}","received_events_url":"https://api.github.com/users/ascrutae/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/apache/incubator-skywalking/milestones/28","html_url":"https://github.com/apache/incubator-skywalking/milestone/28","labels_url":"https://api.github.com/repos/apache/incubator-skywalking/milestones/28/labels","id":3306008,"number":28,"title":"5.0.0-beta2","description":"","creator":{"login":"wu-sheng","id":5441976,"avatar_url":"https://avatars2.githubusercontent.com/u/5441976?v=4","gravatar_id":"","url":"https://api.github.com/users/wu-sheng","html_url":"https://github.com/wu-sheng","followers_url":"https://api.github.com/users/wu-sheng/followers","following_url":"https://api.github.com/users/wu-sheng/following{/other_user}","gists_url":"https://api.github.com/users/wu-sheng/gists{/gist_id}","starred_url":"https://api.github.com/users/wu-sheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wu-sheng/subscriptions","organizations_url":"https://api.github.com/users/wu-sheng/orgs","repos_url":"https://api.github.com/users/wu-sheng/repos","events_url":"https://api.github.com/users/wu-sheng/events{/privacy}","received_events_url":"https://api.github.com/users/wu-sheng/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":8,"state":"open","created_at":"2018-04-28T12:13:36Z","updated_at":"2018-05-17T12:45:01Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2018-05-17T10:07:27Z","updated_at":"2018-05-17T12:47:14Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Please answer these questions before submitting your issue.\r\n\r\n- Why do you submit this issue?\r\n- [ ] Question or discussion\r\n- [x] Bug\r\n- [ ] Requirement\r\n- [ ] Feature or performance improvement\r\n\r\n___\r\n### Question\r\n- What do you want to know?\r\n\r\n___\r\n### Bug\r\n- Which version of SkyWalking, OS and JRE?\r\n 5.0.0-beta\r\n- Which company or project?\r\n\r\n- What happen?\r\nIf possible, provide a way for reproducing the error. e.g. demo application, component version.\r\n\r\n```\r\nERROR 2018-05-17 17:57:15 InstMethodsInter :  class[class com.example.test.TestApplication$$EnhancerBySpringCGLIB$$e3c93b0] before method[getUser] intercept failure\r\njava.lang.NullPointerException\r\n\tat org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor.AbstractMethodInterceptor.beforeMethod(AbstractMethodInterceptor.java:57)\r\n\tat org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:82)\r\n\tat com.example.test.TestApplication.getUser(TestApplication.java)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.execute(MethodExecutionAction.java:116)\r\n\tat com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.executeWithArgs(MethodExecutionAction.java:93)\r\n\tat com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.execute(MethodExecutionAction.java:78)\r\n\tat com.netflix.hystrix.contrib.javanica.command.GenericCommand$1.execute(GenericCommand.java:48)\r\n\tat com.netflix.hystrix.contrib.javanica.command.AbstractHystrixCommand.process(AbstractHystrixCommand.java:145)\r\n\tat com.netflix.hystrix.contrib.javanica.command.GenericCommand.run$original$CdXtZRnv(GenericCommand.java:45)\r\n\tat com.netflix.hystrix.contrib.javanica.command.GenericCommand.run$original$CdXtZRnv$accessor$q5odGkGX(GenericCommand.java)\r\n\tat com.netflix.hystrix.contrib.javanica.command.GenericCommand$auxiliary$BVptRI6S.call(Unknown Source)\r\n\tat org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:93)\r\n\tat com.netflix.hystrix.contrib.javanica.command.GenericCommand.run(GenericCommand.java)\r\n\tat com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)\r\n\tat com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)\r\n\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)\r\n\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.Observable.unsafeSubscribe(Observable.java:10151)\r\n\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)\r\n\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)\r\n\tat rx.Observable.unsafeSubscribe(Observable.java:10151)\r\n\tat rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)\r\n\tat rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.Observable.unsafeSubscribe(Observable.java:10151)\r\n\tat rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)\r\n\tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)\r\n\tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)\r\n\tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)\r\n\tat rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)\r\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\r\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\r\n\tat java.lang.Thread.run(Thread.java:748)\r\n\r\nDEBUG 2018-05-17 17:57:15 AppAndServiceRegisterClient :  AppAndServiceRegisterClient running, status:CONNECTED.\r\nERROR 2018-05-17 17:57:17 InstMethodsInter :  class[class com.example.test.TestApplication$$EnhancerBySpringCGLIB$$e3c93b0] after method[getUser] intercept failure\r\njava.lang.NullPointerException\r\n\tat org.apache.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache.getHttpServletResponse(EnhanceRequireObjectCache.java:36)\r\n\tat org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor.AbstractMethodInterceptor.afterMethod(AbstractMethodInterceptor.java:77)\r\n\tat org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:105)\r\n\tat com.example.test.TestApplication.getUser(TestApplication.java)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.execute(MethodExecutionAction.java:116)\r\n\tat com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.executeWithArgs(MethodExecutionAction.java:93)\r\n\tat com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.execute(MethodExecutionAction.java:78)\r\n\tat com.netflix.hystrix.contrib.javanica.command.GenericCommand$1.execute(GenericCommand.java:48)\r\n\tat com.netflix.hystrix.contrib.javanica.command.AbstractHystrixCommand.process(AbstractHystrixCommand.java:145)\r\n\tat com.netflix.hystrix.contrib.javanica.command.GenericCommand.run$original$CdXtZRnv(GenericCommand.java:45)\r\n\tat com.netflix.hystrix.contrib.javanica.command.GenericCommand.run$original$CdXtZRnv$accessor$q5odGkGX(GenericCommand.java)\r\n\tat com.netflix.hystrix.contrib.javanica.command.GenericCommand$auxiliary$BVptRI6S.call(Unknown Source)\r\n\tat org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:93)\r\n\tat com.netflix.hystrix.contrib.javanica.command.GenericCommand.run(GenericCommand.java)\r\n\tat com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)\r\n\tat com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)\r\n\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)\r\n\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.Observable.unsafeSubscribe(Observable.java:10151)\r\n\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)\r\n\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)\r\n\tat rx.Observable.unsafeSubscribe(Observable.java:10151)\r\n\tat rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)\r\n\tat rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.Observable.unsafeSubscribe(Observable.java:10151)\r\n\tat rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)\r\n\tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)\r\n\tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)\r\n\tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)\r\n\tat rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)\r\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\r\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\r\n\tat java.lang.Thread.run(Thread.java:748)\r\n```\r\n\r\ndemo\r\n```\r\n@Autowired\r\n    private RemoteService remoteService;\r\n\r\n    @RequestMapping(value = \"/user\")\r\n    @HystrixCommand(fallbackMethod = \"fallback\", threadPoolProperties = {\r\n            @HystrixProperty(name = \"coreSize\", value = \"30\"), @HystrixProperty(name = \"maxQueueSize\", value = \"100\"),\r\n            @HystrixProperty(name = \"queueSizeRejectionThreshold\", value = \"20\")}, commandProperties = {\r\n            @HystrixProperty(name = \"execution.isolation.thread.timeoutInMilliseconds\", value = \"3000\"),\r\n            @HystrixProperty(name = \"circuitBreaker.requestVolumeThreshold\", value = \"1\")\r\n\r\n    })\r\n    public Object getUser() throws InterruptedException {\r\n        return remoteService.getUser();\r\n    }\r\n```\r\n\r\n```\r\n/**\r\n * @author lican\r\n */\r\n@Configuration\r\npublic class HystrixConfiguration {\r\n    @Bean\r\n    public HystrixCommandAspect hystrixAspect() {\r\n        return new HystrixCommandAspect();\r\n    }\r\n\r\n    @Bean\r\n    public ServletRegistrationBean hystrixMetricsStreamServlet() {\r\n        ServletRegistrationBean registration = new ServletRegistrationBean(new HystrixMetricsStreamServlet());\r\n        registration.addUrlMappings(\"/hystrix.stream\");\r\n        return registration;\r\n    }\r\n\r\n}\r\n```\r\n\r\nthe cause is `(ServletRequestAttributes)RequestContextHolder.getRequestAttributes()` is null \r\nthe hystrix is in another thread which is different from `setRequestAttributes`\r\n___\r\n### Requirement or improvement\r\n- Please describe about your requirements or improvement suggestions."},"comment":{"url":"https://api.github.com/repos/apache/incubator-skywalking/issues/comments/389854128","html_url":"https://github.com/apache/incubator-skywalking/issues/1238#issuecomment-389854128","issue_url":"https://api.github.com/repos/apache/incubator-skywalking/issues/1238","id":389854128,"user":{"login":"candyleer","id":11530760,"avatar_url":"https://avatars1.githubusercontent.com/u/11530760?v=4","gravatar_id":"","url":"https://api.github.com/users/candyleer","html_url":"https://github.com/candyleer","followers_url":"https://api.github.com/users/candyleer/followers","following_url":"https://api.github.com/users/candyleer/following{/other_user}","gists_url":"https://api.github.com/users/candyleer/gists{/gist_id}","starred_url":"https://api.github.com/users/candyleer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candyleer/subscriptions","organizations_url":"https://api.github.com/users/candyleer/orgs","repos_url":"https://api.github.com/users/candyleer/repos","events_url":"https://api.github.com/users/candyleer/events{/privacy}","received_events_url":"https://api.github.com/users/candyleer/received_events","type":"User","site_admin":false},"created_at":"2018-05-17T12:47:14Z","updated_at":"2018-05-17T12:47:14Z","author_association":"CONTRIBUTOR","body":"Wow,I should learn how the grpc do"}}
{"actor":{"display_login":"candyleer"}}