intellij-erlang icon indicating copy to clipboard operation
intellij-erlang copied to clipboard

Debugger Crashes with Simple Input

Open ja-b opened this issue 10 years ago • 12 comments

OS Version: Ubuntu 14.04 Erlang Version: Erlang R16B03 (erts-5.10.4) Immediate Trace: {"init terminating in do_boot",{undef,[{int,stop,[],[]},{debugnode,stop_debugger,0,[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

I have no idea how to proceed from here, as I am very new to erlang. I cannot get the debugger to run on a simple hello world script (that otherwise runs fine in normal execution).

ja-b avatar Oct 15 '14 20:10 ja-b

Hi Jacob!

Could you show me the command you're using to start the script? You can find it right on top of the trace you've pasted above. Thanks.

deadok22 avatar Oct 15 '14 20:10 deadok22

/usr/lib/erlang/bin/erl -pa /tmp/intellij_erlang_debugger_569437175345963141.tmp -pa /home/jacob/development/erlang_world/out/production/erlang_world -pa /home/jacob/development/erlang_world -sname test_node1413405515195 -run debugnode main idea_dbg_1413405515191 idea_dbg_box -noshell -s init stop

Let me know if there's anyway I can help, thanks!

ja-b avatar Oct 16 '14 12:10 ja-b

Hi @jacobabennett,

Could you please share debugger logs as described here: https://github.com/ignatov/intellij-erlang/issues/512 ?

deadok22 avatar Nov 26 '14 11:11 deadok22

The same problem in Idea 2016.1 on Linux x86_64:

To reproduce create simple Erlang module:

-module(mymodule).
-export([start/0]).
start() -> io:format("Hello, World!").

Got:

/usr/lib64/erlang/bin/erl -pa /tmp/intellij_erlang_debugger_1 -pa /home/victor/Yandex.Disk/simple_erl_run/out/production/simple_erl_run -pa /home/victor/Yandex.Disk/simple_erl_run -run debugnode main 47588 -noshell -s init stop

Crash dump is being written to: erl_crash.dump...{"init terminating in do_boot",{undef,[{int,stop,[],[]},{debugnode,stop_debugger,0,[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

idea.log contents after "Debug" button pressed:

2016-03-28 15:24:52,318 [ 259103]   INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED (BUILD PROCESS) 
2016-03-28 15:24:52,319 [ 259104]   INFO - PrepareDependenciesCompileTask - Prepare build order for project simple_erl_run 
2016-03-28 15:24:52,322 [ 259107]   INFO - j.compiler.server.BuildManager - Using preloaded build process to compile /home/victor/Yandex.Disk/simple_erl_run 
2016-03-28 15:24:52,486 [ 259271]   INFO - lij.compiler.impl.CompilerUtil -     COMPILATION FINISHED (BUILD PROCESS); Errors: 0; warnings: 0 took 174 ms: 0 min 0sec 
2016-03-28 15:24:52,488 [ 259273]  DEBUG - ang.debugger.ErlangDebuggerLog - Starting debugger server. 
2016-03-28 15:24:52,488 [ 259273]  DEBUG - ang.debugger.ErlangDebuggerLog - Opening a server socket. 
2016-03-28 15:24:52,488 [ 259273]  DEBUG - ang.debugger.ErlangDebuggerLog - Listening on port 34470. 
2016-03-28 15:24:52,488 [ 259273]  DEBUG - ang.debugger.ErlangDebuggerLog - Preparing to run debug target. 
2016-03-28 15:24:52,488 [ 259273]  DEBUG - ang.debugger.ErlangDebuggerLog - Setting up debugger environment. 
2016-03-28 15:24:52,493 [ 259278]  DEBUG - ang.debugger.ErlangDebuggerLog - Debugger beams will be put to: /tmp/intellij_erlang_debugger_2 
2016-03-28 15:24:52,493 [ 259278]  DEBUG - ang.debugger.ErlangDebuggerLog - Debugger beams were copied successfully. 
2016-03-28 15:24:52,494 [ 259279]  DEBUG - ang.debugger.ErlangDebuggerLog - Running debugger process. Command line (platform-independent):  
2016-03-28 15:24:52,494 [ 259279]  DEBUG - ang.debugger.ErlangDebuggerLog - /usr/lib64/erlang/bin/erl -pa /tmp/intellij_erlang_debugger_2 -pa /home/victor/Yandex.Disk/simple_erl_run/out/production/simple_erl_run -pa /home/victor/Yandex.Disk/simple_erl_run -run debugnode main 34470 -noshell -s init stop 
2016-03-28 15:24:52,495 [ 259280]  DEBUG - ang.debugger.ErlangDebuggerLog - Debugger process started. 
2016-03-28 15:24:52,495 [ 259280]  DEBUG - ang.debugger.ErlangDebuggerLog - Initializing local debugging. 
2016-03-28 15:24:52,495 [ 259280]  DEBUG - ang.debugger.ErlangDebuggerLog - Entry point: mymodule:start() 
2016-03-28 15:24:52,495 [ 259280]  DEBUG - ang.debugger.ErlangDebuggerLog - Debug target should now be running. 
2016-03-28 15:24:52,533 [ 259318]   INFO - ntellij.util.io.BaseDataReader - Stream closed 
java.io.IOException: Stream closed
        at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:336)
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
        at java.io.InputStreamReader.read(InputStreamReader.java:184)
        at java.io.Reader.read(Reader.java:140)
        at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:96)
        at com.intellij.util.io.BaseOutputReader.readAvailable(BaseOutputReader.java:137)
        at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:129)
        at com.intellij.util.io.BaseDataReader$1.run(BaseDataReader.java:61)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
2016-03-28 15:24:52,533 [ 259318]   INFO - ntellij.util.io.BaseDataReader - Stream closed 
java.io.IOException: Stream closed
        at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:336)
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
        at java.io.InputStreamReader.read(InputStreamReader.java:184)
        at java.io.Reader.read(Reader.java:140)
        at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:96)
        at com.intellij.util.io.BaseOutputReader.readAvailable(BaseOutputReader.java:137)
        at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:129)
        at com.intellij.util.io.BaseDataReader$1.run(BaseDataReader.java:61)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
2016-03-28 15:24:52,539 [ 259324]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [system]: /opt/jetbrains/idea-IU-145.258.11/jre/jre/bin/java -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs=\"\" -Djdt.compiler.useSingleThread=true -Dpreload.project.path=/home/victor/Yandex.Disk/simple_erl_run -Dpreload.config.path=/home/victor/.IntelliJIdea2016.1/config/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djava.net.preferIPv4Stack=true -Dio.netty.initialSeedUniquifier=-2241046818226161497 -Dfile.encoding=UTF-8 -Djps.file.types.component.name=FileTypeManager -Duser.language=en -Duser.country=US -Didea.paths.selector=IntelliJIdea2016.1 -Didea.home.path=/opt/jetbrains/idea-IU-145.258.11 -Didea.config.path=/home/victor/.IntelliJIdea2016.1/config -Didea.plugins.path=/home/victor/.IntelliJIdea2016.1/config/plugins -Djps.log.dir=/home/victor/.IntelliJIdea2016.1/system/log/build-log -Djava.io.tmpdir=/home/victor/.IntelliJIdea2016.1/system/compile-server/_temp_ -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path=\"/tmp/kotlin-idea-7607831427769403084-is-running\" -classpath /opt/jetbrains/idea-IU-145.258.11/lib/jps-launcher.jar:/opt/jetbrains/idea-IU-145.258.11/jre/lib/tools.jar:/opt/jetbrains/idea-IU-145.258.11/lib/optimizedFileManager.jar:/opt/jetbrains/idea-IU-145.258.11/lib/ecj-4.4.2.jar org.jetbrains.jps.cmdline.Launcher /opt/jetbrains/idea-IU-145.258.11/lib/jgoodies-forms.jar:/opt/jetbrains/idea-IU-145.258.11/lib/jps-builders.jar:/opt/jetbrains/idea-IU-145.258.11/lib/resources_en.jar:/opt/jetbrains/idea-IU-145.258.11/lib/oromatcher.jar:/opt/jetbrains/idea-IU-145.258.11/lib/javac2.jar:/opt/jetbrains/idea-IU-145.258.11/lib/rt/jps-plugin-system.jar:/opt/jetbrains/idea-IU-145.258.11/lib/nanoxml-2.2.3.jar:/opt/jetbrains/idea-IU-145.258.11/lib/netty-all-4.1.0.Beta8.jar:/opt/jetbrains/idea-IU-145.258.11/lib/annotations.jar:/opt/jetbrains/idea-IU-145.258.11/lib/idea_rt.jar:/opt/jetbrains/idea-IU-145.258.11/lib/jdom.jar:/opt/jetbrains/idea-IU-145.258.11/lib/trove4j.jar:/opt/jetbrains/idea-IU-145.258.11/lib/jna.jar:/opt/jetbrains/idea-IU-145.258.11/lib/forms_rt.jar:/opt/jetbrains/idea-IU-145.258.11/lib/picocontainer.jar:/opt/jetbrains/idea-IU-145.258.11/lib/util.jar:/opt/jetbrains/idea-IU-145.258.11/lib/jna-platform.jar:/opt/jetbrains/idea-IU-145.258.11/lib/snappy-in-java-0.3.1.jar:/opt/jetbrains/idea-IU-145.258.11/lib/asm-all.jar:/opt/jetbrains/idea-IU-145.258.11/lib/jsr166e.jar:/opt/jetbrains/idea-IU-145.258.11/lib/openapi.jar:/opt/jetbrains/idea-IU-145.258.11/lib/log4j.jar:/opt/jetbrains/idea-IU-145.258.11/lib/jps-model.jar:/opt/jetbrains/idea-IU-145.258.11/lib/protobuf-2.5.0.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/ant/lib/ant-jps-plugin.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/IntelliLang/lib/intellilang-jps-plugin.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/Groovy/lib/groovy-jps-plugin.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/Groovy/lib/groovy-rt-constants.jar:/home/victor/.IntelliJIdea2016.1/config/plugins/Erlang/lib/jps-plugin.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/maven/lib/maven-jps-plugin.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/maven/lib/maven3/lib/plexus-utils-2.0.6.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/Kotlin/lib/jps/kotlin-jps-plugin.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/Kotlin/lib/kotlin-runtime.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/Kotlin/lib/kotlin-reflect.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/Kotlin/lib/kotlin-plugin.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/Kotlin/lib/kotlin-android-extensions-plugin.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/Kotlin/lib/kotlin-android-extensions-compiler-plugin.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/javaFX/lib/javaFX-jps-plugin.jar:/opt/jetbrains/idea-IU-145.258.11/plugins/javaFX/lib/common-javaFX-plugin.jar org.jetbrains.jps.cmdline.BuildMain 127.0.0.1 52949 475d2e50-95dd-4efd-ab72-60ee236beece /home/victor/.IntelliJIdea2016.1/system/compile-server 
2016-03-28 15:24:52,603 [ 259388]  DEBUG - ang.debugger.ErlangDebuggerLog - Debugger connected, closing the server socket. 
2016-03-28 15:24:52,603 [ 259388]  DEBUG - ang.debugger.ErlangDebuggerLog - Starting send/receive loop. 
2016-03-28 15:24:52,607 [ 259392]  DEBUG - ang.debugger.ErlangDebuggerLog -  
java.net.SocketException: A socket was closed.
        at org.intellij.erlang.debugger.node.ErlangDebuggerNode.readBytes(ErlangDebuggerNode.java:298)
        at org.intellij.erlang.debugger.node.ErlangDebuggerNode.readObjectSize(ErlangDebuggerNode.java:271)
        at org.intellij.erlang.debugger.node.ErlangDebuggerNode.receive(ErlangDebuggerNode.java:253)
        at org.intellij.erlang.debugger.node.ErlangDebuggerNode.receiveMessage(ErlangDebuggerNode.java:205)
        at org.intellij.erlang.debugger.node.ErlangDebuggerNode.serverLoop(ErlangDebuggerNode.java:196)
        at org.intellij.erlang.debugger.node.ErlangDebuggerNode.runDebuggerServerImpl(ErlangDebuggerNode.java:154)
        at org.intellij.erlang.debugger.node.ErlangDebuggerNode.access$000(ErlangDebuggerNode.java:44)
        at org.intellij.erlang.debugger.node.ErlangDebuggerNode$1.run(ErlangDebuggerNode.java:132)
        at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

victor-yacovlev avatar Mar 28 '16 12:03 victor-yacovlev

@victor-yacovlev you have a module named 'int' in your code path which overrides 'int' from OTP. You'll have to rename that module to use the debugger.

deadok22 avatar Mar 29 '16 03:03 deadok22

I got the same problem on Ubuntu14.04, IntelliJ IDEA 2016.1.1 after following jetbrains' official docs on getting-started-with-erlang,the following is my error log

/usr/lib/erlang/erts-5.10.4/bin/erl -pa /tmp/intellij_erlang_debugger_467 -pa /home/garland/IdeaProjects/ErlangDemo/out/production/ErlangDemo -pa /home/garland/IdeaProjects/ErlangDemo -run debugnode main 40640 -noshell -s init stop
{"init terminating in do_boot",{undef,[{int,stop,[],[]},{debugnode,stop_debugger,0,[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

the Debug window show Debug process stopped, and my source code is the same as the code in above article,and i do have a breakpoint on the last line.

-module(hello).

-export([hello_world/1]).

hello_world(Name) -> io:format("hello, ~p. ~n", [Name]).

Garlandal avatar Apr 14 '16 03:04 Garlandal

@Garlandal Do you have a module named 'int' in your code path? If not, where did you get your erlang distribution from?

deadok22 avatar Apr 14 '16 03:04 deadok22

@deadok22 no, i'm not, i just following the steps, the erlang distribution was configured in File | Other Settings | Default Project Structure, and add an erlang SDK by specifying the path to the erlang installation directory and should i have an init module?

Garlandal avatar Apr 16 '16 01:04 Garlandal

@Garlandal the error message you attached says the function int:stop/0 is undefined.

int is a module from standard library which the debugger implementation uses - if you have a module with the same name on your code path, BEAM will attempt to make a call to that module instead.

So make sure you don't have a module named `int`` on your code path (look in your project directory).

Also, your environment variables may affect your code path. You may want to run this, to make sure you have only one int.beam and it is the correct one:

erl -noshell -eval 'lists:foreach(fun(P) -> io:format("~p~n", [P]) end, code:get_path()).' -s init stop | xargs -I % find % -name int.beam

deadok22 avatar Apr 16 '16 02:04 deadok22

@deadok22 learn a lot from u, thank u very much !!

Garlandal avatar Apr 16 '16 15:04 Garlandal

So, did you have an int module on your code path, @Garlandal?

deadok22 avatar Apr 16 '16 16:04 deadok22

@deadok22 nope, i don't have an int module in my code path, and i only have one int.bean after execute the command before, /usr/lib/erlang/lib/debugger-3.2.12/ebin/int.beam, so i tried restart the IntelliJ IDEA and i find that everything is ok, maybe next time i should try restart first.

Garlandal avatar Apr 17 '16 08:04 Garlandal