Skip to content

Global Logger Set to Pipe that Eventually Closes #75

@nateybear

Description

@nateybear

The global logger is set to an open socket in the main serverRun function. This causes issues if, for example, you are running DaemonMode as a background task in an interactive session. The pipe eventually closes and causes code to fail if it tries to log anything.

Wouldn't it be better to use the with_logger construct? It would be simple to implement:

with_logger(MinLevelLogger(FormatLogger(create_mylog(fname), sock), Logging.Info)) do
    # same code as before
end

I cannot write a test to reproduce the issue, as you have to wait for libuv to close the socket. There is an intermediate "paused" state that libuv appears to put sockets in when the server exits, and I haven't figured out how to put the socket in a "closed" state in a way that would reproduce the error.

https://github.com/dmolina/DaemonMode.jl/blob/b8da0d6df57636b07b4b2a6e51e6f4aae9c12da6/src/DaemonMode.jl#L266C1-L266C113

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