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

NPE when creating undeploy/redeploy plan for a model with child/parent relationship #115

Closed
lucasmcgrew opened this Issue Jan 18, 2012 · 8 comments

Comments

Projects
None yet
2 participants
@lucasmcgrew

lucasmcgrew commented Jan 18, 2012

I'm not entirely sure how to replicate this issue, but quite often when I have a model with service entries that include a parent attribute referencing another service entry, I will get a NullPointerException from the console webapp when creating a redeploy or undeploy plan. For instance:

java.lang.NullPointerException
at org.linkedin.glu.orchestration.engine.delta.impl.ParentChildDeltaStateBuilder.(ParentChildDeltaStateBuilder.java:51)
at org.linkedin.glu.orchestration.engine.delta.impl.MultiDeltaBuilder.processParentChild(MultiDeltaBuilder.java:166)
at org.linkedin.glu.orchestration.engine.delta.impl.MultiDeltaBuilder.createNewExpectedModel(MultiDeltaBuilder.java:147)
at org.linkedin.glu.orchestration.engine.delta.impl.MultiDeltaBuilder.build(MultiDeltaBuilder.java:113)
at org.linkedin.glu.orchestration.engine.delta.impl.DeltaMgrImpl.computeDeltas(DeltaMgrImpl.java:98)
at org.linkedin.glu.orchestration.engine.planner.PlannerServiceImpl.computeDeploymentPlans(PlannerServiceImpl.groovy:153)
at org.linkedin.glu.orchestration.engine.planner.PlannerServiceImpl.this$2$computeDeploymentPlans(PlannerServiceImpl.groovy)
at org.linkedin.glu.orchestration.engine.planner.PlannerServiceImpl$this$2$computeDeploymentPlans$0.callCurrent(Unknown Source)
at org.linkedin.glu.orchestration.engine.planner.PlannerServiceImpl$this$2$computeDeploymentPlans$0.callCurrent(Unknown Source)
at org.linkedin.glu.orchestration.engine.planner.PlannerServiceImpl.computeDeploymentPlans(PlannerServiceImpl.groovy:130)
at org.linkedin.glu.orchestration.engine.planner.PlannerServiceImpl.this$2$computeDeploymentPlans(PlannerServiceImpl.groovy)
at org.linkedin.glu.orchestration.engine.planner.PlannerServiceImpl$this$2$computeDeploymentPlans.callCurrent(Unknown Source)
at org.linkedin.glu.orchestration.engine.planner.PlannerServiceImpl.computeRedeployPlans(PlannerServiceImpl.groovy:278)
at org.linkedin.glu.orchestration.engine.planner.PlannerService$computeRedeployPlans.callCurrent(Unknown Source)
at org.linkedin.glu.orchestration.engine.planner.PlannerService$computeRedeployPlans.callCurrent(Unknown Source)
at org.linkedin.glu.orchestration.engine.planner.PlannerServiceImpl.computeRedeployPlan(PlannerServiceImpl.groovy:285)
at org.linkedin.glu.console.controllers.PlanController$_closure6.doCall(PlanController.groovy:153)
at org.linkedin.glu.console.controllers.PlanController$_closure6.doCall(PlanController.groovy)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:534)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1351)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:473)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:516)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:929)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:403)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:184)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:864)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:285)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:116)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:359)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:275)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:343)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:272)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:83)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
at org.apache.shiro.grails.SavedRequestFilter.doFilter(SavedRequestFilter.java:55)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:473)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:479)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:929)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:403)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:184)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:864)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
at org.eclipse.jetty.server.Server.handle(Server.java:352)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:596)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1068)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:805)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:508)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:451)
at java.lang.Thread.run(Thread.java:662)

@ypujante

This comment has been minimized.

Member

ypujante commented Jan 18, 2012

which version of glu are you using?

can you give the model you are using? when it happens it would be very helpful if you could capture the state of your system. An easy way to do that is to follow this section in the tutorial: http://linkedin.github.com/glu/docs/latest/html/tutorial.html#using-the-console-cli simply using the cli to issue a "status" command on both the static model and the live model

Thanks

@lucasmcgrew

