Intellij-elixir: Debugger crashes

Created on 23 Jun 2017  ·  22Comments  ·  Source: KronicDeth/intellij-elixir

{"init terminating in do_boot",{noproc,{gen_server,call,[undefined,{get_meta,<0.3.0>},infinity]}}}

erl_crash.dump.zip

Bug

All 22 comments

I actually have no idea how to read erl crash dumps. I'll have to read up on them.

Same here) Maybe debugger has limitations? At my side is Erl 19.0.3, Elixir 1.3.2

If the crash involves erl_anno then it's due to generated line numbers from Elixir and you'll be needing to run Elixir 1.5.0-dev because Elixir before that contained bugs in the code that generated line numbers that erl_anno couldn't handle and so it blew up. I reported (https://github.com/elixir-lang/elixir/issues/6015) the bug against 1.4.2 as it also affects coverage libraries because they also use erl_anno.

Could you try running with elixir 1.5.0-dev built from source and let me know if they problem is still there?

I think i can try the same steps within simple project or in one of the test projects. I'll write as I try

Under 1.5.0.
Also I have Erlang 1.9.3.x & 20.0, seems currently we need 1.9.3.x?

We got it:

It is iconv.

[error] failed to load NIF 
_build/dev/lib/iconv/priv/lib/iconv: Library module name 'iconv' does not match calling module 'dbg_debugged'

=INFO REPORT==== 23-Jun-2017::22:49:17 ===
    application: logger
    exited: stopped
    type: temporary
*DBG* 'Elixir.IntellijElixir.DebugServer' got {'DOWN',#Ref<0.0.4.173>,
                                               process,<0.532.0>,
                                               {#{'__exception__' => true,
                                                  '__struct__' => 'Elixir.Mix.Error',
                                                  message => <<"Could not start application iconv: :iconv_app.start(:normal, []) returned an error: :bad_lib">>,
                                                  mix => true},
                                                [{'Elixir.Mix',raise,1,
                                                  [{file,"lib/mix.ex"},
                                                   {line,279}]},
                                                 {'Elixir.Enum',
                                                  '-each/2-lists^foreach/1-0-',
                                                  2,
                                                  [{file,"lib/enum.ex"},
                                                   {line,676}]},
                                                 {'Elixir.Enum',each,2,
                                                  [{file,"lib/enum.ex"},
                                                   {line,676}]},
                                                 {'Elixir.Mix.Tasks.App.Start',
                                                  start,2,
                                                  [{file,
                                                    "lib/mix/tasks/app.start.ex"},
                                                   {line,97}]},
                                                 {'Elixir.Mix.Tasks.App.Start',
                                                  run,1,
                                                  [{file,
                                                    "lib/mix/tasks/app.start.ex"},
                                                   {line,78}]},
                                                 {'Elixir.Mix.Task',run_task,
                                                  3,
                                                  [{file,"lib/mix/task.ex"},
                                                   {line,301}]},
                                                 {'Elixir.Mix.Tasks.Run',run,
                                                  5,
                                                  [{file,
                                                    "lib/mix/tasks/run.ex"},
                                                   {line,87}]},
                                                 {'Elixir.Mix.Tasks.Run',run,
                                                  1,
                                                  [{file,
                                                    "lib/mix/tasks/run.ex"},
                                                   {line,54}]},
                                                 {'Elixir.Mix.Task',run_task,
                                                  3,
                                                  [{file,"lib/mix/task.ex"},
                                                   {line,301}]}]}}

=ERROR REPORT==== 23-Jun-2017::22:49:17 ===
Error in process <0.532.0> with exit value:
{#{'__exception__' => true,
   '__struct__' => 'Elixir.Mix.Error',
   message => <<"Could not start application iconv: :iconv_app.start(:normal, []) returned an error: :bad_lib">>,
   mix => true},
 [{'Elixir.Mix',raise,1,[{file,"lib/mix.ex"},{line,279}]},
  {'Elixir.Enum','-each/2-lists^foreach/1-0-',2,
                 [{file,"lib/enum.ex"},{line,676}]},
  {'Elixir.Enum',each,2,[{file,"lib/enum.ex"},{line,676}]},
  {'Elixir.Mix.Tasks.App.Start',start,2,
                                [{file,"lib/mix/tasks/app.start.ex"},
                                 {line,97}]},
  {'Elixir.Mix.Tasks.App.Start',run,1,
                                [{file,"lib/mix/tasks/app.start.ex"},
                                 {line,78}]},
  {'Elixir.Mix.Task',run_task,3,[{file,"lib/mix/task.ex"},{line,301}]},
  {'Elixir.Mix.Tasks.Run',run,5,[{file,"lib/mix/tasks/run.ex"},{line,87}]},
  {'Elixir.Mix.Tasks.Run',run,1,[{file,"lib/mix/tasks/run.ex"},{line,54}]},
  {'Elixir.Mix.Task',run_task,3,[{file,"lib/mix/task.ex"},{line,301}]}]}

