Skip to content

add terminationDrainDuration to avoid unpaid requests to fail #4

@gorexlv

Description

@gorexlv
  • I have searched the issues of this repository and believe that this is not a duplicate.

Describe the bug
In sidecar model, Kubernetes will send SIGTERM signals to all containers at the same time before destroying the pod, so dbpack container will stop at the same time as business containers, this may cause unpaid requests to fail.

I think DBPack should waiting for a length of time (terminationDrainDuration) before exiting can solve this problem. Just like Istio-Proxy does.

related code(cmd/cmd.go#L177)
`
dbpack.Start()

		ctx, cancel := context.WithCancel(context.Background())
		c := make(chan os.Signal, 2)
		signal.Notify(c, os.Interrupt, syscall.SIGTERM)
		go func() {
			<-c
			cancel()
			<-c
			os.Exit(1) // second signal. Exit directly.
		}()

		<-ctx.Done()

`

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions