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

panic with values from background job #1398

Open
hanche opened this issue Sep 20, 2021 · 1 comment
Open

panic with values from background job #1398

hanche opened this issue Sep 20, 2021 · 1 comment
Labels

Comments

@hanche
Copy link
Contributor

hanche commented Sep 20, 2021

The shell panics when a background job tries to send on the values channel:

⬥ { sleep 1; put boom } &
⬥ panic: send on closed channel

goroutine 2875 [running]:
src.elv.sh/pkg/eval.valueOutput.Put(0xc00050d080, 0x0, 0x0, 0x4443880, 0xc000295000, 0x4454901, 0x0)
	src.elv.sh/pkg/eval/port.go:280 +0xa5
src.elv.sh/pkg/eval.put(0xc0002da5b0, 0xc00038a550, 0x1, 0x1, 0x0, 0x0)
	src.elv.sh/pkg/eval/builtin_fn_io.go:95 +0xbe
reflect.Value.call(0x44549c0, 0x4509520, 0x13, 0x44e25b7, 0x4, 0xc00036ea50, 0x2, 0x2, 0x2, 0x18, ...)
	reflect/value.go:476 +0x8e7
reflect.Value.Call(0x44549c0, 0x4509520, 0x13, 0xc00036e810, 0x2, 0x2, 0x1, 0x2, 0x43ab3dc)
	reflect/value.go:337 +0xb9
src.elv.sh/pkg/eval.(*goFn).Call(0xc00013f960, 0xc0002da5b0, 0xc00038a520, 0x1, 0x1, 0xc00036e5d0, 0x0, 0x1)
	src.elv.sh/pkg/eval/go_fn.go:227 +0x658
src.elv.sh/pkg/eval.(*formOp).exec(0xc0002474a0, 0xc0002da5b0, 0x0, 0x0)
	src.elv.sh/pkg/eval/compile_effect.go:377 +0x9a2
src.elv.sh/pkg/eval.(*pipelineOp).exec.func1(0x456e9a0, 0xc0002474a0, 0xc0002da5b0, 0x0, 0xc00038a500, 0xc000295000, 0xc0004281b0)
	src.elv.sh/pkg/eval/compile_effect.go:122 +0x3f
created by src.elv.sh/pkg/eval.(*pipelineOp).exec
	src.elv.sh/pkg/eval/compile_effect.go:121 +0x22c
Exception: elvish exited with 2
[tty 3], line 1: elvish

If you run any nontrivial elvish code in the background, this can easily snag you.

@krader1961
Copy link
Contributor

I reported this bug fifteen months ago in issue #1069. I closed my issue three months ago because it seemed to be fixed. I did not pinpoint the specific change that fixed this bug. I simply verified that I could no longer reproduce this failure when I closed my issue three months ago. However, I can reproduce the bug using my scenario and this one today using an Elvish program built from source as of the time I write this comment.

@xiaq xiaq added the bug label Feb 28, 2022
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

3 participants