=ERROR REPORT==== 23-Jun-2017::22:49:17 ===
** Generic server 'Elixir.IntellijElixir.DebugServer' terminating 
** Last message in was {'DOWN',#Ref<0.0.4.173>,process,<0.532.0>,
                           {#{'__exception__' => true,
                              '__struct__' => 'Elixir.Mix.Error',
                              message => <<"Could not start application iconv: :iconv_app.start(:normal, []) returned an error: :bad_lib">>,
                              mix => true},
                            [{'Elixir.Mix',raise,1,
                                 [{file,"lib/mix.ex"},{line,279}]},
                             {'Elixir.Enum','-each/2-lists^foreach/1-0-',2,
                                 [{file,"lib/enum.ex"},{line,676}]},
                             {'Elixir.Enum',each,2,
                                 [{file,"lib/enum.ex"},{line,676}]},
                             {'Elixir.Mix.Tasks.App.Start',start,2,
                                 [{file,"lib/mix/tasks/app.start.ex"},
                                  {line,97}]},
                             {'Elixir.Mix.Tasks.App.Start',run,1,
                                 [{file,"lib/mix/tasks/app.start.ex"},
                                  {line,78}]},
                             {'Elixir.Mix.Task',run_task,3,
                                 [{file,"lib/mix/task.ex"},{line,301}]},
                             {'Elixir.Mix.Tasks.Run',run,5,
                                 [{file,"lib/mix/tasks/run.ex"},{line,87}]},
                             {'Elixir.Mix.Tasks.Run',run,1,
                                 [{file,"lib/mix/tasks/run.ex"},{line,54}]},
                             {'Elixir.Mix.Task',run_task,3,
                                 [{file,"lib/mix/task.ex"},{line,301}]}]}}
** When Server state == #{ref => #Ref<0.0.4.173>,
                          socket => #Port<0.13957>,
                          task => {<<"phoenix.server">>,[]}}
** Reason for termination == 
** {#{'__exception__' => true,
      '__struct__' => 'Elixir.Mix.Error',
      message => <<"Could not start application iconv: :iconv_app.start(:normal, []) returned an error: :bad_lib">>,
      mix => true},
    [{'Elixir.Mix',raise,1,[{file,"lib/mix.ex"},{line,279}]},
     {'Elixir.Enum','-each/2-lists^foreach/1-0-',2,
                    [{file,"lib/enum.ex"},{line,676}]},
     {'Elixir.Enum',each,2,[{file,"lib/enum.ex"},{line,676}]},
     {'Elixir.Mix.Tasks.App.Start',start,2,
                                   [{file,"lib/mix/tasks/app.start.ex"},
                                    {line,97}]},
     {'Elixir.Mix.Tasks.App.Start',run,1,
                                   [{file,"lib/mix/tasks/app.start.ex"},
                                    {line,78}]},
     {'Elixir.Mix.Task',run_task,3,[{file,"lib/mix/task.ex"},{line,301}]},
     {'Elixir.Mix.Tasks.Run',run,5,[{file,"lib/mix/tasks/run.ex"},{line,87}]},
     {'Elixir.Mix.Tasks.Run',run,1,[{file,"lib/mix/tasks/run.ex"},{line,54}]},
     {'Elixir.Mix.Task',run_task,3,[{file,"lib/mix/task.ex"},{line,301}]}]}
