Repository: fission/fission (language: go)

Issue:
Panic for the buildermgr
<!-- Please answer these questions before submitting your issue. Thanks! -->

<!-- Documentation URL: https://fission.io/docs -->
<!-- Troubleshooting guide: https://fission.io/docs/trouble-shooting/ -->

**Fission/Kubernetes version**

<!-- If you tested with other services, for example Istio, please also provide the version of service as well. -->

<pre>
$ fission version
$ kubectl version
</pre>

**Kubernetes platform (e.g. Google Kubernetes Engine)**

**Describe the bug**
<!--A clear and concise description of what the bug is.-->
```bash
2023-04-12T07:43:28.002Z	INFO	builder_manager.package_watcher	httpserver/server.go:17	starting server	{"service": "metrics", "addr": ":8080"}
2023-04-12T07:43:28.082Z	INFO	builder_manager.package_watcher	buildermgr/pkgwatcher.go:91	starting build for package	{"package_name": "be02bdb3-5560-47a6-ab94-43d16c59a821", "resource_version": "1239179507"}
2023-04-12T07:43:28.095Z	INFO	builder_manager.package_watcher	buildermgr/pkgwatcher.go:132	builder pod does not exist for environment, will retry again later	{"environment": "python3-7-exec"}
2023-04-12T07:43:28.596Z	INFO	builder_manager.package_watcher	buildermgr/pkgwatcher.go:132	builder pod does not exist for environment, will retry again later	{"environment": "python3-7-exec"}
2023-04-12T07:43:29.096Z	INFO	builder_manager.package_watcher	buildermgr/pkgwatcher.go:132	builder pod does not exist for environment, will retry again later	{"environment": "python3-7-exec"}
2023-04-12T07:43:29.597Z	INFO	builder_manager.package_watcher	buildermgr/pkgwatcher.go:132	builder pod does not exist for environment, will retry again later	{"environment": "python3-7-exec"}
2023-04-12T07:43:30.097Z	INFO	builder_manager.package_watcher	buildermgr/pkgwatcher.go:132	builder pod does not exist for environment, will retry again later	{"environment": "python3-7-exec"}
2023-04-12T07:43:30.597Z	INFO	builder_manager.package_watcher	buildermgr/pkgwatcher.go:132	builder pod does not exist for environment, will retry again later	{"environment": "python3-7-exec"}
2023-04-12T07:43:31.098Z	INFO	builder_manager.package_watcher	buildermgr/pkgwatcher.go:132	builder pod does not exist for environment, will retry again later	{"environment": "python3-7-exec"}
2023-04-12T07:43:31.598Z	INFO	builder_manager.package_watcher	buildermgr/pkgwatcher.go:132	builder pod does not exist for environment, will retry again later	{"environment": "python3-7-exec"}
2023-04-12T07:43:32.103Z	DEBUG	builder_manager.package_watcher	utils/rbacutils.go:255	service account already present in rolebinding so nothing to add	{"service_account_name": "fission-builder", "service_account_namespace": "faasprod-prod", "role_binding": "package-getter-binding", "role_binding_namespace": "faasprod-dev"}
2023-04-12T07:43:32.103Z	INFO	builder_manager.package_watcher	buildermgr/pkgwatcher.go:180	setup rolebinding for sa package	{"sa": "fission-builder.faasprod-prod", "package": "be02bdb3-5560-47a6-ab94-43d16c59a821.faasprod-dev"}
2023-04-12T07:43:32.403Z	INFO	builder_manager.package_watcher	buildermgr/common.go:89	started building with source package	{"source_package": "be02bdb3-5560-47a6-ab94-43d16c59a821-0cpqry"}
2023/04/12 07:43:32 [DEBUG] POST http://python3-7-exec-867288845.faasprod-prod:8001
2023/04/12 07:43:34 [DEBUG] POST http://python3-7-exec-867288845.faasprod-prod:8001 (status: 500): retrying in 1s (4 left)
2023/04/12 07:43:38 [DEBUG] POST http://python3-7-exec-867288845.faasprod-prod:8001 (status: 500): retrying in 2s (3 left)
2023/04/12 07:43:42 [DEBUG] POST http://python3-7-exec-867288845.faasprod-prod:8001 (status: 500): retrying in 4s (2 left)
2023/04/12 07:43:48 [DEBUG] POST http://python3-7-exec-867288845.faasprod-prod:8001 (status: 500): retrying in 8s (1 left)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x18270a0]

goroutine 181 [running]:
github.com/fission/fission/pkg/error.MakeErrorFromHTTP(0x2688968?)
	pkg/error/httperror.go:46 +0x40
github.com/fission/fission/pkg/builder/client.(*Client).Build(0xc010ea9d60, {0x2688968, 0xc00005a060}, 0xc000631340?)
	pkg/builder/client/client.go:65 +0x695
github.com/fission/fission/pkg/buildermgr.buildPackage({0x2688968, 0xc00005a060}, 0xc010f54300?, {0x26716f0?, 0xc0006219b0?}, {0xc0005e7f50, 0xd}, {0x7ffcb31b172d, 0x20}, 0xc000138240)
	pkg/buildermgr/common.go:91 +0xac5
github.com/fission/fission/pkg/buildermgr.(*packageWatcher).build(0xc00014a0c0, {0x2688968, 0xc00005a060}, 0xc000f90de0)
	pkg/buildermgr/pkgwatcher.go:185 +0x1e85
created by github.com/fission/fission/pkg/buildermgr.(*packageWatcher).packageInformerHandler.func1
	pkg/buildermgr/pkgwatcher.go:300 +0x114
```

**To Reproduce**

<!-- Please provide steps for reproducing the error. -->
When the build task builds timed out

**Expected result**
<!--A clear and concise description of what you expected to happen.-->

**Actual result**

**Screenshots/Dump file**
<!--If applicable, add screenshots/fission dump file to help explain your problem.-->

<pre>
$ fission support dump
</pre>

**Additional context**
<!--Add any other context about the problem here.-->



Discussion / hints:

Fix patch:
diff --git a/pkg/builder/client/client.go b/pkg/builder/client/client.go
index 6cddf94a53..f77ec7a2da 100644
--- a/pkg/builder/client/client.go
+++ b/pkg/builder/client/client.go
@@ -62,7 +62,7 @@ func (c *Client) Build(ctx context.Context, req *builder.PackageBuildRequest) (*
 
 	resp, err := ctxhttp.Post(ctx, c.httpClient.StandardClient(), c.url, "application/json", bytes.NewReader(body))
 	if err != nil {
-		return nil, ferror.MakeErrorFromHTTP(resp)
+		return nil, err
 	}
 	defer resp.Body.Close()
 


Test patch: