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

goroutine leak #16

Open
seaguest opened this issue Mar 23, 2022 · 1 comment
Open

goroutine leak #16

seaguest opened this issue Mar 23, 2022 · 1 comment

Comments

@seaguest
Copy link

Hello,

I found the code has a goroutine leak problem:

cron.go
func (c *Cron) run(ctx context.Context) {
... line 256
					m, err := c.etcdclient.NewMutex(fmt.Sprintf("etcd_cron/%s/%d", e.Job.canonicalName(), effective.Unix()))
					if err != nil {
						go c.etcdErrorsHandler(ctx, e.Job, errors.Wrapf(err, "fail to create etcd mutex for job '%v'", e.Job.Name))
						return
					}

in etcd.go

func (c etcdMutexBuilder) NewMutex(pfx string) (DistributedMutex, error) {
	// As each task iteration lock name is unique, we don't really care about unlocking it
	// So the etcd lease will alst 10 minutes, it ensures that even if another server
	// clock is ill-configured (with a maximum span of 10 minutes), it won't execute the task
	// twice.
	session, err := concurrency.NewSession(c.Client, concurrency.WithTTL(60*10))
	if err != nil {
		return nil, err
	}
	return concurrency.NewMutex(session, pfx), nil
}

it seems the session has never been closed

Each time the task is triggered, a New mutext is created, but the session never had the chance to be closed.

@EtienneM
Copy link
Member

EtienneM commented Apr 1, 2022

Hi,

Thanks for your report. We added your reported issue for further analysis. We will get back to you by the end of the month.

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

No branches or pull requests

2 participants