Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: runtime: out of memory #30

Open
meokey opened this issue Sep 22, 2023 · 7 comments
Open

fatal error: runtime: out of memory #30

meokey opened this issue Sep 22, 2023 · 7 comments

Comments

@meokey
Copy link

meokey commented Sep 22, 2023

The error occurs on Synology DSM 7 x86 often when I scan a folder with bunch of files:

fatal error: runtime: out of memory

runtime stack:
runtime.throw({0x836229?, 0x0?})
/usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0xc00005fdf8 sp=0xc00005fdc8 pc=0x43505d
runtime.sysMapOS(0xc2b1c00000, 0x25c400000?)
/usr/local/go/src/runtime/mem_linux.go:187 +0x11b fp=0xc00005fe40 sp=0xc00005fdf8 pc=0x417e5b
runtime.sysMap(0xb5a400?, 0xc3ffffffff?, 0xb6a598?)
/usr/local/go/src/runtime/mem.go:142 +0x35 fp=0xc00005fe70 sp=0xc00005fe40 pc=0x417835
runtime.(*mheap).grow(0xb5a400, 0x12e1d7?)
/usr/local/go/src/runtime/mheap.go:1522 +0x245 fp=0xc00005fee8 sp=0xc00005fe70 pc=0x427f85
runtime.(*mheap).allocSpan(0xb5a400, 0x12e1d7, 0x0, 0x4f?)
/usr/local/go/src/runtime/mheap.go:1243 +0x1b7 fp=0xc00005ff80 sp=0xc00005fee8 pc=0x4276d7
runtime.(*mheap).alloc.func1()
/usr/local/go/src/runtime/mheap.go:961 +0x65 fp=0xc00005ffc8 sp=0xc00005ff80 pc=0x427185
runtime.systemstack()
/usr/local/go/src/runtime/asm_amd64.s:496 +0x49 fp=0xc00005ffd0 sp=0xc00005ffc8 pc=0x4643e9

goroutine 1 [running]:
runtime.systemstack_switch()
/usr/local/go/src/runtime/asm_amd64.s:463 fp=0xc0001918f0 sp=0xc0001918e8 pc=0x464380
runtime.(*mheap).alloc(0x25c3ae000?, 0x12e1d7?, 0x38?)
/usr/local/go/src/runtime/mheap.go:955 +0x65 fp=0xc000191938 sp=0xc0001918f0 pc=0x4270c5
runtime.(*mcache).allocLarge(0xc00004e400?, 0x25c3add36, 0x1)
/usr/local/go/src/runtime/mcache.go:234 +0x85 fp=0xc000191980 sp=0xc000191938 pc=0x4168c5
runtime.mallocgc(0x25c3add36, 0x7b1da0, 0x1)
/usr/local/go/src/runtime/malloc.go:1053 +0x4f7 fp=0xc0001919e8 sp=0xc000191980 pc=0x40d7d7
runtime.makeslice(0xc05ddee128?, 0x3b?, 0x0?)
/usr/local/go/src/runtime/slice.go:103 +0x52 fp=0xc000191a10 sp=0xc0001919e8 pc=0x44bfb2
os.ReadFile({0x7ffe809a056b?, 0x7ffe809a052e?})
/usr/local/go/src/os/file.go:698 +0xeb fp=0xc000191ae8 sp=0xc000191a10 pc=0x4ef80b
main.walk(0xc000007ba0, 0x4?, {0x7ffe809a056b, 0x3b}, 0x1)
/home/shenwei/go/src/github.com/shenwei356/brename/brename.go:1201 +0x86 fp=0xc000191d70 sp=0xc000191ae8 pc=0x782746
main.glob..func1(0xb3acc0?, {0xc000024600, 0x119, 0x11e})
/home/shenwei/go/src/github.com/shenwei356/brename/brename.go:888 +0x71a fp=0xc00019bd38 sp=0xc000191d70 pc=0x77e95a
github.com/spf13/cobra.(*Command).execute(0xb3acc0, {0xc000023310, 0x11e, 0x12f})
/home/shenwei/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:920 +0x847 fp=0xc00019be70 sp=0xc00019bd38 pc=0x76c487
github.com/spf13/cobra.(*Command).ExecuteC(0xb3acc0)
/home/shenwei/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd fp=0xc00019bf28 sp=0xc00019be70 pc=0x76cd1d
github.com/spf13/cobra.(*Command).Execute(...)
/home/shenwei/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
main.main()
/home/shenwei/go/src/github.com/shenwei356/brename/brename.go:557 +0x25 fp=0xc00019bf80 sp=0xc00019bf28 pc=0x77d665
runtime.main()
/usr/local/go/src/runtime/proc.go:250 +0x207 fp=0xc00019bfe0 sp=0xc00019bf80 pc=0x437947
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00019bfe8 sp=0xc00019bfe0 pc=0x466461

