{"action":"created","issue":{"url":"https://api.github.com/repos/Netflix/Hystrix/issues/351","labels_url":"https://api.github.com/repos/Netflix/Hystrix/issues/351/labels{/name}","comments_url":"https://api.github.com/repos/Netflix/Hystrix/issues/351/comments","events_url":"https://api.github.com/repos/Netflix/Hystrix/issues/351/events","html_url":"https://github.com/Netflix/Hystrix/issues/351","id":51298064,"number":351,"title":"Timeout handling fails for non-idempotent strategy","user":{"login":"krutsko","id":3208618,"avatar_url":"https://avatars.githubusercontent.com/u/3208618?v=3","gravatar_id":"","url":"https://api.github.com/users/krutsko","html_url":"https://github.com/krutsko","followers_url":"https://api.github.com/users/krutsko/followers","following_url":"https://api.github.com/users/krutsko/following{/other_user}","gists_url":"https://api.github.com/users/krutsko/gists{/gist_id}","starred_url":"https://api.github.com/users/krutsko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krutsko/subscriptions","organizations_url":"https://api.github.com/users/krutsko/orgs","repos_url":"https://api.github.com/users/krutsko/repos","events_url":"https://api.github.com/users/krutsko/events{/privacy}","received_events_url":"https://api.github.com/users/krutsko/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Netflix/Hystrix/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Netflix/Hystrix/milestones/11","labels_url":"https://api.github.com/repos/Netflix/Hystrix/milestones/11/labels","id":909573,"number":11,"title":"1.4.0-RC7","description":"RC for 1.4.0.  Mostly small new features","creator":{"login":"mattrjacobs","id":205579,"avatar_url":"https://avatars.githubusercontent.com/u/205579?v=3","gravatar_id":"","url":"https://api.github.com/users/mattrjacobs","html_url":"https://github.com/mattrjacobs","followers_url":"https://api.github.com/users/mattrjacobs/followers","following_url":"https://api.github.com/users/mattrjacobs/following{/other_user}","gists_url":"https://api.github.com/users/mattrjacobs/gists{/gist_id}","starred_url":"https://api.github.com/users/mattrjacobs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattrjacobs/subscriptions","organizations_url":"https://api.github.com/users/mattrjacobs/orgs","repos_url":"https://api.github.com/users/mattrjacobs/repos","events_url":"https://api.github.com/users/mattrjacobs/events{/privacy}","received_events_url":"https://api.github.com/users/mattrjacobs/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":16,"state":"open","created_at":"2014-12-19T00:34:15Z","updated_at":"2015-02-10T06:36:40Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2014-12-08T12:43:47Z","updated_at":"2015-02-10T06:36:40Z","closed_at":"2015-02-10T06:36:40Z","body":"Recetly we tried to migrate from Hystrix 1.3.9 to the later one 1.3.16 and faced with issue that our custom Hystrix Strategy is not working properly after Hystrix Command throw a Timeout Exception.\r\n\r\nI did some modification on this https://github.com/Netflix/Hystrix/issues/212#issuecomment-36078515 to show up issue. (In the our real strategy, we use a Guice to propagate http request scope instances `ServletScopes.scopeRequest(actual, seedMap)` which throw IllegalStateException if called twice)\r\n\r\nI'm not sure to consider this a real issue, so reject if needed.\r\n\r\n```\r\npackage com.netflix.hystrix;\r\n\r\nimport com.netflix.hystrix.Hystrix;\r\nimport com.netflix.hystrix.HystrixCommand;\r\nimport com.netflix.hystrix.HystrixCommandGroupKey;\r\nimport com.netflix.hystrix.strategy.HystrixPlugins;\r\nimport com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;\r\nimport com.netflix.hystrix.strategy.concurrency.HystrixRequestContext;\r\nimport rx.functions.Action1;\r\n\r\nimport java.util.concurrent.Callable;\r\n\r\npublic class TestOrig {\r\n\r\n    private static final ThreadLocal<String> requestIdThreadLocal = new ThreadLocal<String>();\r\n\r\n    public static class DummyCommand extends HystrixCommand<Void> {\r\n\r\n        public DummyCommand() {\r\n            super(HystrixCommandGroupKey.Factory.asKey(\"Dummy\"));\r\n        }\r\n\r\n        @Override\r\n        protected Void run() throws Exception {\r\n            System.out.println(\"requestId (run) = \" + requestIdThreadLocal.get());\r\n            Thread.sleep(2000);\r\n            return null;\r\n        }\r\n    }\r\n\r\n    public static void main(String[] args) {\r\n        HystrixPlugins.getInstance().registerConcurrencyStrategy(new HystrixConcurrencyStrategy() {\r\n            @Override\r\n            public <T> Callable<T> wrapCallable(final Callable<T> callable) {\r\n                return new RequestIdCallable<T>(callable);\r\n            }\r\n        });\r\n\r\n        HystrixRequestContext context = HystrixRequestContext.initializeContext();\r\n\r\n        requestIdThreadLocal.set(\"foobar\");\r\n        try {\r\n            new DummyCommand().execute();\r\n        } catch (Exception e) {\r\n            System.out.println(\"initialized = \" + HystrixRequestContext.isCurrentThreadInitialized());\r\n            System.out.println(\"requestId (timeout) = \" + requestIdThreadLocal.get());\r\n            e.getCause().printStackTrace();\r\n        }\r\n\r\n        // works fine using toObservable\r\n//        new DummyCommand().toObservable()\r\n//                .doOnError(new Action1<Throwable>() {\r\n//                    @Override\r\n//                    public void call(Throwable throwable) {\r\n//                        System.out.println(\"initialized = \" + HystrixRequestContext.isCurrentThreadInitialized());\r\n//                        System.out.println(\"requestId (timeout) = \" + requestIdThreadLocal.get());\r\n//                        throwable.getCause().printStackTrace();\r\n//                    }\r\n//                })\r\n//                .materialize()\r\n//                .toBlocking().single();\r\n\r\n\r\n        context.shutdown();\r\n        Hystrix.reset();\r\n    }\r\n\r\n    private static class RequestIdCallable<T> implements Callable<T> {\r\n        private final Callable<T> callable;\r\n        private final String requestId;\r\n\r\n        public RequestIdCallable(Callable<T> callable) {\r\n            this.callable = callable;\r\n            this.requestId = requestIdThreadLocal.get();\r\n        }\r\n\r\n        @Override\r\n        public T call() throws Exception {\r\n            String original = requestIdThreadLocal.get();\r\n            if (original != null) {\r\n                throw new IllegalStateException(\"threadlocal already initialized\");\r\n            }\r\n            requestIdThreadLocal.set(requestId);\r\n            try {\r\n                return callable.call();\r\n            } finally {\r\n                requestIdThreadLocal.set(original);\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nExptected: timeout exception.\r\nActual: IllegalStateException"},"comment":{"url":"https://api.github.com/repos/Netflix/Hystrix/issues/comments/73651713","html_url":"https://github.com/Netflix/Hystrix/issues/351#issuecomment-73651713","issue_url":"https://api.github.com/repos/Netflix/Hystrix/issues/351","id":73651713,"user":{"login":"mattrjacobs","id":205579,"avatar_url":"https://avatars.githubusercontent.com/u/205579?v=3","gravatar_id":"","url":"https://api.github.com/users/mattrjacobs","html_url":"https://github.com/mattrjacobs","followers_url":"https://api.github.com/users/mattrjacobs/followers","following_url":"https://api.github.com/users/mattrjacobs/following{/other_user}","gists_url":"https://api.github.com/users/mattrjacobs/gists{/gist_id}","starred_url":"https://api.github.com/users/mattrjacobs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattrjacobs/subscriptions","organizations_url":"https://api.github.com/users/mattrjacobs/orgs","repos_url":"https://api.github.com/users/mattrjacobs/repos","events_url":"https://api.github.com/users/mattrjacobs/events{/privacy}","received_events_url":"https://api.github.com/users/mattrjacobs/received_events","type":"User","site_admin":false},"created_at":"2015-02-10T06:36:40Z","updated_at":"2015-02-10T06:36:40Z","body":"Added comment in #665 with a pointer back here."}}