This comment has been minimized.

lucasmcgrew commented Jan 18, 2012

I just upgraded to 4.1 for the plugin support (super handy by the way!), but I've had similar issues with all of the previous versions I've tried and its sort of turned me off to using child/parent relationships with my services, though it is functionality that I'd really like to employ. I will grab the state the next time it happens and post it up.

I typically notice the issue when I want to deploy a new model and in the process clear out anything currently deployed to a given fabric (in our development environment). I will create a plan using the REST interface and
planAction=undeploy&order=parallel

It seems that ideally, I would want to update the static model and use
planAction=redeploy&order=parallel

I used to only get the NPE with the redeploy, which is why I started using undeploy, but now it seems to be happening for undeploy as well. I'm not sure if this is related to the 4.1 upgrade or not, but I haven't really changed my model.

@ypujante

This comment has been minimized.

Member

ypujante commented Jan 18, 2012

I doubt it is related to the upgrade but just wanted to make sure of which version you are using. Would definitely like to fix the issue as it really should not be happening!

@lucasmcgrew

This comment has been minimized.

lucasmcgrew commented Jan 18, 2012

I have the live vs static status but it has the complete model and I don't think I can post it here. I tried to re-add the child/parent relationship to replicated and immediately got the NPE.

In this example, there are 2 services called ezg and tsserver.

In the live status they are independent service entries and in the static status ezg has the attribute parent: tsserver.

I created a plan using the REST API and "planAction=undeploy&order=parallel" and I ended up with everything undeployed except for ezg which shows status DELTA:

entryState:[running!=NONE]
initParameters.ezgWebDir:[/home/lmcgrew/www/sandbox/2012-01-18-15h23m29s/ezg/!=/home/lmcgrew/www/sandbox/2012-01-18-15h06m05s/ezg/]
initParameters.hbiRoot:[/w/lmcgrew/sandboxes/2012-01-18-15h23m29s/hbi_root/!=/w/lmcgrew/sandboxes/2012-01-18-15h06m05s/hbi_root/]
parent:[/tsserver!=null]

Now, if I try to create a new undeploy plan, I get the NPE and I'm stuck in this delta state. I can however perform a deploy plan which will uninstall ezg fix the delta and redeploy the service. I get the same NPE if I choose to just undeploy the ezg service. Let me know if I can provide any additional details or if any of this is confusing.

@ypujante

This comment has been minimized.

Member

ypujante commented Jan 18, 2012

I will try to investigate with this info and will let you know if not enough.

@lucasmcgrew

This comment has been minimized.

lucasmcgrew commented Jan 18, 2012

Great thanks. If it helps, I fixed the DELTA by deploying the ezg service, which uninstalled the existing ezg service, deployed the parent (tsserver) and deployed ezg and this worked great. Then I went ahead and undeployed both of those (leaving me with a fabric consisting of only undeployed services) and ran my automated script which attempts to undeploy the entire fabric. This failed with the NPE. It seems to me that the issue might be when trying to undeploy a service whose parent service is already in an undeployed state. I'm 90% sure I was able to do this before the 4.1 upgrade and was only seeing this problem with redeploys but I could be wrong.

@ghost ghost assigned ypujante Jan 24, 2012

@ypujante

This comment has been minimized.

Member

ypujante commented Jan 24, 2012

Good news: I am able to write a unit test that reproduces the problem:

public void testUndeployParentChildGlu115()
{
  Plan<ActionDescriptor> p

  // undeploy with parent not present in current model
  p = redeployPlan(Type.PARALLEL,
                   m([agent: 'a1', mountPoint: 'p1', script: 's1'],
                     [agent: 'a1', mountPoint: 'c1', parent: 'p1', script: 's1']),

                   m([agent: 'a1', mountPoint: 'c1', script: 's1']))
}

This fails with the NPE and corresponds to what you describe: c1 is currently deployed and you change the model to add it as child of p1 which is not deployed. This triggers the exception. Hopefully I can fix it.

@ypujante

This comment has been minimized.

Member

ypujante commented Jan 27, 2012

fixed with 4.1.1

@ypujante ypujante closed this Jan 27, 2012

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