draveness
Repos
50
Followers
12021
Following
28

Production-Grade Container Scheduling and Management

94154
33003

The Go programming language

106254
14957

Connect, secure, control, and observe services.

31970
6504

A better approach to expose application in Kubernetes.

104
11

《Go 语言设计与实现》示例代码

228
29

A Modern Matching Engine without documentation YET [alpha]

24
3

Events

opened issue
panic: runtime error: slice bounds out of range
panic: runtime error: slice bounds out of range [524288:266754]

goroutine 1470 [running]:
bytes.(*Buffer).Bytes(...)
	/opt/hostedtoolcache/go/1.19.1/x64/src/bytes/buffer.go:54
net/http.NewRequestWithContext({0xca59f0?, 0xc00003e0a0}, {0xb796a9?, 0xc002547a00?}, {0xc002052630?, 0xa1?}, {0xc9eda0, 0xc00097f4a0?})
	/opt/hostedtoolcache/go/1.19.1/x64/src/net/http/request.go:899 +0x7f1
net/http.NewRequest(...)
	/opt/hostedtoolcache/go/1.19.1/x64/src/net/http/request.go:836
github.com/go-resty/resty/v2.createHTTPRequest(0xc000342000, 0xc002547a00)
	/home/runner/go/pkg/mod/github.com/go-resty/resty/v2@v2.7.0/middleware.go:175 +0x71
github.com/go-resty/resty/v2.(*Client).execute(0xc000342000, 0xc002547a00)
	/home/runner/go/pkg/mod/github.com/go-resty/resty/v2@v2.7.0/client.go:909 +0x1a2
github.com/go-resty/resty/v2.(*Request).Execute(0xc002547a00, {0xb796a9?, 0x0?}, {0xc0055a4900, 0x15})
	/home/runner/go/pkg/mod/github.com/go-resty/resty/v2@v2.7.0/request.go:758 +0x5e9
github.com/go-resty/resty/v2.(*Request).Post(...)
	/home/runner/go/pkg/mod/github.com/go-resty/resty/v2@v2.7.0/request.go:699
spectra.fund/optical/pkg/command/datastore.(*UploadCommand).Execute.func3.1.1()
	/home/runner/work/optical/optical/pkg/command/datastore/upload.go:186 +0x73c
github.com/avast/retry-go/v4.Do(0xc003bf5f08, {0xc001ffbf00, 0x1, 0x10f3880?})
	/home/runner/go/pkg/mod/github.com/avast/retry-go/v4@v4.1.0/retry.go:122 +0x26b
spectra.fund/optical/pkg/command/datastore.(*UploadCommand).Execute.func3.1()
	/home/runner/work/optical/optical/pkg/command/datastore/upload.go:176 +0x233
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/home/runner/go/pkg/mod/golang.org/x/sync@v0.0.0-20220601150217-0de741cfad7f/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
	/home/runner/go/pkg/mod/golang.org/x/sync@v0.0.0-20220601150217-0de741cfad7f/errgroup/errgroup.go:72 +0xa5
					klog.Infof("start to upload object, date=%s path=%s", date, partition.Path)

					if err := retry.Do(func() error {
						resp, err := client.
							R().
							SetQueryParams(map[string]string{
								"zone":       c.Zone,
								"date":       date,
								"instrument": partition.Instrument,
								"type":       partition.Type,
								"index":      fmt.Sprint(partition.Index),
							}).
							SetFile("file", partition.Path).
							Post(fmt.Sprintf("/v1/datastore/objects"))
						if err != nil {
							return errors.Wrapf(err, "unable to upload objects")
						}

						if resp.StatusCode() != 200 {
							return fmt.Errorf("unable to upload objects, body=%s", resp.Body())
						}

						return nil

The above code panic when post files to server, can I use the same client in a different goroutine or do I have to create a client pool?

Created at 1 month ago