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

Floating deadlock in errors_must e2e #872

Open
emil14 opened this issue Feb 9, 2025 · 1 comment
Open

Floating deadlock in errors_must e2e #872

emil14 opened this issue Feb 9, 2025 · 1 comment
Assignees
Labels

Comments

@emil14
Copy link
Collaborator

emil14 commented Feb 9, 2025

Trace:

sent | must_handle/handler/__new__1:res | "Hello, io.WriteAll!"
sent | :start | {}
recv | __newv2__1:sig | {}
sent | __newv2__1:res | "create_me.txt"
recv | must_handle/handler/write_all:filename | "create_me.txt"
recv | must_handle/handler/write_all:data | "Hello, io.WriteAll!"
sent | must_handle/handler/__new__1:res | "Hello, io.WriteAll!"
sent | must_handle/handler/write_all:res | {}
recv | must_handle/handler/__del__:data | {}

Stdout:

neva run -trace e2e/errors_must/main
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
github.com/nevalang/neva/internal/runtime.Run({0x10307adb0?, 0x103298fa0?}, {0x1400012c200, 0x1400012c240, {0x14000174000, 0x7, 0x7}}, 0x14000124e10)
        /Users/emil/projects/neva/tmp/runtime/runtime.go:43 +0x230
main.main()
        /Users/emil/projects/neva/tmp/main.go:144 +0x10e0

goroutine 35 [select]:
github.com/nevalang/neva/internal/runtime.SingleInport.Receive({0x1400010a1c0, {{0x102f592eb, 0x3}, {0x102f59462, 0x4}}, {0x103079760, 0x1400011c038}}, {0x10307ae58?, 0x1400017c000?})
        /Users/emil/projects/neva/tmp/runtime/program.go:94 +0x8c
github.com/nevalang/neva/internal/runtime.Run.func1()
        /Users/emil/projects/neva/tmp/runtime/runtime.go:21 +0x74
created by github.com/nevalang/neva/internal/runtime.Run in goroutine 1
        /Users/emil/projects/neva/tmp/runtime/runtime.go:20 +0xe8

goroutine 36 [semacquire]:
sync.runtime_Semacquire(0x1400012a540?)
        /opt/homebrew/Cellar/go/1.23.6/libexec/src/runtime/sema.go:71 +0x2c
sync.(*WaitGroup).Wait(0x1400000e110)
        /opt/homebrew/Cellar/go/1.23.6/libexec/src/sync/waitgroup.go:118 +0x74
github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1({0x10307ae20, 0x14000200000})
        /Users/emil/projects/neva/tmp/runtime/runtime.go:67 +0xe8
github.com/nevalang/neva/internal/runtime.Run.func2()
        /Users/emil/projects/neva/tmp/runtime/runtime.go:34 +0x5c
created by github.com/nevalang/neva/internal/runtime.Run in goroutine 1
        /Users/emil/projects/neva/tmp/runtime/runtime.go:32 +0x190

goroutine 4 [select]:
github.com/nevalang/neva/internal/runtime.SingleInport.Receive({0x1400010a150, {{0x102f5bac2, 0xd}, {0x102f592ee, 0x3}}, {0x103079760, 0x1400011c038}}, {0x10307ae20?, 0x14000200000?})
        /Users/emil/projects/neva/tmp/runtime/program.go:94 +0x8c
github.com/nevalang/neva/internal/runtime/funcs.newV2.Create.func1({0x10307ae20, 0x14000200000})
        /Users/emil/projects/neva/tmp/runtime/funcs/new_v2.go:24 +0x74
github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1.1()
        /Users/emil/projects/neva/tmp/runtime/runtime.go:63 +0x34
created by github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1 in goroutine 36
        /Users/emil/projects/neva/tmp/runtime/runtime.go:62 +0x68

goroutine 5 [select]:
github.com/nevalang/neva/internal/runtime.SingleInport.Receive({0x1400010a3f0, {{0x102f5aa70, 0xa}, {0x102f59466, 0x4}}, {0x103079760, 0x1400011c038}}, {0x10307ae20?, 0x14000200000?})
        /Users/emil/projects/neva/tmp/runtime/program.go:94 +0x8c
github.com/nevalang/neva/internal/runtime/funcs.println.Create.func1({0x10307ae20, 0x14000200000})
        /Users/emil/projects/neva/tmp/runtime/funcs/println.go:25 +0x68
github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1.1()
        /Users/emil/projects/neva/tmp/runtime/runtime.go:63 +0x34
created by github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1 in goroutine 36
        /Users/emil/projects/neva/tmp/runtime/runtime.go:62 +0x68

goroutine 6 [select]:
github.com/nevalang/neva/internal/runtime.SingleInport.Receive({0x1400010a2a0, {{0x102f63e86, 0x20}, {0x102f5a06c, 0x8}}, {0x103079760, 0x1400011c038}}, {0x10307ae20?, 0x14000200000?})
        /Users/emil/projects/neva/tmp/runtime/program.go:94 +0x8c
