Skip to content

runtime: increase in memory usage and different GC behavior upgrading from 1.13.10 to 1.14.2 #38827

Closed
@BorisKozo

Description

@BorisKozo

Note that I read carefully through #37927 and #35112 but it seems those issues were handled already.

What version of Go are you using (go version)?

Upgrade 1.13.10 -> 1.14.2

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Windows 10 (reproduces on other Windows versions as well)

What did you do?

Run my application memory benchmark

What did you expect to see?

Same or better results as in 1.13.10

What did you see instead?

Worse results

I have to add that our application is resource critical so every increase in memory or CPU usage raises eyebrows immediately.

I compiled our application with both GO 1.13.10 and 1.14.2 and the CPU and memory behavior are inconsistent between the two versions as the later consumes more memory (enough to trigger the benchmark failure). The behavior of the memory release is also different (see charts below) as there is no visible de-allocation of memory in 1.14.2.
I also tried changing the GOGC to various values but even at 10 the memory did not reach the behavior of 1.13.10 and CPU usage was considerable

go_13_GC_100

Initial run compiled with GO 1.13.10

Same code was compiled and run on the same machine with GOGC values as follows:
go_14_GC_10

GOGC = 10

go_14_GC_50

GOGC = 50

go_14_GC_100

GOGC = 100

go_14_GC_200

GOGC = 200

go_14_GC_500

GOGC = 500

in Issue #37525 @mknyszek mentions that another issue will be opened but I could not find the new issue.

Thanks.

Activity

changed the title [-]Increase in memory usage and behavior upgrading from 1.13.10 to 1.14.2[/-] [+]Increase in memory usage and different GC behavior upgrading from 1.13.10 to 1.14.2[/+] on May 3, 2020
agnivade

agnivade commented on May 3, 2020

@agnivade
Contributor

Would you be able to share the output of setting GODEBUG=gctrace=1,gcpacertrace=1 in 1.13.10 vs 1.14.2 ? That would help us a lot in the investigation. Thanks.

@aclements @mknyszek

changed the title [-]Increase in memory usage and different GC behavior upgrading from 1.13.10 to 1.14.2[/-] [+]runtime: increase in memory usage and different GC behavior upgrading from 1.13.10 to 1.14.2[/+] on May 3, 2020
added
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on May 3, 2020
BorisKozo

BorisKozo commented on May 3, 2020

@BorisKozo
Author

Hi, I generated the traces:
1.13.10
trace_1_13_10.txt

and
1.14.2
trace_1_14_2.txt

Look at the chart for 1.14.2, doesn't appear to be releasing anything and I am running with GOGC=100

2020-05-03_1554

mknyszek

mknyszek commented on May 4, 2020

@mknyszek
Contributor

Regarding memory release, #38617 brought our attention to a bug on Windows where in Go 1.14 the background scavenger wasn't running at all (the synchronous/eager scavenger and debug.FreeOSMemory should still work though). It's not clear to me yet that this is exactly the same problem, but try patching Go with https://golang.org/cl/229997 and see if it helps. Based on the traces you provided, I could see it helping.

Even with that patch, you may not be seeing the same log as in Go 1.13.10 with GODEBUG=gctrace=1 because we moved the scavenge trace under its own flag, which prints once per GC cycle. The flag for Go 1.14+ is GODEBUG=scavtrace=1.

networkimprov

networkimprov commented on May 4, 2020

@networkimprov

@gopherbot add OS-Windows

BorisKozo

BorisKozo commented on May 4, 2020

@BorisKozo
Author

@mknyszek I compiled master at a1ffbe9
and it seems the problem has been resolved.
go_14_fix

Thank you very much!
Which release is this fix planned to?

networkimprov

networkimprov commented on May 4, 2020

@networkimprov

I posted a backport request. If there's no intervening security update, it will land in 1.14.3.

EDIT: #38856

BorisKozo

BorisKozo commented on May 4, 2020

@BorisKozo
Author
locked and limited conversation to collaborators on May 4, 2021
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

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @networkimprov@mknyszek@agnivade@BorisKozo@gopherbot

        Issue actions

          runtime: increase in memory usage and different GC behavior upgrading from 1.13.10 to 1.14.2 · Issue #38827 · golang/go