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

NPE on show pull with unclear cause #15198

Closed
5 of 6 tasks
zeripath opened this issue Mar 29, 2021 · 0 comments · Fixed by #15199
Closed
5 of 6 tasks

NPE on show pull with unclear cause #15198

zeripath opened this issue Mar 29, 2021 · 0 comments · Fixed by #15199
Labels
Milestone

Comments

@zeripath
Copy link
Contributor

template: repo/issue/view_content/comments:470:20: executing "repo/issue/view_content/comments" at <CommentMustAsDiff (index $comms 0)>: error calling CommentMustAsDiff: PANIC whilst retrieving diff for comment[775] Error: runtime error: invalid memory address or nil pointer dereference
Stack: /usr/local/go/src/runtime/panic.go:212 (0x4565b2)
/usr/local/go/src/runtime/signal_unix.go:742 (0x456432)
/go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:1029 (0x1830a99)
/go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:856 (0x182eb04)
/go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:1267 (0x183357c)
/go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:1295 (0x1833867)
/usr/local/go/src/reflect/value.go:476 (0x4a6fe6)

Description

There is an issue whereby some code review comments can cause a panic when trying to render the comments on the page.

These issues were reported by @miili @skillcoder on #14812 but I have not been able to get more information from them regarding this. (In particular it would be helpful to see examples of the comment table to figure this out.) I have even emailed the administrator of the pyrocko server and have had no response.

However, #15086 has allowed me to discover what the proximal issue is despite the lack of further information. It appears that there is an NPE here:

curSection.Lines = append(curSection.Lines, diffLine)

I don't understand how this can happen as there should always be a hunk header line - however, without actually seeing the patch that causes the problem or any way to replicate it on master/1.14/1.13 I have little other option than to dumbly attempt to work around the issue.

So please @miili @skillcoder would you show me the contents of the comment table that are associated with the issue that cause this.

@zeripath zeripath added this to the 1.13.7 milestone Mar 29, 2021
zeripath added a commit to zeripath/gitea that referenced this issue Mar 29, 2021
I do not understand how this can happen or why.

There is an apparent possibility for a comment.Patch to be missing a hunk header
- this should not happen and do not understand how. But it appears to happen on
1.13 at least in some case.

This PR will simply add a new section if the cursection is empty
thus preventing the NPE.

Fix go-gitea#15198

Signed-off-by: Andrew Thornton <[email protected]>
zeripath added a commit to zeripath/gitea that referenced this issue Mar 29, 2021
Backport go-gitea#15199

I do not understand how this can happen or why.

There is an apparent possibility for a comment.Patch to be missing a hunk header
- this should not happen and do not understand how. But it appears to happen on
1.13 at least in some case.

This PR will simply add a new section if the cursection is empty
thus preventing the NPE.

Fix go-gitea#15198

Signed-off-by: Andrew Thornton <[email protected]>
zeripath added a commit to zeripath/gitea that referenced this issue Mar 29, 2021
Backport go-gitea#15199

I do not understand how this can happen or why.

There is an apparent possibility for a comment.Patch to be missing a hunk header
- this should not happen and do not understand how. But it appears to happen on
1.13 at least in some case.

This PR will simply add a new section if the cursection is empty
thus preventing the NPE.

Fix go-gitea#15198

Signed-off-by: Andrew Thornton <[email protected]>
techknowlogick added a commit that referenced this issue Apr 1, 2021
I do not understand how this can happen or why.

There is an apparent possibility for a comment.Patch to be missing a hunk header
- this should not happen and do not understand how. But it appears to happen on
1.13 at least in some case.

This PR will simply add a new section if the cursection is empty
thus preventing the NPE.

Fix #15198

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: 6543 <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
techknowlogick pushed a commit that referenced this issue Apr 1, 2021
Backport #15199

I do not understand how this can happen or why.

There is an apparent possibility for a comment.Patch to be missing a hunk header
- this should not happen and do not understand how. But it appears to happen on
1.13 at least in some case.

This PR will simply add a new section if the cursection is empty
thus preventing the NPE.

Fix #15198

Signed-off-by: Andrew Thornton <[email protected]>
techknowlogick pushed a commit that referenced this issue Apr 1, 2021
Backport #15199

I do not understand how this can happen or why.

There is an apparent possibility for a comment.Patch to be missing a hunk header
- this should not happen and do not understand how. But it appears to happen on
1.13 at least in some case.

This PR will simply add a new section if the cursection is empty
thus preventing the NPE.

Fix #15198

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this issue Aug 10, 2021
I do not understand how this can happen or why.

There is an apparent possibility for a comment.Patch to be missing a hunk header
- this should not happen and do not understand how. But it appears to happen on
1.13 at least in some case.

This PR will simply add a new section if the cursection is empty
thus preventing the NPE.

Fix go-gitea#15198

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: 6543 <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant