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

potential data race in p2p/dial.go #27388

Closed
lobottt opened this issue May 30, 2023 · 2 comments
Closed

potential data race in p2p/dial.go #27388

lobottt opened this issue May 30, 2023 · 2 comments
Assignees
Labels

Comments

@lobottt
Copy link

lobottt commented May 30, 2023

It seems to be a potential data race. Specifically, there are two conflicting operations on the field "dest", where the read operation at: p2p/dail.go:413, and the write operation at: p2p/dail.go:517 A data race may occur when the two functions where the two operations are located are called in parallel.

@holiman
Copy link
Contributor

holiman commented Jun 14, 2023

Yep. The field dest is even commented as such:

	// These fields are private to the task and should not be
	// accessed by dialScheduler while the task is running.
	dest         *enode.Node

But the dial scheduler reaches in and accesses it anyway:

// updateStaticPool attempts to move the given static dial back into staticPool.
func (d *dialScheduler) updateStaticPool(id enode.ID) {
	task, ok := d.static[id]
	if ok && task.staticPoolIndex < 0 && d.checkDial(task.dest) == nil {
		d.addToStaticPool(task)
	}
}

cc @fjl

@lobottt how did you come across this? Manual inspection or running it with --race enabled?

@holiman holiman changed the title A potential data race in p2p/dail.go potential data race in p2p/dial.go Jun 14, 2023
@fjl
Copy link
Contributor

fjl commented Jun 14, 2023

This is a known issue, see here: #23430

@fjl fjl closed this as completed Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants