Skip to content
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

util-jvm: Support for HP NonStop Hotspot JVM #272

Closed
pvasterd opened this issue Mar 17, 2020 · 3 comments
Closed

util-jvm: Support for HP NonStop Hotspot JVM #272

pvasterd opened this issue Mar 17, 2020 · 3 comments

Comments

@pvasterd
Copy link
Contributor

Twitter/util does not work on HP Nonstop Hotspot JVM as some native metrics functions are not implemented

This issue is cloned from twitter/finagle#833, but as issue and fix is in twitter/util, moving the issue to twitter/util as well.

Expected behavior

Even if certain native functions are not supported by the underlying JVM - that are not essential for the base functionality- it should continue to initialize (and logging some warnings that certain information may not be available).

Actual behavior

javax.naming.OperationNotSupportedException while Finagle is initializing:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'httpClient' defined in class path resource [com/ing/apisdk/merak/autocon
figure/finagle/client/HttpClientAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstan
tiationException: Failed to instantiate [com.twitter.finagle.Http$Client]: Factory method 'httpClient' threw exception; nested exception is java.lang.ExceptionI
nInitializerError
           at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:591) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:881) ~[spring-context-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
           at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
           at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
           at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
           at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) [spring-boot-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
           at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) [spring-boot-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
           at nl.ing.base24.cards.TransactionsAuthorizer.Application.main(Application.java:11) [classes!/:0.0.1-SNAPSHOT]
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_172]
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_172]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_172]
           at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_172]
           at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [Base24TransactionsAuthorizer-web-spring-boot.jar:0.0.1-SNAPSHOT]
           at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)[Base24TransactionsAuthorizer-web-spring-boot.jar:0.0.1-SNAPSHOT]
           at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)[Base24TransactionsAuthorizer-web-spring-boot.jar:0.0.1-SNAPSHOT]
           at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:593) [Base24TransactionsAuthorizer-web-spring-boot.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.twitter.finagle.Http$Client]: Factory method 'httpClient' threw exception; nested exception is java.lang.ExceptionInInitializerError
           at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:583) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           ... 26 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: null
           at com.twitter.finagle.client.StackClient$.endpointStack(StackClient.scala:91) ~[finagle-core_2.12-19.1.0.jar!/:19.1.0]
           at com.twitter.finagle.client.StackClient$.newStack(StackClient.scala:257) ~[finagle-core_2.12-19.1.0.jar!/:19.1.0]
           at com.twitter.finagle.Http$Client$.<init>(Http.scala:181) ~[finagle-http_2.12-19.1.0.jar!/:19.1.0]
           at com.twitter.finagle.Http$Client$.<clinit>(Http.scala) ~[finagle-http_2.12-19.1.0.jar!/:19.1.0]
           at com.twitter.finagle.Http$.client(Http.scala:453) ~[finagle-http_2.12-19.1.0.jar!/:19.1.0]
[...some lines are left out here...]
           at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:365) ~[spring-context-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           at com.ing.apisdk.merak.autoconfigure.finagle.client.HttpClientAutoConfiguration$$EnhancerBySpringCGLIB$$e625bf16.httpClient(<generated>) ~[merak-spring-boot-autoconfigure_2.12-7.5.0.jar!/:7.5.0]
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_172]
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_172]
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_172]
           at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_172]
           at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.0.13.RELEASE.jar!/:5.0.13.RELEASE]
           ... 27 common frames omitted
Caused by: javax.naming.OperationNotSupportedException: null
           at sun.misc.Perf.attach(Native Method) ~[na:1.8.0_172]
           at sun.misc.Perf.attachImpl(Perf.java:270) ~[na:1.8.0_172]
           at sun.misc.Perf.attach(Perf.java:200) ~[na:1.8.0_172]
           at sun.management.VMManagementImpl.getPerfInstrumentation(VMManagementImpl.java:257) ~[na:1.8.0_172]
           at sun.management.VMManagementImpl.getInternalCounters(VMManagementImpl.java:274) ~[na:1.8.0_172]
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_172]
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_172]
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_172]
           at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_172]
           at com.twitter.jvm.Hotspot.com$twitter$jvm$Hotspot$$counters(Hotspot.scala:54) ~[util-jvm_2.12-19.1.0.jar!/:19.1.0]
           at com.twitter.jvm.Hotspot.metaspaceUsage(Hotspot.scala:172) ~[util-jvm_2.12-19.1.0.jar!/:19.1.0]
           at com.twitter.jvm.JvmStats$.register(JvmStats.scala:106) ~[util-jvm_2.12-19.1.0.jar!/:19.1.0]
           at com.twitter.finagle.Init$.<init>(Init.scala:55) ~[finagle-core_2.12-19.1.0.jar!/:19.1.0]
           at com.twitter.finagle.Init$.<clinit>(Init.scala) ~[finagle-core_2.12-19.1.0.jar!/:19.1.0]
           ... 46 common frames omitted

Steps to reproduce the behavior

I am afraid you need a HP non-stop machine to reproduce this, but if you have this, simply create a Finagle Http.Client.

$ java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) Server VM (build "25.172-b11", mixed mode)

HP NONSTOP info:

         System name    xxxx
  EXPAND node number    022
       Current SYSnn    SYS00
       System number    XXXXX
Software release ID    L19.03.00
pvasterd added a commit to pvasterd/util that referenced this issue Mar 17, 2020
@pvasterd pvasterd changed the title Support for HP NonStop Hotspot JVM util-jvm: Support for HP NonStop Hotspot JVM Mar 17, 2020
@bryce-anderson
Copy link
Contributor

@pvasterd, is this something you'd like to contribute? We don't run that VM so there is no way for us to test it.

@pvasterd
Copy link
Contributor Author

pvasterd commented Apr 15, 2020

Hi @bryce-anderson, I did contribute this in this #273. That PR was not merged, but my commit 0970951 got in and is now part of 20.4.0.

Since my commit got in I closed #273 myself.

Also, this was tested on HP NonStop JVM and works as expected (no metrics, but properly dealing with unsupported operations for the HotSpot JVM).

@bryce-anderson
Copy link
Contributor

Okay, sounds like it's already done. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants