[BUG] Job: `cannot resume dead coroutine` with `maximum-results`
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the failure with the provided Job example, then inspect lua/plenary/job.lua around shutdown at line 218 and the callback near line 343. Trace how vim.wait and cleanup interact when find reports permission errors with maximum_results. Done means this scenario completes without the cannot resume dead coroutine error.
Written by the indexing model from the issue text.
Description
I found a bug with the Job class: if you set maximum_results and the process encounters an error during execution, you will get this error message:
Error executing luv callback:
cannot resume dead coroutine
stack traceback:
[builtin#36]: at 0x57ac5f2f4ad0
[C]: in function 'wait'
.../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:218: in function 'shutdown'
.../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:343: in function <.../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:342>
You can recreate it reliably with this example:
local Job = require("plenary.job")
Job:new({
command = "find",
args = {"/", "-iname", "e"},
maximum_results = 10,
on_start = function ()
print("start")
end,
on_stdout = function(_, data, _)
print(data)
end,
on_stderr = function(_, data, _)
print(data)
end,
on_exit = function(_, code, _)
print("exit", code)
end,
}):start()
I am trying to fix it but it's proving more difficult than I anticipated. As far as I can see, the error is caused by vim.wait returning after everything has already been cleaned up. It will work fine for a normally executing process with a clean exit, but not in this situation where a process has errors. At least this applies to using the find command when it searches directories that you don't have permissions to.
- Dominant language
- Lua
- Stars
- 3.5k
- Forks
- 340
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nvim-lua/plenary.nvim
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
nvim-lua/plenary.nvim#682 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
nvim-lua/plenary.nvim#680 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
nvim-lua/plenary.nvim#675 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
nvim-lua/plenary.nvim#672 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
nvim-lua/plenary.nvim#671 · 1 comment ·
All issues in nvim-lua/plenary.nvim
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
[Eco] Egg Config Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
pterodactyl/game-eggs#634 ·
-
Feature Request
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Questie/QuestieTrace#33 ·