Skip to content

Logger panic: SIGFAULT when main func Quit #1495

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

Open
Raxel01 opened this issue Apr 8, 2025 · 0 comments
Open

Logger panic: SIGFAULT when main func Quit #1495

Raxel01 opened this issue Apr 8, 2025 · 0 comments

Comments

@Raxel01
Copy link

Raxel01 commented Apr 8, 2025

Describe the bug
after a return on a main function
defer Logger.Sync() is called and panic SIGFAULT is raised

To Reproduce
...

Expected behavior
Just close the program without panic segfault
after I removed defer env.Logger.Sync() it works cool
Additional context
func main() {
defer env.Logger.Sync()

var err error
env.Logger, err = zap.NewProduction()
if err != nil {
	log.Fatalf("could not create zap logger: %v", err)
}

zap.ReplaceGlobals(env.Logger)
if !service.functionThatReturnFalse(){
             //when return is hit the program segfault !
	return
}

Some implementation code is removed .....  
router.Run(":" + port)

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant