Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add terminationDrainDuration to avoid unpaid requests to fail #4

Closed
1 task
gorexlv opened this issue Apr 21, 2022 · 2 comments · Fixed by #35
Closed
1 task

add terminationDrainDuration to avoid unpaid requests to fail #4

gorexlv opened this issue Apr 21, 2022 · 2 comments · Fixed by #35
Assignees

Comments

@gorexlv
Copy link
Contributor

gorexlv commented Apr 21, 2022

  • 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()

`

@dk-lockdown
Copy link
Collaborator

would you like to submit a pull request?

@gorexlv
Copy link
Contributor Author

gorexlv commented Apr 22, 2022

would you like to submit a pull request?

Ok, I'll deal this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants