Skip to content

Commit

Permalink
Fix SEGFAULT issue when build manager failed to update package (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
life1347 committed Apr 17, 2018
1 parent fef1469 commit 0194f53
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions buildermgr/pkgwatcher.go
Expand Up @@ -67,24 +67,24 @@ func makePackageWatcher(fissionClient *crd.FissionClient, getter k8sCache.Getter
// 5. Update package resource in package ref of functions that share the same package
// 6. Update package status to succeed state
// *. Update package status to failed state,if any one of steps above failed/time out
func (pkgw *packageWatcher) build(buildCache *cache.Cache, pkg *crd.Package) {
func (pkgw *packageWatcher) build(buildCache *cache.Cache, srcpkg *crd.Package) {

// Ignore non-pending state packages.
if pkg.Status.BuildStatus != fission.BuildStatusPending {
if srcpkg.Status.BuildStatus != fission.BuildStatusPending {
return
}

// Ignore duplicate build requests
key := fmt.Sprintf("%v-%v", pkg.Metadata.Name, pkg.Metadata.ResourceVersion)
err, _ := buildCache.Set(key, pkg)
key := fmt.Sprintf("%v-%v", srcpkg.Metadata.Name, srcpkg.Metadata.ResourceVersion)
err, _ := buildCache.Set(key, srcpkg)
if err != nil {
return
}
defer buildCache.Delete(key)

log.Printf("Start build for package %v with resource version %v", pkg.Metadata.Name, pkg.Metadata.ResourceVersion)
log.Printf("Start build for package %v with resource version %v", srcpkg.Metadata.Name, srcpkg.Metadata.ResourceVersion)

pkg, err = updatePackage(pkgw.fissionClient, pkg, fission.BuildStatusRunning, "", nil)
pkg, err := updatePackage(pkgw.fissionClient, srcpkg, fission.BuildStatusRunning, "", nil)
if err != nil {
e := fmt.Sprintf("Error setting package pending state: %v", err)
log.Println(e)
Expand Down

0 comments on commit 0194f53

Please sign in to comment.