Skip to content

runtime: VirtualFree of 0 bytes failed with errno=487 (ERROR_INVALID_ADDRESS) #35465

Closed
@heschi

Description

@heschi

Activity

added
SoonThis needs action soon. (recent regressions, service outages, unusual time-sensitive situations)
on Nov 8, 2019
mknyszek

mknyszek commented on Nov 8, 2019

@mknyszek
Contributor

The 0 bytes thing is a red herring, the code tries to decommit successively smaller chunks because of how windows mapping works.

It's almost certainly related to my code somehow, and maybe related to #35445.

mknyszek

mknyszek commented on Nov 8, 2019

@mknyszek
Contributor

On second thought... probably not related to #35445. The page size on 386 is 4 KiB.

self-assigned this
on Nov 8, 2019
added
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Nov 8, 2019
added this to the Go1.14 milestone on Nov 8, 2019
heschi

heschi commented on Nov 12, 2019

@heschi
ContributorAuthor
mknyszek

mknyszek commented on Nov 12, 2019

@mknyszek
Contributor

@heschik have you been seeing this often? Do you have more examples? I've been unable to reproduce thus far, and also I don't see it happening at all in CI which leads me to believe it's fairly rare.

I have one suspicion: the background scavenger is scavenging unreserved memory. The evidence here is that:

  • The failure is ERROR_INVALID_ADDRESS (though MSDN won't tell me under what conditions different error codes are set).
  • The page to be scavenged is at the very top of a palloc chunk, which would be the first thing the scavenger sees.

There is a check that guards against this though, so if this is indeed the case, that must be erroneously passing. But if that check is erroneously passing, then it's possible to allocate into unmapped memory, which is not a failure mode I've seen yet (though certainly possible).

mknyszek

mknyszek commented on Nov 12, 2019

@mknyszek
Contributor

Ah, excellent. Thank you @heschik.

This supports my hypothesis, though it's curious that it's the same test every time. It's probably just quite good at tickling some edge case.

I was able to reproduce once in a gomote (unfortunately it dumped the output into my terminal window and I lost all the useful info) but it's timing out now. Now that I can reproduce though it should be easier to get to the bottom of this.

mknyszek

mknyszek commented on Nov 13, 2019

@mknyszek
Contributor

I think I found the problem. Will push a fix in a bit.

gopherbot

gopherbot commented on Nov 13, 2019

@gopherbot
Contributor

Change https://golang.org/cl/206978 mentions this issue: runtime: check summary before scavenging in fast path

mknyszek

mknyszek commented on Nov 13, 2019

@mknyszek
Contributor

@heschik confirmed this fixes the problem in the x/tools test (10 consecutive runs and no failure; the tests in that package take a while to run). It's a bit wild to me how consistently that test was able to trigger this, but it was nice to have a consistent reproducer. :)

6 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeOS-WindowsSoonThis needs action soon. (recent regressions, service outages, unusual time-sensitive situations)release-blocker

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mknyszek@ianlancetaylor@bcmills@gopherbot@heschi

        Issue actions

          runtime: VirtualFree of 0 bytes failed with errno=487 (ERROR_INVALID_ADDRESS) · Issue #35465 · golang/go