elixir icon indicating copy to clipboard operation
elixir copied to clipboard

Infinite loop when compiling eex template

Open lukaszsamson opened this issue 9 years ago • 2 comments

When compiling eex template with syntax error - missing do in if expression

<%= if @condition %>
<% else %>
<% end %>

the compiler hangs in infinite loop. The same happens with unless and for

Environment

  • Elixir & Erlang versions (elixir --version): elixir 1.5.1, erlang 20.0.5
  • Operating system: macOS 10.12.6

Current behavior

Infinite loop with 100% CPU usage outputting

warning: unexpected beginning of EEx tag "<%" on "<% else %>", please remove "" accordingly
  web/templates/my_bad.html.eex:2

Expected behavior

No infinite loop Severity should be error

lukaszsamson avatar Sep 27 '17 12:09 lukaszsamson

I've also experienced this, sucks when it brings down my dev server and I have to restart it because I forgot a do. ^.^;

OvermindDL1 avatar Sep 27 '17 15:09 OvermindDL1

This issue is really easy to reproduce on terminal

$ elixir -e 'EEx.eval_string ~S{
              <% if true %>
                foo
              <% else %>
                bar
              <% end %>}'

pedrosnk avatar Sep 27 '17 19:09 pedrosnk