{"record":{"id":"831fc8cc6b57ba85","repo":"Netflix/Hystrix","slug":"could-not-initialize-intrinsics","errorCode":null,"errorMessage":"Could not initialize intrinsics","messagePattern":"Could not initialize intrinsics","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"hystrix-core/src/main/java/com/netflix/hystrix/util/Striped64.java","lineNumber":354,"sourceCode":"     *\n     * @return a sun.misc.Unsafe\n     */\n    private static sun.misc.Unsafe getUnsafe() {\n        try {\n            return sun.misc.Unsafe.getUnsafe();\n        } catch (SecurityException se) {\n            try {\n                return java.security.AccessController.doPrivileged\n                    (new java.security\n                     .PrivilegedExceptionAction<sun.misc.Unsafe>() {\n                        public sun.misc.Unsafe run() throws Exception {\n                            java.lang.reflect.Field f = sun.misc\n                                .Unsafe.class.getDeclaredField(\"theUnsafe\");\n                            f.setAccessible(true);\n                            return (sun.misc.Unsafe) f.get(null);\n                        }});\n            } catch (java.security.PrivilegedActionException e) {\n                throw new RuntimeException(\"Could not initialize intrinsics\",\n                                           e.getCause());\n            }\n        }\n    }\n\n}","sourceCodeStart":336,"sourceCodeEnd":360,"githubUrl":"https://github.com/Netflix/Hystrix/blob/5ce3bc58c38e7ca60ef2fe0e516e390e294ad941/hystrix-core/src/main/java/com/netflix/hystrix/util/Striped64.java#L336-L360","documentation":"Striped64 (Hystrix's port of the JDK's striped counters used by HystrixRollingNumber) needs sun.misc.Unsafe for atomic CAS on striped cells. It first tries theUnsafe directly; under a SecurityManager it retries inside AccessController.doPrivileged, and if that privileged action also fails (PrivilegedActionException), this RuntimeException is thrown - the JVM cannot provide the intrinsics Hystrix requires.","triggerScenarios":"A SecurityManager policy denies reflective access to sun.misc.Unsafe's theUnsafe field (setAccessible(true) fails even when privileged); running Hystrix on JVMs where sun.misc.Unsafe is hidden or removed; very restrictive container/security policies.","commonSituations":"App servers or Java policy files that forbid accessing sun.misc.* internals; future JDKs (post-unsafe removal) breaking the reflective lookup; embedded/security-hardened runtimes.","solutions":["Grant reflective access: ensure the security policy does not block sun.misc.Unsafe.theUnsafe (suppressAccessChecks / reflective access permission) for the Hystrix classes.","Run on a Java version where sun.misc.Unsafe is still exposed (Java 8 is the primary target of this Hystrix line).","As a last resort, avoid the SecurityManager path that triggers doPrivileged by permitting direct field access, or move off Hystrix's internal counters (upgrade to Hystrix 1.5.4+ / resilience4j where this was addressed)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run Hystrix 1.x on Java 7/8 where sun.misc.Unsafe is reliably available.","Grant reflective access to sun.misc.Unsafe.theUnsafe in SecurityManager policies that apply to Hystrix.","In hardened/embedded JVMs, validate Unsafe availability at startup before creating command metrics."],"tags":["hystrix","jvm-internals","security-manager","unsafe"],"backgroundTag":null,"analyzedSha":"5ce3bc58c38e7ca60ef2fe0e516e390e294ad941","analyzedAt":"2026-08-14T10:55:35.600Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}