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

resolves issue #3262 #3268

Closed
wants to merge 2 commits into from
Closed

resolves issue #3262 #3268

wants to merge 2 commits into from

Conversation

kf6nux
Copy link

@kf6nux kf6nux commented Sep 28, 2016

It appears that the slice size of n.Links is being modified after the destination capacity of pbn.Links is set, thereby causing a panic when attempting to access an index out of range on the new slice. By using append, we can avoid using mutexes and retain most of the original performance.

It appears that the slice size of `n.Links` is being modified after the destination capacity of `pbn.Links` is set, thereby causing a panic when attempting to access an index out of range on the new slice.  By using append, we can avoid using mutexes and retain most of the original performance.
@whyrusleeping
Copy link
Member

Hrm... I think that the issue in 3262 is likely a race condition. In that event, this change won't fix the problem

@whyrusleeping whyrusleeping added the need/analysis Needs further analysis before proceeding label Sep 28, 2016
@kf6nux
Copy link
Author

kf6nux commented Sep 29, 2016

You are correct that it appears to be a race condition, but why do you say this fix won't solve the problem?

@whyrusleeping
Copy link
Member

Because this fix appends an empty node to the end of an already allocated array. With no race condition involved, it would just append entries to the end of the existing array, resulting in us having a links array of twice the length we expect. And since this doesnt fix the actual race condition, when the race condition actually happens, we're going to have an array of undefined length as the appends will be interspersed between calling goroutines.

@kf6nux
Copy link
Author

kf6nux commented Sep 29, 2016

Oh, I forgot to change the make statement. I'll do that and then it'll be correct. Let me know if you need a playground proof.

@kf6nux
Copy link
Author

kf6nux commented Sep 29, 2016

Fixed. Let me know if you need a playground proof.

@kevina
Copy link
Contributor

kevina commented Sep 30, 2016

@kf6nux you need to fix your commit messages, please see the above message from GitCop.

Since you have two commits you will need to do a git rebase -i to fix the commit messages. There are plenty of tutorials on this on the net if you need help.

@whyrusleeping
Copy link
Member

#3262 was resolved by #3271, Thank you very much for the initiate and work, but i'm going to close this as it is no longer necessary. (let me know if you disagree)

@whyrusleeping whyrusleeping removed the need/analysis Needs further analysis before proceeding label Sep 30, 2016
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

Successfully merging this pull request may close these issues.

4 participants