Unable to kill the VM with Ctrl+C Erlang 21.0.1 and Elixir 1.6.6 on windows

After upgrading to Elixir 1.6.6 on Erlang 21.0.1 on Windows 10, we can no longer kill the VM with Ctrl+C, as we could before.

Anyone notice same?
(Also, i’m using ConEmu, but Ctrl+C worked fine before the update)

1 Like

Same here. Only way was to kill the process from the task manager.

any ideas? whats your setup? which console/terminal do you use?

Exactly like yours. Elixir 1.6.6, OTP 21.0.1, cmd + ConEmu. Still trying to find a solution on the net.

1 Like

Ctrl-C still works fine in erl, so something must have changed in the way those interrupts are processed in comparison to what iex expects. Did it work for you in OTP-20?

@dimitarvp and @CharlesO: can you please try the same with: erl, werl, iex and iex --werl? Which ones Ctrl+C work and which ones it doesn’t?

Testing Ctrl+C on Windows 10, OTP 21.0.1, Elixir 1.6.6 via:
erl not working
werl not applicable*
iex not working
iex --werl not applicable*

not applicable* … we simple close the window, we dont need/use Ctrl+C

Ctrl+C worked fine for all versions of OTP , up to OTP 20.3

What setup of windows console/terminal do you use?

I and @dimitarvp use ConEmu, could that be a factor?

  • erl: Ctrl-C immediately drops you out, no message. But it’s working.
  • werl and iex --werl: Ctrl-C doesn’t work but it doesn’t matter because we can Alt-F4 it, and that’s how I always stop working with werl.
  • iex and iex -S mix: Ctrl-C doesn’t work, only killing the process from task manager or closing the cmd window works.

EDIT 1: My console is actually cmd with the ConEmu wrapper and the clink addon. Here’s what I get when I start cmd on my Win10 box:

Microsoft Windows [Version 10.0.17134.112]
(c) 2018 Microsoft Corporation. All rights reserved.
Clink v0.4.2 [git:1111eb] Copyright (c) 2014 Martin Ridgers
http://mridgers.github.io/clink

EDIT 2: Also tried on a cmd started with administrative rights without ConEmu (clink still is loaded), iex still cannot be killed with Ctrl-C.

1 Like

I could not get Ctrl-C to work at all

The behaviour is the same on cmd.exe and even on the Git bash (i.e. it works for erl but doesn’t for iex), I don’t think it’s related to that.

The Ctrl-C behaviour for erl.exe hasn’t changed, there was no output in earlier versions either.

On werl Ctrl-C never worked AFAICT, neither in Elixir nor in straight Erlang, the “escape key” is Ctrl-G in this case and is handled completely differently.

/EDIT: This is Windows 7, btw.

The behavior has changed… on previous versions i could exit erl with Ctrl-C, i cant do that on OTP 21.0.1

My windows setup has not changed at all since OTP 18, and Ctr-C has worked consistently since then both on erl and iex

I found these 2 simple workarounds for this issue:

  1. enter any character before pressing Ctrl+C
  2. Enter Ctrl+C repeatedly

Thanks everyone for the replies. There is an open issue here: https://github.com/elixir-lang/elixir/issues/7910 - I hvae asked more questions there, your input is welcome.

We need to find out the root cause so we can report this to OTP.

In the interim (or going forward) we could add the +Bc flag to elixir.bat

rem Use +Bc to ensure Ctrl+C always works
set ctrlOn="+Bc"
...
if %useWerl% equ 1 (
  start werl.exe %ext_libs% %ELIXIR_ERL_OPTIONS% %parsErlang% %beforeExtra% -extra %*
) else (
  erl.exe %ext_libs% %ELIXIR_ERL_OPTIONS% %parsErlang% %ctrlOn% %beforeExtra% -extra %*
)

This fixes the issues

1 Like

We don’t know yet what is the root cause of this change of behaviour, so it is best if we identify it first to make sure we not missing anything else.

It seems this is a bug in the new IO polling implementation on Windows.

http://erlang.org/pipermail/erlang-questions/2018-July/095969.html

3 Likes

is there any workaround?

What @CharlesO said doesn’t work for me :frowning:

I’ve been having this same problem on linux (Ubuntu 16.10). I’m not sure how to reproduce it consistently but it does happen.

One thing that works for me is using:
System.halt

1 Like