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

Test "cancels stale events on channel close" hangs on macOS when coreutils is installed via brew (or nix) #13858

Open
mjlbach opened this issue Jan 31, 2021 · 3 comments
Labels
bug issues reporting wrong behavior test

Comments

@mjlbach
Copy link
Contributor

mjlbach commented Jan 31, 2021

  • nvim --version: nightly (commit e85c8df)
  • vim -u DEFAULTS (version: ) behaves differently? No
  • Operating system/version: macOS
  • Terminal name/version: iterm
  • $TERM: xterm-256color

Steps to reproduce using nvim -u NORC

brew install coreutils  # or nix-env -iA nixpkgs.coreutils
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
TEST_FILE="test/functional/api/server_notifications_spec.lua" make test

Actual behaviour

Test hangs

Expected behaviour

Test doesn't hang

@mjlbach mjlbach added the bug issues reporting wrong behavior label Jan 31, 2021
@mjlbach mjlbach changed the title Test "notify cancels stale events on channel close" hangs on macOS Test "cancels stale events on channel close" hangs on macOS Jan 31, 2021
@mjlbach mjlbach changed the title Test "cancels stale events on channel close" hangs on macOS Test "cancels stale events on channel close" hangs on macOS when coreutils is installed via nix Jan 31, 2021
@mjlbach

This comment has been minimized.

@mjlbach mjlbach closed this as completed Jan 31, 2021
@mjlbach mjlbach changed the title Test "cancels stale events on channel close" hangs on macOS when coreutils is installed via nix Test "cancels stale events on channel close" hangs on macOS when coreutils is installed via brew (or nix) Jan 31, 2021
@mjlbach mjlbach reopened this Jan 31, 2021
@bfredl
Copy link
Member

bfredl commented Feb 1, 2021

your cat is too fast.

Seems like a hidden timing issue (ideally the test should not depend on timing at all)

@mjlbach
Copy link
Contributor Author

mjlbach commented Feb 1, 2021

I'm not sure I really understand this test

  it('cancels stale events on channel close', function()
    if helpers.pending_win32(pending) then return end
    local catchan = eval("jobstart(['cat'], {'rpc': v:true})")
    eq({id=catchan, stream='job', mode='rpc', client = {}}, exec_lua ([[
      vim.rpcnotify(..., "nvim_call_function", 'chanclose', {..., 'rpc'})
      vim.rpcnotify(..., "nvim_subscribe", "daily_rant")
      return vim.api.nvim_get_chan_info(...)
    ]], catchan))
    eq(2, eval('1+1'))  -- Still alive?
    eq({false, 'Invalid channel: '..catchan},
      exec_lua ([[ return {pcall(vim.rpcrequest, ..., 'nvim_eval', '1+1')}]], catchan))
    retry(nil, 3000, function() eq({}, meths.get_chan_info(catchan)) end) -- cat be dead :(
  end)

Seems like it's trying to send a message to a closed channel. If I run the following excerpt via luafile, it also hangs (including on linux).

local catchan = vim.fn.jobstart({'cat'}, {rpc = true})
vim.rpcnotify(catchan, "nvim_call_function", 'chanclose', {catchan, 'rpc'})
vim.rpcnotify(catchan, "nvim_subscribe", "daily_rant")
print(vim.inspect(vim.api.nvim_get_chan_info(catchan)))
print(1+1)
pcall(vim.rpcrequest, catchan, 'nvim_eval', '1+1')

@zeertzjq zeertzjq added the test label Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior test
Projects
None yet
Development

No branches or pull requests

3 participants