goroutine 2 [force gc (idle), 4 minutes]:
runtime.gopark(0x85a767a350f3b?, 0xb401c0?, 0x11?, 0x14?, 0x1?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00004afb0 sp=0xc00004af90 pc=0x437d76
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:387
runtime.forcegchelper()
/usr/local/go/src/runtime/proc.go:305 +0xb0 fp=0xc00004afe0 sp=0xc00004afb0 pc=0x437bb0
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00004afe8 sp=0xc00004afe0 pc=0x466461
created by runtime.init.6
/usr/local/go/src/runtime/proc.go:293 +0x25

goroutine 3 [GC sweep wait]:
runtime.gopark(0x1?, 0x0?, 0x0?, 0x0?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00004b780 sp=0xc00004b760 pc=0x437d76
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:387
runtime.bgsweep(0x0?)
/usr/local/go/src/runtime/mgcsweep.go:319 +0xde fp=0xc00004b7c8 sp=0xc00004b780 pc=0x423ffe
runtime.gcenable.func1()
/usr/local/go/src/runtime/mgc.go:178 +0x26 fp=0xc00004b7e0 sp=0xc00004b7c8 pc=0x419286
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00004b7e8 sp=0xc00004b7e0 pc=0x466461
created by runtime.gcenable
/usr/local/go/src/runtime/mgc.go:178 +0x6b

goroutine 4 [GC scavenge wait]:
runtime.gopark(0x85a775cea9171?, 0x103776?, 0x0?, 0x0?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00004bf70 sp=0xc00004bf50 pc=0x437d76
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:387
runtime.(*scavengerState).park(0xb40d80)
/usr/local/go/src/runtime/mgcscavenge.go:400 +0x53 fp=0xc00004bfa0 sp=0xc00004bf70 pc=0x421ef3
runtime.bgscavenge(0x0?)
/usr/local/go/src/runtime/mgcscavenge.go:633 +0x65 fp=0xc00004bfc8 sp=0xc00004bfa0 pc=0x4224e5
runtime.gcenable.func2()
/usr/local/go/src/runtime/mgc.go:179 +0x26 fp=0xc00004bfe0 sp=0xc00004bfc8 pc=0x419226
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00004bfe8 sp=0xc00004bfe0 pc=0x466461
created by runtime.gcenable
/usr/local/go/src/runtime/mgc.go:179 +0xaa

goroutine 5 [finalizer wait, 22 minutes]:
runtime.gopark(0x4380f2?, 0x7f41b3b4aa48?, 0x0?, 0x0?, 0xc00004a770?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00004a628 sp=0xc00004a608 pc=0x437d76
runtime.runfinq()
/usr/local/go/src/runtime/mfinal.go:193 +0x107 fp=0xc00004a7e0 sp=0xc00004a628 pc=0x4182c7
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00004a7e8 sp=0xc00004a7e0 pc=0x466461
created by runtime.createfing
/usr/local/go/src/runtime/mfinal.go:163 +0x45

goroutine 6 [runnable]:
runtime.gcTrigger.test({0x0?, 0x0?, 0x0?})
/usr/local/go/src/runtime/mgc.go:547 +0xfb fp=0xc00008fdd0 sp=0xc00008fdc8 pc=0x41967b
runtime.mallocgc(0x10, 0x7b1ae0, 0x1)
/usr/local/go/src/runtime/malloc.go:1171 +0x768 fp=0xc00008fe38 sp=0xc00008fdd0 pc=0x40da48
runtime.newobject(0xc00007b260?)
/usr/local/go/src/runtime/malloc.go:1254 +0x27 fp=0xc00008fe60 sp=0xc00008fe38 pc=0x40dcc7
main.glob..func1.2()
/home/shenwei/go/src/github.com/shenwei356/brename/brename.go:821 +0x178 fp=0xc00008ffe0 sp=0xc00008fe60 pc=0x77fed8
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00008ffe8 sp=0xc00008ffe0 pc=0x466461
created by main.glob..func1
/home/shenwei/go/src/github.com/shenwei356/brename/brename.go:798 +0x42c

goroutine 7 [GC worker (idle)]:
runtime.gopark(0x8740b8?, 0xc05ddd8000?, 0x1a?, 0x14?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00004cf50 sp=0xc00004cf30 pc=0x437d76
runtime.gcBgMarkWorker()
/usr/local/go/src/runtime/mgc.go:1275 +0xf1 fp=0xc00004cfe0 sp=0xc00004cf50 pc=0x41aff1
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00004cfe8 sp=0xc00004cfe0 pc=0x466461
created by runtime.gcBgMarkStartWorkers
/usr/local/go/src/runtime/mgc.go:1199 +0x25

goroutine 17 [GC worker (idle), 10 minutes]:
runtime.gopark(0x85a01ae1947bf?, 0x3?, 0xc9?, 0x40?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000046750 sp=0xc000046730 pc=0x437d76
runtime.gcBgMarkWorker()
/usr/local/go/src/runtime/mgc.go:1275 +0xf1 fp=0xc0000467e0 sp=0xc000046750 pc=0x41aff1
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000467e8 sp=0xc0000467e0 pc=0x466461
created by runtime.gcBgMarkStartWorkers
/usr/local/go/src/runtime/mgc.go:1199 +0x25

goroutine 33 [GC worker (idle), 14 minutes]:
runtime.gopark(0xb72240?, 0x3?, 0x93?, 0xd1?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00004c750 sp=0xc00004c730 pc=0x437d76
runtime.gcBgMarkWorker()
/usr/local/go/src/runtime/mgc.go:1275 +0xf1 fp=0xc00004c7e0 sp=0xc00004c750 pc=0x41aff1
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00004c7e8 sp=0xc00004c7e0 pc=0x466461
created by runtime.gcBgMarkStartWorkers
/usr/local/go/src/runtime/mgc.go:1199 +0x25

goroutine 18 [GC worker (idle)]:
runtime.gopark(0x85a76dd501994?, 0x3?, 0x8c?, 0x8f?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000046f50 sp=0xc000046f30 pc=0x437d76
runtime.gcBgMarkWorker()
/usr/local/go/src/runtime/mgc.go:1275 +0xf1 fp=0xc000046fe0 sp=0xc000046f50 pc=0x41aff1
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000046fe8 sp=0xc000046fe0 pc=0x466461
created by runtime.gcBgMarkStartWorkers
/usr/local/go/src/runtime/mgc.go:1199 +0x25

@shenwei356
Copy link
Owner

weird, what's the command?

@meokey
Copy link
Author

meokey commented Sep 22, 2023

something like
brename --only-dir -p "[\.\_]((19|20)\d\d)[\.\_]" -r ".(\$1)." *

@meokey
Copy link
Author

meokey commented Sep 22, 2023

and I notice that it takes no time to find files/dirs to be rename, but generally takes 3-10 seconds if not more to rename one

@shenwei356
Copy link
Owner

In my test of scanning my whole disk, it only occupied less than 20MB of memory. Does the machine have a small RAM?

@shenwei356
Copy link
Owner

and I notice that it takes no time to find files/dirs to be rename, but generally takes 3-10 seconds if not more to rename one

I'm not sure about why.

@meokey
Copy link
Author

meokey commented Sep 25, 2023

In my test of scanning my whole disk, it only occupied less than 20MB of memory. Does the machine have a small RAM?

no, it's 8GB in totoal RAM on the NAS and there are still 2GB spare memory when running brename.

I notice that, in the error messaages, there is some weird reference like below - why your home directory is referred here? Could it be the clause of failure?

main.walk(0xc000007ba0, 0x4?, {0x7ffe809a056b, 0x3b}, 0x1) /home/shenwei/go/src/github.com/shenwei356/brename/brename.go:1201 +0x86 fp=0xc000191d70 sp=0xc000191ae8 pc=0x782746

@shenwei356
Copy link
Owner

why your home directory is referred here?

The Go compiler save path of source code to help debugging, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants