Skip to content

go1.23 time.NewTicker Reset make program freeze #71173

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

Closed
Asutorufa opened this issue Jan 8, 2025 · 3 comments
Closed

go1.23 time.NewTicker Reset make program freeze #71173

Asutorufa opened this issue Jan 8, 2025 · 3 comments

Comments

@Asutorufa
Copy link

Asutorufa commented Jan 8, 2025

Go version

go1.23.4 linux/amd64

Output of go env in your module/workspace:

Go playground environment.

What did you do?

https://go.dev/play/p/J1FvNVNhGUo

// You can edit this code!
// Click here and start typing.
package main

import (
	"fmt"
	"time"
)

func main() {
	t := *time.NewTicker(time.Second * 60)
	t.Reset(time.Second * 60)
	fmt.Println("Hello, 世界")
}

What did you see happen?

The program freeze, include can't access pprof from http server, but when I remove * from NewTicker or use go 1.22, it's normal running.

What did you expect to see?

Normal running or same behavior
of go1.22.

@Asutorufa Asutorufa changed the title go1.23 time.NewTicker Reset make all program freeze go1.23 time.NewTicker Reset make program freeze Jan 8, 2025
@gabyhelp
Copy link

gabyhelp commented Jan 8, 2025

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@fakeboboliu
Copy link

fakeboboliu commented Jan 8, 2025

This will work.

https://go.dev/play/p/OdaXwNitBck

package main

import (
	"fmt"
	"time"
)

func main() {
	t2 := time.NewTicker(time.Second * 1)
	t := *t2
	t.Reset(time.Second * 1)
	fmt.Println("Hello, 世界")
}

Seems like some escaping related problem.

@seankhliao
Copy link
Member

see #69186

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2025
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

No branches or pull requests

4 participants