-
Notifications
You must be signed in to change notification settings - Fork 92
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
Values overwritten when more than 1 page of data available #117
Comments
Hi @piechu, interesting find. Thanks for reporting and digging into this. We'll take a look and report back. |
@piechu I tried reproducing this issue multiple times with over 300 channels and was unable to reproduce it. Do you have any other information that might help me reproduce the problem? How many channels, etc? |
@sanderblue I have around 430 notification channels and every call to New Relic return page with 200 entries. Do you check for number of entries or actual values in table? As number of entries should be correct. |
I checked for duplicates entries (duplicate IDs). |
So after doing some testing in a better controlled environment, I was able to reproduce the duplication issue. Thanks again for the investigation on your end. We'll let you know once we get a fix out for this. |
@sanderblue great to hear that. I have a unit test covering this scenario - attaching patch here. |
Hi,
I have been playing with new relic terraform plugin which is using newrelic-client-go. I noticed that when I was searching for an alert notification channel - depending on environment - sometimes it was found, sometimes not. When I tried to compare the difference between environments - the only one was number of already defined channels. I thought that problem might be with plugin getting just one page of data - but since it is using newrelic-client-go - it should receive all data regardless how many is defined in NewRelic.
Playing with the code - I've noticed that data returned from newrelic-client-go ListChannels method is corrupted - multiple entries were duplicated. I think it is caused by using reference for response (&response) when calling alerts.client.Get - as same object is being reuse - it does not reallocate memory, which cause entries in array overwritten. Call ends up with proper number of elements in alertChannels slice, but with duplicated entries.
I've checked that assigning fresh value for response works as expected. As I'm not a Go expert maybe there is a better solution.
Thanks.
The text was updated successfully, but these errors were encountered: