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 panic when warn is nil #4782

Closed
wants to merge 1 commit into from
Closed

Conversation

ianwoolf
Copy link
Contributor

Signed-off-by: ian woolf btw515wolf2@gmail.com

fix #4777

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

pkg/api/api.go Outdated
@@ -242,6 +242,9 @@ func Respond(w http.ResponseWriter, data interface{}, warnings []error) {
Data: data,
}
for _, warn := range warnings {
if warn == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But when it can be nil? Which endpoint are you calling to reproduce this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need investigate the root cause too.

Copy link
Member

@hanjm hanjm Oct 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @GiedriusS @yeya24 @ianwoolf , I found the root cause. #4777 (comment) pr: #4805

@aapelismith
Copy link

A pr has been created to solve this problem #4797

@ianwoolf ianwoolf force-pushed the pr-fix-api-panic branch 2 times, most recently from bf89673 to de6822d Compare October 28, 2021 12:06
@ianwoolf
Copy link
Contributor Author

ianwoolf commented Oct 28, 2021

i add a unit test to test race. it will panic if without sync.Mutex.

image

Signed-off-by: ian woolf <btw515wolf2@gmail.com>
@GiedriusS
Copy link
Member

I have merged a fix here: #4805

@GiedriusS
Copy link
Member

Thank you for your work, closing this as a fix has been merged

@GiedriusS GiedriusS closed this Oct 29, 2021
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.

Query: panic on api.Respond warn.Error()
4 participants