allen-servedio opened a new issue #740: Segfault when root package is not 
defined
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/740
 
 
   I get the segfault shown below when a root package is not defined in my 
`manifest.yaml` for deploying dependent packages. 
   
   For an example - this produces the segfault:
   
   ```
   project:
     name: WskDeployWithDeps
     version: 0.0.2
     packages:
       myrediskv:
         license: Apache-2.0
         version: 0.0.2
         namespace: my-namespace
         dependencies:
           poc-common-func:
             location: https://github.com/my-org/my-project
             version: 0.0.1
             inputs: 
               redisURL:
                 type: string
                 value: my-url-goes-here
                 description: Redis database URL
   ```
   
   This works properly because `deployers/servicedeployer.go:472` expects there 
to be a root package defined.
   
   ```
   project:
     name: WskDeployWithDeps
     version: 0.0.2
     packages:
       myrediskv:
         license: Apache-2.0
         version: 0.0.2
         namespace: my-namespace
         dependencies:
           poc-common-func:
             location: https://github.com/my-org/my-project
             version: 0.0.1
             inputs: 
               redisURL:
                 type: string
                 value: my-url-goes-here
                 description: Redis database URL
   package:
     name: rediskv
   ```
   
   Here is the segfault:
   
   ```
   panic: runtime error: invalid memory address or nil pointer dereference
   [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x13bea4a]
   
   goroutine 1 [running]:
   
github.com/apache/incubator-openwhisk-wskdeploy/deployers.(*ServiceDeployer).DeployDependencies(0xc420102240,
 0x0, 0x0)
        
/Users/aervedio/go/src/github.com/apache/incubator-openwhisk-wskdeploy/deployers/servicedeployer.go:472
 +0xa4a
   
github.com/apache/incubator-openwhisk-wskdeploy/deployers.(*ServiceDeployer).deployAssets(0xc420102240,
 0x0, 0x14c0677)
        
/Users/aervedio/go/src/github.com/apache/incubator-openwhisk-wskdeploy/deployers/servicedeployer.go:374
 +0x50
   
github.com/apache/incubator-openwhisk-wskdeploy/deployers.(*ServiceDeployer).Deploy(0xc420102240,
 0x0, 0x0)
        
/Users/aervedio/go/src/github.com/apache/incubator-openwhisk-wskdeploy/deployers/servicedeployer.go:339
 +0x2c9
   github.com/apache/incubator-openwhisk-wskdeploy/cmd.Deploy(0x0, 0x0)
        
/Users/aervedio/go/src/github.com/apache/incubator-openwhisk-wskdeploy/cmd/root.go:243
 +0x4c5
   github.com/apache/incubator-openwhisk-wskdeploy/cmd.RootCmdImp(0x171fac0, 
0xc4201fc340, 0x0, 0x4, 0x0, 0x0)
        
/Users/aervedio/go/src/github.com/apache/incubator-openwhisk-wskdeploy/cmd/root.go:55
 +0x22
   github.com/spf13/cobra.(*Command).execute(0x171fac0, 0xc4200a0100, 0x4, 0x4, 
0x171fac0, 0xc4200a0100)
        /Users/aervedio/go/src/github.com/spf13/cobra/command.go:753 +0x475
   github.com/spf13/cobra.(*Command).ExecuteC(0x171fac0, 0x1a, 0x0, 
0xc4200d1f70)
        /Users/aervedio/go/src/github.com/spf13/cobra/command.go:843 +0x334
   github.com/spf13/cobra.(*Command).Execute(0x171fac0, 0x10037bf, 0x100371e)
        /Users/aervedio/go/src/github.com/spf13/cobra/command.go:791 +0x2b
   github.com/apache/incubator-openwhisk-wskdeploy/cmd.Execute()
        
/Users/aervedio/go/src/github.com/apache/incubator-openwhisk-wskdeploy/cmd/root.go:69
 +0x40
   main.main()
        
/Users/aervedio/go/src/github.com/apache/incubator-openwhisk-wskdeploy/main.go:26
 +0x20
   ```
   
   The actual line that is failing is this one:
   
   ```
                                        qName, err := 
utils.ParseQualifiedName(depServiceDeployer.RootPackageName, 
depServiceDeployer.Deployment.Packages[depServiceDeployer.RootPackageName].Package.Namespace)
   ```
   
   I traced the code and can see that 
`depServiceDeployer.Deployment.Packages[depServiceDeployer.RootPackageName]` 
returns a nil (also `depServiceDeployer.RootPackageName` is empty) and so 
subsequent property dereferencing blows up with a nil pointer.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to