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

fix: fd operator read race after inuse called #351

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

joway
Copy link
Member

@joway joway commented Jul 24, 2024

What type of PR is this?

fix

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

fix: 修复 fd operator 在 inuse 调用后的读竞争问题

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
zh(optional):

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

@joway joway requested review from a team as code owners July 24, 2024 07:08
@joway
Copy link
Member Author

joway commented Jul 24, 2024

fix race stack like this:

refactor: deprecate bthrift, use cloudwego/gopkg · cloudwego/kitex@707b494](https://github.com/cloudwego/kitex/actions/runs/10071020352/job/27840467863?pr=1441)
==================
52WARNING: DATA RACE
53Write at 0x00c0001d9650 by goroutine 51:
54  github.com/cloudwego/netpoll.(*FDOperator).reset()
55      /root/go/pkg/mod/github.com/cloudwego/[email protected]/fd_operator.go:96 +0x64
56  github.com/cloudwego/netpoll.(*operatorCache).freeable()
57      /root/go/pkg/mod/github.com/cloudwego/[email protected]/fd_operator_cache.go:68 +0x5c
58  github.com/cloudwego/netpoll.(*defaultPoll).Free()
59      /root/go/pkg/mod/github.com/cloudwego/[email protected]/poll_default.go:27 +0x53
60  github.com/cloudwego/netpoll.(*FDOperator).Free()
61      /root/go/pkg/mod/github.com/cloudwego/[email protected]/fd_operator.go:62 +0x8b
62  github.com/cloudwego/netpoll.(*connection).initFinalizer.func1()
63      /root/go/pkg/mod/github.com/cloudwego/[email protected]/connection_impl.go:382 +0x46
64  github.com/cloudwego/netpoll.(*connection).closeCallback()
65      /root/go/pkg/mod/github.com/cloudwego/[email protected]/connection_onevent.go:321 +0x288
66  github.com/cloudwego/netpoll.(*connection).onHup()
67      /root/go/pkg/mod/github.com/cloudwego/[email protected]/connection_reactor.go:45 +0x195
68  github.com/cloudwego/netpoll.(*connection).onHup-fm()
69      <autogenerated>:1 +0x4d
70  github.com/cloudwego/netpoll.(*defaultPoll).onhups.func1()
71      /root/go/pkg/mod/github.com/cloudwego/[email protected]/poll_default.go:51 +0xa9
72  github.com/cloudwego/netpoll.(*defaultPoll).onhups.func2()
73      /root/go/pkg/mod/github.com/cloudwego/[email protected]/poll_default.go:54 +0x66
74
75Previous read at 0x00c0001d9650 by goroutine 50:
76  github.com/cloudwego/netpoll.(*defaultPoll).Control()
77      /root/go/pkg/mod/github.com/cloudwego/[email protected]/poll_default_linux.go:259 +0x1e4
78  github.com/cloudwego/netpoll.(*FDOperator).Control()
79      /root/go/pkg/mod/github.com/cloudwego/[email protected]/fd_operator.go:58 +0x81
80  github.com/cloudwego/netpoll.(*connection).register()
81      /root/go/pkg/mod/github.com/cloudwego/[email protected]/connection_onevent.go:328 +0x52
82  github.com/cloudwego/netpoll.(*connection).onPrepare()
83      /root/go/pkg/mod/github.com/cloudwego/[email protected]/connection_onevent.go:128 +0x2b5
84  github.com/cloudwego/netpoll.(*connection).init()
85      /root/go/pkg/mod/github.com/cloudwego/[email protected]/connection_impl.go:354 +0x486
86  github.com/cloudwego/netpoll.(*server).onAccept()
87      /root/go/pkg/mod/github.com/cloudwego/[email protected]/netpoll_server.go:160 +0x71
88  github.com/cloudwego/netpoll.(*server).OnRead()
89      /root/go/pkg/mod/github.com/cloudwego/[email protected]/netpoll_server.go:98 +0x34e
90  github.com/cloudwego/netpoll.(*server).OnRead-fm()
91      <autogenerated>:1 +0x4d
92  github.com/cloudwego/netpoll.(*defaultPoll).handler()
93      /root/go/pkg/mod/github.com/cloudwego/[email protected]/poll_default_linux.go:153 +0x1e9
94  github.com/cloudwego/netpoll.(*defaultPoll).handler-fm()
95      <autogenerated>:1 +0x57
96  github.com/cloudwego/netpoll.(*defaultPoll).Wait()
97      /root/go/pkg/mod/github.com/cloudwego/[email protected]/poll_default_linux.go:110 +0x227
98  github.com/cloudwego/netpoll.(*manager).Run.func2()
99      /root/go/pkg/mod/github.com/cloudwego/[email protected]/poll_manager.go:140 +0x48

@joway joway merged commit c8fc8e5 into cloudwego:develop Jul 24, 2024
9 checks passed
@joway joway deleted the fix/op_race branch July 24, 2024 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants