kerubistan / kerub

A lightweight IaaS prototype
Apache License 2.0
13 stars 4 forks source link

NPE at joining a host #254

Closed K0zka closed 5 years ago

K0zka commented 5 years ago

Found in an integration test output in kerub-ext-tests HostIT

143 08:08:03.879 [http-apr-8080-exec-2] DEBUG c.g.k.k.security.UserSessionListener - session created: 084599F10BC071864B3019F3605A0A84
   144  08:08:04.449 [Timer-0] DEBUG c.g.k.kerub.planner.PlannerImpl - No plan generated.
   145  08:08:08.594 [Timer-0] DEBUG c.g.k.kerub.planner.PlannerImpl - No plan generated.
   146  08:08:10.427 [Timer-0] DEBUG c.g.k.kerub.planner.PlannerImpl - No plan generated.
   147  08:08:12.480 [Timer-0] DEBUG c.g.k.kerub.planner.PlannerImpl - No plan generated.
   148  08:08:12.506 [http-apr-8080-exec-4] INFO  c.g.k.k.s.e.m.DefaultExceptionMapper - exception 885a1b26-52f3-4823-a61c-9987d6f3dab5
   149  java.lang.NullPointerException: null
   150      at com.github.kerubistan.kerub.host.SshClientServiceImpl.getHostPublicKey(SshClientServiceImpl.kt:92)
   151      at com.github.kerubistan.kerub.host.HostManagerImpl.getHostPublicKey(HostManagerImpl.kt:318)
   152      at com.github.kerubistan.kerub.services.impl.HostServiceImpl.getHostPubkey(HostServiceImpl.kt:65)
   153      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   154      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   155      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   156      at java.lang.reflect.Method.invoke(Method.java:498)
   157      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
   158      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
   159      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
   160      at org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor$1.proceed(AopAllianceAnnotationsAuthorizingMethodInterceptor.java:82)
   161      at org.apache.shiro.authz.aop.AuthorizingMethodInterceptor.invoke(AuthorizingMethodInterceptor.java:39)
   162      at org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor.invoke(AopAllianceAnnotationsAuthorizingMethodInterceptor.java:115)
   163      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
   164      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
   165      at com.sun.proxy.$Proxy82.getHostPubkey(Unknown Source)
   166      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   167      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   168      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   169      at java.lang.reflect.Method.invoke(Method.java:498)
   170      at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
   171      at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
   172      at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
   173      at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
   174      at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
   175      at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
   176      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
   177      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
   178      at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
   179      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
   180      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
   181      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
   182      at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216)
   183      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
   184      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:225)
   185      at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
   186      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
   187      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
   188      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
   189      at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
   190      at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
   191      at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
   192      at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
   193      at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
   194      at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
   195      at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
   196      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347)
   197      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263)
   198      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
   199      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
   200      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
   201      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
   202      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
   203      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
   204      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
   205      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
   206      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
   207      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
   208      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
   209      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
   210      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
   211      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
   212      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
   213      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
   214      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
   215      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   216      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   217      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   218      at java.lang.Thread.run(Thread.java:748)
   219  08:08:12.957 [sshd-SshClient[46bf7820]-nio2-thread-2] WARN  o.a.s.c.k.AcceptAllServerKeyVerifier - Server at /192.168.123.31:22 presented unverified RSA key: SHA256:xBODLTqbpQvchun3owMCLkW+/xHER6gI0PRc8rKoRgA
   220  08:08:14.456 [Timer-0] DEBUG c.g.k.kerub.planner.PlannerImpl - No plan generated.

The reason could be that the code does not check whether or not async operation finished with success, therefore some properties are not initialized.

K0zka commented 5 years ago

Two subsequent test runs produced the same problem.

K0zka commented 5 years ago

no NPE, that is good, but still in all subsequent test executions opensuse just could not get a connection within 1000 ms. While that 1000 ms looks should be enough.