Skip to content

fatal error: found pointer to free object #68047

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

Closed
ruyi789 opened this issue Jun 18, 2024 · 8 comments
Closed

fatal error: found pointer to free object #68047

ruyi789 opened this issue Jun 18, 2024 · 8 comments
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@ruyi789
Copy link

ruyi789 commented Jun 18, 2024

Go version

none

Output of go env in your module/workspace:

none

What did you do?

none

What did you see happen?

runtime: marked free object in span 0x247f56aa7a8, elemsize=16 freeindex=0 (bad use of unsafe.Pointer? try -d=checkptr)
0xc00031c000 alloc marked
0xc00031c010 alloc marked
0xc00031c020 alloc marked
...
0xc00031ca30 free marked zombie
0x000000c00031ca30: 0x000000c00031ca30 0x0000000000dea7c8
0xc00031ca40 alloc marked
0xc00031ca50 alloc marked
0xc00031ca60 alloc marked
0xc00031ca70 alloc marked
0xc00031ca80 alloc marked
0xc00031ca90 alloc marked
0xc00031caa0 alloc marked
0xc00031cab0 alloc marked
0xc00031cac0 alloc marked
0xc00031cad0 free unmarked
...
0xc00031dff0 free unmarked
fatal error: found pointer to free object

goroutine 3 [running]:
runtime.throw({0xdc1323?, 0xc00031ca40?})
D:/Go/go/src/runtime/panic.go:1077 +0x65 fp=0xc000045d88 sp=0xc000045d58 pc=0x8ef5a5
runtime.(*mspan).reportZombies(0x247f56aa7a8)
D:/Go/go/src/runtime/mgcsweep.go:861 +0x2f6 fp=0xc000045e08 sp=0xc000045d88 pc=0x8db6b6
runtime.(*sweepLocked).sweep(0x1008260?, 0x0)
D:/Go/go/src/runtime/mgcsweep.go:644 +0xa25 fp=0xc000045f28 sp=0xc000045e08 pc=0x8db045
runtime.sweepone()
D:/Go/go/src/runtime/mgcsweep.go:393 +0xd2 fp=0xc000045f80 sp=0xc000045f28 pc=0x8da392
runtime.bgsweep(0x0?)
D:/Go/go/src/runtime/mgcsweep.go:301 +0x105 fp=0xc000045fc8 sp=0xc000045f80 pc=0x8da185
runtime.gcenable.func1()
D:/Go/go/src/runtime/mgc.go:200 +0x25 fp=0xc000045fe0 sp=0xc000045fc8 pc=0x8ce405
runtime.goexit()
D:/Go/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc000045fe8 sp=0xc000045fe0 pc=0x920661
created by runtime.gcenable in goroutine 1
D:/Go/go/src/runtime/mgc.go:200 +0x66

goroutine 1 [running]:
goroutine running on other thread; stack unavailable

goroutine 2 [force gc (idle), 2 minutes]:
runtime.gopark(0xdead48, 0xfeed60, 0x11, 0x14, 0x1)
D:/Go/go/src/runtime/proc.go:398 +0xfc fp=0xc000043f80 sp=0xc000043f50 pc=0x8f20dc
runtime.goparkunlock(0x0?, 0x0?, 0x0?, 0x0?)
D:/Go/go/src/runtime/proc.go:404 +0x25 fp=0xc000043fb0 sp=0xc000043f80 pc=0x8f2165
runtime.forcegchelper()
D:/Go/go/src/runtime/proc.go:322 +0xb5 fp=0xc000043fe0 sp=0xc000043fb0 pc=0x8f1ef5
runtime.goexit()
D:/Go/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc000043fe8 sp=0xc000043fe0 pc=0x920661
created by runtime.init.6 in goroutine 1
D:/Go/go/src/runtime/proc.go:310 +0x1a
...

goroutine 1 [running]:It's my mian thread that executes Tasks() and is not exiting.

0x000000c00031ca30: 0x000000c00031ca30 0x0000000000dea7c8
elemsize=16
type Callback struct {
next *IONode
f unsafe.Pointer
}

This structure, the value of next is fine, it remains in the list chain and is not taken out. [goroutine 1] is executing another Callback. but it prints (goroutine running on other thread; stack unavailable)?
I suspect that the runtime of [goroutine 1] was not detected during GC, causing the list chain to be marked for release?

What did you expect to see?

none

@seankhliao
Copy link
Member

please fill out the bug report template, otherwise, this is not an actionable report.

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 18, 2024
@ruyi789
Copy link
Author

ruyi789 commented Jun 18, 2024

Normal reportZombies, goroutine 1 is printable: https://go.dev/play/p/QQVDvgjATuW

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jun 18, 2024
@ianlancetaylor
Copy link
Contributor

That code breaks the unsafe.Pointer rules. See https://pkg.go.dev/unsafe#Pointer. The statement

    *pr = unsafe.Add(nil, u[4]+size)

effectively converts a uintptr to an unsafe.Pointer, which is not permitted.

@ianlancetaylor ianlancetaylor closed this as not planned Won't fix, can't repro, duplicate, stale Jun 18, 2024
@ruyi789
Copy link
Author

ruyi789 commented Jun 18, 2024

That code breaks the unsafe.Pointer rules. See https://pkg.go.dev/unsafe#Pointer. The statement

    *pr = unsafe.Add(nil, u[4]+size)

effectively converts a uintptr to an unsafe.Pointer, which is not permitted.

This is a test,not the issuse

@ianlancetaylor
Copy link
Contributor

How can we reproduce the problem?

@ruyi789
Copy link
Author

ruyi789 commented Jun 18, 2024

How can we reproduce the problem?

I can't recreate it.

@ianlancetaylor
Copy link
Contributor

The normal cause of these kinds of problems is incorrect use of the unsafe package, or use of C code called via cgo or SWIG that does something unsafe, or a race condition.

If we can't recreate the problem there isn't much we can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants