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

[Bug]: 设置了ants.WithExpiryDuration(5*time.Second) 没起作用,导致pool满后一直未释放worker,阻塞新task #313

Open
3 tasks done
wowo666 opened this issue Jan 17, 2024 · 1 comment
Assignees
Labels
bug Something isn't working needs investigation This issue or proposal needs some investigations needs more info waiting for response waiting for the response from commenter

Comments

@wowo666
Copy link

wowo666 commented Jan 17, 2024

Actions I've taken before I'm here

  • I've thoroughly read the documentations on this issue but still have no clue.
  • I've searched the current list of Github issues but didn't find any duplicate issues that have been solved.
  • I've searched the internet with this issue, but haven't found anything helpful.

What happened?

OS: mac
GO: go1.17.12
ants: v2.9.0
使用方式 :
pool:= ants.NewPool(50, ants.WithExpiryDuration(5*time.Second))
当我通过pool..Submit(funcxx) 用完 pool里worker时, 会一直阻塞无法再继续submit,等了1个小时也没释放执行完的worker

Major version of ants

v2

Specific version of ants

v2.9.0

Operating system

macOS

OS version

14.2.1 (23C71)

Go version

go1.17.12

Relevant log output

for _, v := range administrative.Child {
		firstData := *v
		fmt.Print("开始submit")
		err := vars.CronPool.Submit(func() {
			c.checkFirstData(context.Background(), &firstData)
		})
		fmt.Print("提交完submit")
		if err != nil {
			vars.ErrorLogger.WithFields(yklog.Fields{"firstData": firstData}).Errorf(ctx, "创建 检查第一级(省or市)数据异步任务失败: %s", err.Error())
			_err = err
		}
	}

Code snippets (optional)

No response

How to Reproduce

for _, v := range administrative.Child {
	firstData := *v
	fmt.Print("开始submit")
	err := vars.CronPool.Submit(func() {
		c.checkFirstData(context.Background(), &firstData)
	})
	fmt.Print("提交完submit")
	if err != nil {
		vars.ErrorLogger.WithFields(yklog.Fields{"firstData": firstData}).Errorf(ctx, "创建 检查第一级(省or市)数据异步任务失败: %s", err.Error())
		_err = err
	}
}

Does this issue reproduce with the latest release?

I haven't verified it with the latest release

@wowo666 wowo666 added the bug Something isn't working label Jan 17, 2024
@panjf2000
Copy link
Owner

你提交的任务是不是都卡住了?需要等有任务结束之后新的任务才能被运行,否则就是会阻塞住。

@panjf2000 panjf2000 added waiting for response waiting for the response from commenter needs investigation This issue or proposal needs some investigations needs more info labels Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation This issue or proposal needs some investigations needs more info waiting for response waiting for the response from commenter
Projects
None yet
Development

No branches or pull requests

2 participants