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

Logrus crashes on terminal check #1275

Closed
purplefox opened this issue Aug 28, 2021 · 5 comments · Fixed by #1280
Closed

Logrus crashes on terminal check #1275

purplefox opened this issue Aug 28, 2021 · 5 comments · Fixed by #1280

Comments

@purplefox
Copy link

purplefox commented Aug 28, 2021

Hi,

We integrated logrus into our application but it crashes when running. We are using 1.8.1. It appears to be doing a terminal check that it's not running on app engine, and the crash occurs in a syscall. Here is the stack trace:

runtime.systemstack_switch at asm_amd64.s:350
runtime.libcCall at sys_libc.go:49
syscall.syscall at sys_darwin.go:23
:1
golang.org/x/sys/unix.ioctl at zsyscall_darwin_amd64.go:690
golang.org/x/sys/unix.IoctlGetTermios at ioctl.go:73
github.com/sirupsen/logrus.isTerminal at terminal_check_bsd.go:11
github.com/sirupsen/logrus.checkIfTerminal at terminal_check_notappengine.go:13
github.com/sirupsen/logrus.(*TextFormatter).init at text_formatter.go:106
github.com/sirupsen/logrus.(*TextFormatter).Format.func1 at text_formatter.go:196
sync.(*Once).doSlow at once.go:68
sync.(*Once).Do at once.go:59
github.com/sirupsen/logrus.(*TextFormatter).Format at text_formatter.go:196
github.com/sirupsen/logrus.(*Entry).write at entry.go:279

OS is MacOS Big Sur 11.5.2
Go version is 1.17
AMD64 arch

Any thoughts on what might be causing this?

@purplefox
Copy link
Author

I believe Apple has made security changes in Big Sur, and perhaps now applications are no longer allowed by default to make certain syscalls - e.g. this one to get terminal properties.

@anajavi
Copy link
Contributor

anajavi commented Aug 30, 2021

I believe the golang.org/x/sys should be updated to version v0.0.0-20210817190340-bfb29a6856f2 when using go 1.17.

The crash went away for me when I added to go.mod:

golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 // indirect

More info: Homebrew/homebrew-core#83413

Maybe the logrus go.mod should be updated?

@purplefox
Copy link
Author

Thanks, this works

synfinatic added a commit to synfinatic/aws-sso-cli that referenced this issue Sep 5, 2021
- fix `go vet` error
- fix build on Big Sur due to new security limits which impact
    logrus: sirupsen/logrus#1275
@machinae
Copy link

machinae commented Sep 6, 2021

An easier solution that fixed it for me is upgrading the sys dependency:
go get -u golang.org/x/sys
It will set go.mod and go.sum to the correct version.

senorprogrammer added a commit to wtfutil/wtf that referenced this issue Sep 10, 2021
This same bug is affecting WTF: sirupsen/logrus#1275

Signed-off-by: Chris Cummer <chriscummer@me.com>
@senorprogrammer
Copy link

Thank you @machinae for suggesting this fix. It appears to have solved it for WTF.

AlexanderYastrebov added a commit to zalando/skipper that referenced this issue Sep 18, 2021
Older version of indirect golang.org/x/sys caused SIGSEGV on Go 1.17 on MacOS Big Sur

See sirupsen/logrus#1275
Fixes #1836

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
AlexanderYastrebov added a commit to zalando/skipper that referenced this issue Sep 20, 2021
Older version of indirect golang.org/x/sys caused SIGSEGV on Go 1.17 on MacOS Big Sur

See sirupsen/logrus#1275
Fixes #1836

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
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 a pull request may close this issue.

4 participants