github.com/nevalang/neva/internal/runtime/funcs.writeAll.Create.func1({0x10307ae20, 0x14000200000})
        /Users/emil/projects/neva/tmp/runtime/funcs/write_all.go:35 +0x6c
github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1.1()
        /Users/emil/projects/neva/tmp/runtime/runtime.go:63 +0x34
created by github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1 in goroutine 36
        /Users/emil/projects/neva/tmp/runtime/runtime.go:62 +0x68

goroutine 7 [select]:
github.com/nevalang/neva/internal/runtime.SingleOutport.Send({{{0x102f63ea6, 0x20}, {0x102f592f1, 0x3}}, {0x103079760, 0x1400011c038}, 0x1400010a380}, {0x10307ae20, 0x14000200000}, {0x10307c8e0?, ...})
        /Users/emil/projects/neva/tmp/runtime/program.go:375 +0x118
github.com/nevalang/neva/internal/runtime/funcs.new.Create.func1({0x10307ae20, 0x14000200000})
        /Users/emil/projects/neva/tmp/runtime/funcs/new.go:19 +0x7c
github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1.1()
        /Users/emil/projects/neva/tmp/runtime/runtime.go:63 +0x34
created by github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1 in goroutine 36
        /Users/emil/projects/neva/tmp/runtime/runtime.go:62 +0x68

goroutine 8 [select]:
github.com/nevalang/neva/internal/runtime.SingleInport.Receive({0x1400010a310, {{0x102f62fa2, 0x1e}, {0x102f59466, 0x4}}, {0x103079760, 0x1400011c038}}, {0x10307ae20?, 0x14000200000?})
        /Users/emil/projects/neva/tmp/runtime/program.go:94 +0x8c
github.com/nevalang/neva/internal/runtime/funcs.del.Create.func1({0x10307ae20, 0x14000200000})
        /Users/emil/projects/neva/tmp/runtime/funcs/del.go:19 +0x64
github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1.1()
        /Users/emil/projects/neva/tmp/runtime/runtime.go:63 +0x34
created by github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1 in goroutine 36
        /Users/emil/projects/neva/tmp/runtime/runtime.go:62 +0x68

goroutine 9 [select]:
github.com/nevalang/neva/internal/runtime.SingleInport.Receive({0x1400010a460, {{0x102f5e5fe, 0x14}, {0x102f59466, 0x4}}, {0x103079760, 0x1400011c038}}, {0x10307ae20?, 0x14000200000?})
        /Users/emil/projects/neva/tmp/runtime/program.go:94 +0x8c
github.com/nevalang/neva/internal/runtime/funcs.panicker.Create.func1({0x10307ae20, 0x14000200000})
        /Users/emil/projects/neva/tmp/runtime/funcs/panic.go:23 +0x54
github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1.1()
        /Users/emil/projects/neva/tmp/runtime/runtime.go:63 +0x34
created by github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1 in goroutine 36
        /Users/emil/projects/neva/tmp/runtime/runtime.go:62 +0x68

goroutine 10 [select]:
github.com/nevalang/neva/internal/runtime.SingleInport.Receive({0x1400010a230, {{0x102f5bacf, 0xd}, {0x102f592ee, 0x3}}, {0x103079760, 0x1400011c038}}, {0x10307ae20?, 0x14000200000?})
        /Users/emil/projects/neva/tmp/runtime/program.go:94 +0x8c
github.com/nevalang/neva/internal/runtime/funcs.newV2.Create.func1({0x10307ae20, 0x14000200000})
        /Users/emil/projects/neva/tmp/runtime/funcs/new_v2.go:24 +0x74
github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1.1()
        /Users/emil/projects/neva/tmp/runtime/runtime.go:63 +0x34
created by github.com/nevalang/neva/internal/runtime.deferFuncCalls.func1 in goroutine 36
        /Users/emil/projects/neva/tmp/runtime/runtime.go:62 +0x68
failed to run generated executable: exit status 2

Test:

	for i := 0; i < 100; i++ {
		cmd := exec.Command("neva", "run", "main")

		out, err := cmd.CombinedOutput()
		require.NoError(t, err, "iteration %d", i, string(out))
		require.Equal(
			t,
			"success!\n",
			string(out),
		)

		require.Equal(t, 0, cmd.ProcessState.ExitCode())
	}
@emil14 emil14 added the Critical label Feb 9, 2025
@emil14 emil14 self-assigned this Feb 9, 2025
@emil14
Copy link
Collaborator Author

emil14 commented Feb 10, 2025

Last lines of the trace

sent | must_handle/handler/write_all:res | {}
recv | must_handle/handler/__del__:data | {}

looks like write_all -> :res connection didn't worked out - write_all:res sent a message but compiler thought it's not used? and inserted __del__ node

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

No branches or pull requests

1 participant