-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Error: invalid memory address or nil pointer dereference #18629
Comments
gitea/routers/api/v1/repo/repo.go Line 239 in a97c8a8
|
gitea/modules/context/context.go Line 377 in a97c8a8
gitea/modules/context/context.go Line 261 in a97c8a8
gitea/modules/context/context.go Line 273 in a97c8a8
gitea/modules/context/context.go Line 201 in a97c8a8
|
I don't understand how a nil pointer exception can happen here. |
Ok I guess we just need to stop attempting to render if the underlying error is connection reset by peer. |
When a net.OpError occurs during rendering the underlying connection is essentially dead and therefore attempting to render further data will only cause further errors. Therefore in serverErrorInternal detect if the passed in error is an OpError and if so do not attempt any further rendering. Fix go-gitea#18629 Signed-off-by: Andrew Thornton <[email protected]>
When a net.OpError occurs during rendering the underlying connection is essentially dead and therefore attempting to render further data will only cause further errors. Therefore in serverErrorInternal detect if the passed in error is an OpError and if so do not attempt any further rendering. Fix #18629 Signed-off-by: Andrew Thornton <[email protected]>
…#18642) Backport go-gitea#18642 When a net.OpError occurs during rendering the underlying connection is essentially dead and therefore attempting to render further data will only cause further errors. Therefore in serverErrorInternal detect if the passed in error is an OpError and if so do not attempt any further rendering. Fix go-gitea#18629 Signed-off-by: Andrew Thornton <[email protected]>
…18645) Backport #18642 When a net.OpError occurs during rendering the underlying connection is essentially dead and therefore attempting to render further data will only cause further errors. Therefore in serverErrorInternal detect if the passed in error is an OpError and if so do not attempt any further rendering. Fix #18629 Signed-off-by: Andrew Thornton <[email protected]>
Gitea 1.16.1 (built from 3d08e3a, includes fix https://github.com/go-gitea/gitea/pull/18642/files) still throws sometimes:
|
Well this is irritating. package main
import (
"errors"
"fmt"
"net"
)
func main() {
opError := &net.OpError{Op: "write", Net: "", Err: fmt.Errorf("random")}
fmt.Println(opError)
fmt.Println(errors.Is(opError, &net.OpError{}))
} a We'll have to try again with just plain type checking because go's errors.Is just doesn't do what it should do. |
Unfortunately go-gitea#18642 does not work because a `*net.OpError` does not implement the `Is` interface to make `errors.Is` work correctly - thus leading to the irritating conclusion that a `*net.OpError` is not a `*net.OpError`. Here we keep the `errors.Is` because presumably this will be fixed at some point in the golang main source code but also we add a simply type cast to also check. Fix go-gitea#18629 Signed-off-by: Andrew Thornton <[email protected]>
…2) (#19049) Unfortunately #18642 does not work because a `*net.OpError` does not implement the `Is` interface to make `errors.Is` work correctly - thus leading to the irritating conclusion that a `*net.OpError` is not a `*net.OpError`. Here we keep the `errors.Is` because presumably this will be fixed at some point in the golang main source code but also we add a simply type cast to also check. Fix #18629 Signed-off-by: Andrew Thornton <[email protected]>
…2) (go-gitea#19049) Backport go-gitea#19049 Unfortunately go-gitea#18642 does not work because a `*net.OpError` does not implement the `Is` interface to make `errors.Is` work correctly - thus leading to the irritating conclusion that a `*net.OpError` is not a `*net.OpError`. Here we keep the `errors.Is` because presumably this will be fixed at some point in the golang main source code but also we add a simply type cast to also check. Fix go-gitea#18629 Signed-off-by: Andrew Thornton <[email protected]>
…2) (#19049) (#19056) Backport #19049 Unfortunately #18642 does not work because a `*net.OpError` does not implement the `Is` interface to make `errors.Is` work correctly - thus leading to the irritating conclusion that a `*net.OpError` is not a `*net.OpError`. Here we keep the `errors.Is` because presumably this will be fixed at some point in the golang main source code but also we add a simply type cast to also check. Fix #18629 Signed-off-by: Andrew Thornton <[email protected]>
…#18642) When a net.OpError occurs during rendering the underlying connection is essentially dead and therefore attempting to render further data will only cause further errors. Therefore in serverErrorInternal detect if the passed in error is an OpError and if so do not attempt any further rendering. Fix go-gitea#18629 Signed-off-by: Andrew Thornton <[email protected]>
…2) (go-gitea#19049) Unfortunately go-gitea#18642 does not work because a `*net.OpError` does not implement the `Is` interface to make `errors.Is` work correctly - thus leading to the irritating conclusion that a `*net.OpError` is not a `*net.OpError`. Here we keep the `errors.Is` because presumably this will be fixed at some point in the golang main source code but also we add a simply type cast to also check. Fix go-gitea#18629 Signed-off-by: Andrew Thornton <[email protected]>
Gitea Version
1.16-rc1
Git Version
No response
Operating System
No response
How are you running Gitea?
Compiled from source.
Database
No response
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Description
A single case was caught:
Screenshots
No response
The text was updated successfully, but these errors were encountered: