Skip to content

memory leak when using Logrus with Go1.23+ #1463

@JayaIngle1

Description

@JayaIngle1

Our service has been using logrus since a long time. We upgraded Go to 1.23 from 1.21

goroutine 79535 [select]: io.(*pipe).read(0xc000ded260, {0xc000f3a000, 0x10000, 0x4258fc?}) /usr/local/go/src/io/pipe.go:57 +0xa5 io.(*PipeReader).Read(0x19a7a68?, {0xc000f3a000?, 0x4107e5?, 0x1000000004b0985?}) /usr/local/go/src/io/pipe.go:136 +0x1b bufio.(*Scanner).Scan(0xc000b30f28) /usr/local/go/src/bufio/scan.go:214 +0x81b github.com/sirupsen/logrus.(*Entry).writerScanner(0xc000b30fd0?, 0xc000df41a8, 0xc0002e2830) /go/pkg/mod/github.com/sirupsen/[email protected]/writer.go:86 +0x125 created by github.com/sirupsen/logrus.(*Entry).WriterLevel in goroutine 3402 /go/pkg/mod/github.com/sirupsen/[email protected]/writer.go:57 +0x385

seems like it is coming from https://github.com/sirupsen/logrus/blob/master/writer.go#L57

Seems like it is not getting closed by runtime.
// Set a finalizer function to close the writer when it is garbage collected runtime.SetFinalizer(writer, writerFinalizer)

Can maintainers please look into this ?

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