Skip to content

Bad file descriptor when opening file after USR2 #25

@geoffgarside

Description

@geoffgarside

I'm experiencing an odd issue after issuing a USR2 signal to my process. I've got an OnSIGHUP handler which opens some files and reloads data from them. On the first HUP after USR2 I get

read file.txt: bad file descriptor

if I HUP the process again it all works fine. I've been able to hack around this by setting a global variable after USR2 and if its the first HUP after a USR2 and doing

f, err := os.Open(os.DevNull)
if err == nil {
    defer f.Close()
}

and then running the code to reload the data from the files. Is this anything you've seen before, is there likely to be anything common I've not done correctly.

My use of goagain effectively matches the examples/simple/main.go example with the addition of the OnSIGHUP handler.

I'll try to replicate the issue with the simple example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions