Bug 1561619

Summary: panic: runtime error: invalid memory address or nil pointer dereference
Product: [Fedora] Fedora Reporter: Nicolas Mailhot <nicolas.mailhot>
Component: golangAssignee: Jakub Čajka <jcajka>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: amurdaca, jcajka, lemenkov, nicolas.mailhot, quantum.analyst, renich, vbatts
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-02-11 12:20:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Failing spec none

Description Nicolas Mailhot 2018-03-28 15:29:01 UTC
The golang in Fedora devel (golang-1.10-2.fc29 x86_64) fails to build some golang sirupsen logrus unit tests


+ GOPATH=/builddir/build/BUILD/logrus-1.0.5/_build:/usr/share/gocode
+ go test -buildmode pie -compiler gc -ldflags '-extldflags '\''-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '\'''
time="2018-03-28T03:32:17+02:00" level=error msg="Hello error"
--- FAIL: TestLoggingWithHooksRace (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5573d97c178d]

goroutine 6 [running]:
testing.tRunner.func1(0xc42011e3c0)
        /usr/lib/golang/src/testing/testing.go:742 +0x29f
panic(0x5573d9a7ca00, 0x5573d9be2a10)
        /usr/lib/golang/src/runtime/panic.go:505 +0x22d
github.com/sirupsen/logrus/hooks/test.TestLoggingWithHooksRace(0xc42011e3c0)
        /builddir/build/BUILD/logrus-1.0.5/_build/src/github.com/sirupsen/logrus/hooks/test/test_test.go:54 +0xed
testing.tRunner(0xc42011e3c0, 0x5573d9ad09f8)
        /usr/lib/golang/src/testing/testing.go:777 +0xd2
created by testing.(*T).Run
        /usr/lib/golang/src/testing/testing.go:824 +0x2e2
exit status 2
FAIL    github.com/sirupsen/logrus/hooks/test   0.013s


Upstream says the Fedora compiler is missing bits
https://github.com/sirupsen/logrus/issues/740

Comment 1 Jakub Čajka 2018-03-28 15:34:44 UTC
(In reply to Nicolas Mailhot from comment #0)
> The golang in Fedora devel (golang-1.10-2.fc29 x86_64) fails to build some
> golang sirupsen logrus unit tests
> 
> 
> + GOPATH=/builddir/build/BUILD/logrus-1.0.5/_build:/usr/share/gocode
> + go test -buildmode pie -compiler gc -ldflags '-extldflags '\''-Wl,-z,relro
> -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '\'''
> time="2018-03-28T03:32:17+02:00" level=error msg="Hello error"
> --- FAIL: TestLoggingWithHooksRace (0.00s)
> panic: runtime error: invalid memory address or nil pointer dereference
> [recovered]
>         panic: runtime error: invalid memory address or nil pointer
> dereference
> [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5573d97c178d]
> 
> goroutine 6 [running]:
> testing.tRunner.func1(0xc42011e3c0)
>         /usr/lib/golang/src/testing/testing.go:742 +0x29f
> panic(0x5573d9a7ca00, 0x5573d9be2a10)
>         /usr/lib/golang/src/runtime/panic.go:505 +0x22d
> github.com/sirupsen/logrus/hooks/test.TestLoggingWithHooksRace(0xc42011e3c0)
>        
> /builddir/build/BUILD/logrus-1.0.5/_build/src/github.com/sirupsen/logrus/
> hooks/test/test_test.go:54 +0xed
> testing.tRunner(0xc42011e3c0, 0x5573d9ad09f8)
>         /usr/lib/golang/src/testing/testing.go:777 +0xd2
> created by testing.(*T).Run
>         /usr/lib/golang/src/testing/testing.go:824 +0x2e2
> exit status 2
> FAIL    github.com/sirupsen/logrus/hooks/test   0.013s
> 
> 
> Upstream says the Fedora compiler is missing bits
> https://github.com/sirupsen/logrus/issues/740

It says that Ubuntu is missing "something". Do you know what is supposed to be missing?

Comment 2 Nicolas Mailhot 2018-03-29 08:29:16 UTC
I haven't the faintest idea. I agree upstream is not terribly constructive. They are a core Go project which is used by pretty much every major Go app, from their pow they are the reference, linux distros are a nuisance, users should be dissuaded from using them.

I hoped it would be clearer to you, or that you had the right creds to make them tell what is wrong.

Comment 3 Jakub Čajka 2018-03-29 08:37:52 UTC
My assumption(based on the wording they use) is that upstream of the said project expects some versions(shared, with race detector...) of the pre-built stdlib, and don't check for its availability in its testsuite. Possibly they don't even know what they need.

But I wanted to be clear that for example Ubuntu/Debian don't patch out something from the Go as we did in the past with elliptic curves. I'm not that familiar with them.

Comment 4 Jakub Čajka 2018-03-29 09:08:57 UTC
I can't reproduce this issue with versions of package directly go get from upstream on top of F27 and rawhide.

Could you provide reproducer or step by step guide how to reproduce this issues?

Comment 5 Nicolas Mailhot 2018-03-29 11:30:47 UTC
Created attachment 1414723 [details]
Failing spec

Attaching the spec (the test is currently disabled since it fails, just enable it and rebuild the spec)

For a complete build env you need to copy from https://arekh.ddns.net/rpm/lolita-rawhide/ with the password previously sent by PM (but it may contain too many packages for your needs) or use https://copr.fedorainfracloud.org/coprs/nim/More_Go_Packaging/ (if it has finished building everything sirupsen uses)

Comment 6 Jakub Čajka 2018-04-03 07:01:12 UTC
Thanks, could you please post future bugs with step by step way to reproduce without any external dependencies(or significantly minimized, not dependent on your black box linux distro as it is not by definition bug in Fedora, and I will not support it, but in your distribution). It is courteous and will save both of us lots of time and it makes me actually able to help you. Template for the BZ is there for a reason. 

I have looked in to it a bit more and it reproduces also in Fedora not only in your distro. It seems that dropping the hardening flags(relro) make the issue go away. It is possible that the issue lives somewhere in between Go and ld. I will dig deeper in to the issue and code.

Comment 7 Jan Kurik 2018-08-14 11:07:10 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 8 Elliott Sales de Andrade 2019-02-11 12:20:33 UTC
This is not a bug in Go, but in the test case: https://github.com/sirupsen/logrus/pull/752/files.