Skip to content

cmd/go: go doc runaway memory usage in go1.26.2 #78801

@nicholashusin

Description

@nicholashusin

This issue originally came as a security report, but we've determined that this is not a vulnerability.
Therefore, filing this publicly.


A user reported that running go doc on certain packages will cause their memory usage to quickly climb up, eventually causing OOM. In the original report, this happens when running go doc github.com/nats-io/nats.go.ConnectedServerInfo on go1.26.2 on Linux, in a project that imports the package. However, running something like go doc net/http.Server does not cause memory to climb up.

I suspect this is a bit of a heisenbug. So far I was unable to reproduce it. However, @thatnealpatel was able to. According to his observations:

  • At gotip, this issue is fixed.
  • On darwin/arm64 @ go1.26.2, the memory runaway behavior reproduces, albeit slower.
  • His reproduction case is the following:
    • Checked out go1.26.2 release and ran make.bash.
    • Created an empty module with no-op usage of github.com/nats-io/nats.go in main.go .
    • Ran go doc github.com/nats-io/nats.go.ConnectedServerInfo.
    • go doc hangs and memory starts climbing up.

Things I suspect but cannot confirm yet:

  • github.com/nats-io/nats.go.ConnectedServerInfo is a non-existent symbol. Perhaps this bug is more prone to show up / only happens with non-existent symbols?
  • @thatnealpatel being able to reproduce it but not me (despite me being on Linux, just like the original reporter) makes me suspect that this bug is affected by some "external factor". The first thing that came to my mind is that I recently cleaned up my go module cache, maybe that's a factor?

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions