-
Notifications
You must be signed in to change notification settings - Fork 4
conn: fix racy access to result fields when connection is closing #4
Conversation
As suggested online @jdef . Is there a possibility to put this single I can see the need to add special error handler here https://github.com/mesosphere/go-zookeeper/pull/4/files#diff-5f455e42d3680fdc56c7076dc0c182f3R1332 but the rest of the code just passes error to the caller. |
@mhrabovcin thanks for the review. I double-checked the changes this morning. All of the funcs I changed actually DO need to be changed, somehow, in order to avoid the data race. This is because statements like As an alternative to the repeated |
@jdef thanks for the detailed explanation. I don't have a strong preference here. From the code readability perspective I think it would be nice to handle this case with the single I am happy to approve the code as it is! |
@mhrabovcin PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
7faff1c
to
42d4f6b
Compare
squashed prior to merge |
possibly racy test?
[EDIT] |
With the introduction of #3 there's now a potential race, at connection close time, between the "send handler" that mutates response objects, and the
return
statements of top-level API calls that read response fields. This PR checks for the race and returns a "connection closing" error in such cases.