brooklyncentral / clocker

Apache Brooklyn cloud native infrastructure blueprints
Apache License 2.0
428 stars 66 forks source link

NPE when adding an invalid MicroserviceDockerfile app, subsequently cannot access application page on console #278

Closed johnmccabe closed 8 years ago

johnmccabe commented 8 years ago

Stumbled upon this by accident, I added a MicroserviceDockerfile app via the app wizard without supplying any configuration and was then unable to access the Application page to stop it, invoking the stop effector directly also failed.

services: [{ type: brooklyn.clocker.example.MicroserviceDockerfile }]

Info logs:

2016-04-14 21:17:30,063 INFO  Launched from YAML: services: [{ type: brooklyn.clocker.example.MicroserviceDockerfile }] -> MicroserviceDockerfileImpl{id=bUOA00to} (Task[start]@wQFopSfT)
2016-04-14 21:17:30,065 INFO  Starting Docker infrastructure id wM6jO9pl
2016-04-14 21:17:30,452 WARN  Service is not up when setting running on DockerInfrastructureImpl{id=wM6jO9pl}; delayed 208ms but Sensor: service.isUp (java.lang.Boolean) did not recover from false; not-up-indicators={service.state=Application starting}
2016-04-14 21:17:30,452 WARN  Setting DockerInfrastructureImpl{id=wM6jO9pl} on-fire due to problems when expected running, up=false, not-up-indicators: {service.state=Application starting}
2016-04-14 21:17:30,452 WARN  Setting DockerInfrastructureImpl{id=wM6jO9pl} on-fire due to problems when expected running, up=false, not-up-indicators: {service.state=Application starting}
2016-04-14 21:17:30,454 WARN  Error invoking start at DockerInfrastructureImpl{id=wM6jO9pl}: NoSuchElementException
2016-04-14 21:17:30,664 WARN  Service is not up when setting running on MicroserviceDockerfileImpl{id=bUOA00to}; delayed 208ms but Sensor: service.isUp (java.lang.Boolean) did not recover from false; not-up-indicators={service.state=Application starting, service-lifecycle-indicators-from-children-and-members=DockerInfrastructureImpl{id=wM6jO9pl} is not up}
2016-04-14 21:17:30,664 WARN  Setting MicroserviceDockerfileImpl{id=bUOA00to} on-fire due to problems when expected running, up=false, problems: {service-lifecycle-indicators-from-children-and-members=Required entity not healthy: DockerInfrastructureImpl{id=wM6jO9pl}}
2016-04-14 21:17:30,665 WARN  Setting MicroserviceDockerfileImpl{id=bUOA00to} on-fire due to problems when expected running, up=false, problems: {service-lifecycle-indicators-from-children-and-members=Required entity not healthy: DockerInfrastructureImpl{id=wM6jO9pl}}
2016-04-14 21:17:30,665 WARN  Error invoking start at MicroserviceDockerfileImpl{id=bUOA00to}: Error invoking start at DockerInfrastructureImpl{id=wM6jO9pl}: NoSuchElementException
2016-04-14 21:17:31,445 WARN  REST call generated exception type class java.lang.NullPointerException unrecognized in class org.apache.brooklyn.rest.util.DefaultExceptionMapper (subsequent occurrences will be logged debug only): java.lang.NullPointerException
java.lang.NullPointerException: null
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:213) ~[guava-16.0.1.jar:na]

Seeing another NPE when accessing applications page:

2016-04-14 21:17:31,443 DEBUG o.a.b.r.u.DefaultExceptionMapper [brooklyn-jetty-server-8081-qtp874189736-35]: REST request running as null threw: org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: NullPointerException
2016-04-14 21:17:31,445 WARN  o.a.b.r.u.DefaultExceptionMapper [brooklyn-jetty-server-8081-qtp874189736-35]: REST call generated exception type class java.lang.NullPointerException unrecognized in class org.apache.brooklyn.rest.util.DefaultExceptionMapper (subsequent occurrences will be logged debug only): java.lang.NullPointerException
java.lang.NullPointerException: null
        at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:213) ~[guava-16.0.1.jar:na]
        at com.google.common.base.Objects.firstNonNull(Objects.java:188) ~[guava-16.0.1.jar:na]
        at brooklyn.entity.container.docker.application.VanillaDockerApplicationImpl.getDisplayName(VanillaDockerApplicationImpl.java:47) ~[brooklyn-clocker-docker-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_72]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_72]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_72]
        at org.apache.brooklyn.core.objs.proxy.EntityProxyImpl.invoke(EntityProxyImpl.java:188) ~[brooklyn-core-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
        at com.sun.proxy.$Proxy58.getDisplayName(Unknown Source) ~[na:na]
        at org.apache.brooklyn.rest.resources.ApplicationResource.fromEntity(ApplicationResource.java:146) ~[brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
        at org.apache.brooklyn.rest.resources.ApplicationResource.fromEntity(ApplicationResource.java:120) ~[brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
        at org.apache.brooklyn.rest.resources.ApplicationResource.fetch(ApplicationResource.java:182) ~[brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_72]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_72]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_72]
        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) ~[cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200) [cxf-rt-frontend-jaxrs-3.1.4.jar:3.1.4]
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99) [cxf-rt-frontend-jaxrs-3.1.4.jar:3.1.4]
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:217) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [javax.servlet-api-3.1.0.jar:3.1.0]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.apache.brooklyn.rest.filter.LoggingFilter.doFilter(LoggingFilter.java:91) [brooklyn-rest-server-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.apache.brooklyn.rest.filter.RequestTaggingFilter.doFilter(RequestTaggingFilter.java:51) [brooklyn-rest-server-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553) [jetty-security-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.Server.handle(Server.java:499) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [jetty-io-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [jetty-util-9.2.13.v20150730.jar:9.2.13.v20150730]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [jetty-util-9.2.13.v20150730.jar:9.2.13.v20150730]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72]
2016-04-14 21:17:38,529 DEBUG o.a.b.r.util.WebResourceUtils [brooklyn-jetty-server-8081-qtp874189736-35]: responding 404 Not Found (Cannot find task 'lD4c6jBD')
grkvlt commented 8 years ago

Probably fixable by modifying VanillaDockerApplicationImpl#getDisplayName() to avoid nulls. Is this repeatable @johnmccabe

johnmccabe commented 8 years ago

@grkvlt will retest and get back to you

grkvlt commented 8 years ago

Have pushed a fix to master for this now.