** (EXIT from #PID<0.70.0>) an exception was raised:
    ** (Mix.Error) Could not start application iconv: :iconv_app.start(:normal, []) returned an error: :bad_lib
        (mix) lib/mix.ex:279: Mix.raise/1
        (elixir) lib/enum.ex:676: Enum."-each/2-lists^foreach/1-0-"/2
        (elixir) lib/enum.ex:676: Enum.each/2
        (mix) lib/mix/tasks/app.start.ex:97: Mix.Tasks.App.Start.start/2
        (mix) lib/mix/tasks/app.start.ex:78: Mix.Tasks.App.Start.run/1
        (mix) lib/mix/task.ex:301: Mix.Task.run_task/3
        (mix) lib/mix/tasks/run.ex:87: Mix.Tasks.Run.run/5
        (mix) lib/mix/tasks/run.ex:54: Mix.Tasks.Run.run/1
        (mix) lib/mix/task.ex:301: Mix.Task.run_task/3

So options:

  1. Blacklist iconv, so it's not marked as debuggable
  2. Report to upstream that iconv is not debuggable to see if it's something they should fix.

Yeah, just added topic to its repo.
https://github.com/processone/iconv/issues/9

Am, stupid question, how i can blacklist it?)

Blacklist would involve changing the Elixir code for the debugger, so that it doesn't mark iconv as interpretable around here.

  1. I haven't really considered how to do patches locally with an installed plugin, so

    1. If that resource file is a loose file, you can just edit it in the installed location for the plugin. Off the top of my head I don't know where that is.

    2. If it's in a jar, you'd have to unpack, edit, and repack the jar

  2. If you can't do a local patch of the installed plugin, you'd have to roll your own build using the contributing guide. If you get stuck, ask more questions.
  3. Wait for me to get to the bug fixes for the next release. My normal release process is to do one big feature, in this case the formatter from #98, and then try to clear up as many of the bugs as I can for each release, so you'll have to wait awhile for me to get to it since I'm still doing field tests of the formatter for #98.

@KronicDeth ok, wil try to do it manually. Thanks for link to the code.

As i found, debugger sit at: ~/Library/Application Support/IntelliJIdea2017.1/intellij-elixir/classes/debugger

Simply rebuild without packing 👍

hot filter

  defp interpret_modules_in(path) do
    blacklist = get_blacklist()
    path
    |> Path.join("**/*.beam")
    |> Path.wildcard
    |> Enum.map(&(Path.basename(&1, ".beam") |> String.to_atom))
    |> Enum.filter(&(:int.interpretable(&1) == true && !:code.is_sticky(&1) && &1 != __MODULE__))
    |> Enum.filter(&(!Enum.any?(blacklist, fn(x) -> &1 == x end)))
    |> Enum.each(&(:int.ni(&1)))
  end

  defp get_blacklist() do
    blacklist = System.get_env("DEBUG_BLACKLIST") || ""
    blacklist 
      |> String.split(",")
      |> Enum.map(&(String.to_atom(&1)))
  end

Seems it works well. We can filter by __MODULE__ name:)

Is DEBUG_BLACKLIST picked up when you set it in the "Environment variables" of the Run Configuration or does it require setting them in the environment you launch IntelliJ under for it to take effect?

I'm tried with simple Env' vars from run config. And seems it works

Well, if it's works from the Environment variables, then it's good enough to ship as an official feature until I can add a GUI element for blacklisting modules. Can you open a PR with your changes?

Sure, 5 minutes

I have only thing about env vars name. Maybe we need make it more specific? for example MIX_DEBUG_BLACKIST or INTELLIJ_DEBUG_BLACKLIST?

The mix task is called IntellijElixir.DebugTask, so I think INTELLIJ_ELIXIR_DEBUG_BLACKLIST would mostly closely match the naming. MIX_DEBUG_BLACKLIST could collide with other mix based debuggers while INTELLIJ_DEBUG_BLACKLIST makes it seem like it's something in IntelliJ itself and not a plugin and doesn't scope it to Elixir.

Fixed by #717

this happens to me from time to time as well - is there a way for me to bundle the branch @merqlove's work is on (or whatever might include these changes) and test that in my intellij?

Hi,
It is already merged to the master

Best regards,
Alexander Merkulov

3 авг. 2017 г., в 0:40, Justin notifications@github.com написал(а):

this happens to me from time to time as well - is there a way for me to bundle the branch @merqlove's work is on (or whatever might include these changes) and test that in my intellij?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Istiakmorsalin picture Istiakmorsalin  ·  4Comments

KronicDeth picture KronicDeth  ·  3Comments

mjadczak picture mjadczak  ·  6Comments

mbriggs picture mbriggs  ·  5Comments

nhooyr picture nhooyr  ·  7Comments