weixin_39797780
weixin_39797780
2020-12-31 11:40

Remote node debugging don't work in this situation.

I met a problem when I using intellij-erlang plugin to debug ejabberd. Reproduce step: 1. Download ejabberd windows release installer and install it. 2. Download ejabberd source code. 3. Import ejabberd source code to intellij-erlang IDE. 4. Add a "Erlang Rebar" configuration and compile it. (select "skip dependencies") Note: since many ejabberd dependencies (like: zlib iconv expat) are not included in its source code, I can only compile it with "skip-deps". 5. Copy compiled beams to ejabberd install directory. (replace original beams) 6. Add a "Erlang Remote Node" configuration: set module, nodename, cookie. At this pane "Before launch: Another Configuration, Active tool window": Remove "Make" configuration. Add "Run Another Configuration" (Erlang Rebar) which created above. 7. Start ejabberd server. (can run normally) 8. Run this configuration in intellij-erlang IDE. (success, no error occured!) 9. Set a breakpoint at a socket data receive function, for example: ejabberd_router : route 10. Start xmpp client to connect server. 11. The whole application hangs and no any prompt in intellij-erlang IDE...

Note: with the same method, but using erlang official debugger can be successfully debug.

该提问来源于开源项目:ignatov/intellij-erlang

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

15条回答

  • weixin_39797780 weixin_39797780 4月前

    I'm newer to inteillij, can you tell me how to calling that on the debugger node? (Need recompile intellij-erlang plugin source code?) There is no input shell when tarting intellij-erlang plugin debugger.

    点赞 评论 复制链接分享
  • weixin_39760689 weixin_39760689 4月前

    Hey ,

    Could you enable debugger logs as described in #512 and share the logs?

    1. The whole application hangs and no any prompt in intellij-erlang IDE...

    Which application hangs? If it's the debugged app, could you try generating a crash dump and look for suspicious processes.

    点赞 评论 复制链接分享
  • weixin_39797780 weixin_39797780 4月前

    Hi
    The hanged application is ejabberd server not intellij-erlang IDE. I uploaded log. log_server_hang.txt

    Note that the ejabbered server is "hang" not "crash". It seems stuck at some point, but intellij-erlang did not prompt me to further operation like: step-over/step-into/continue/...

    点赞 评论 复制链接分享
  • weixin_39760689 weixin_39760689 4月前

    the log looks normal: int:ni is called successfully, the breakpoint is set, and nothing happens afterwards.

    So could you try generating a crash dump for the ejabberd process and try to figure out what is going on by looking at process' stacks?

    点赞 评论 复制链接分享
  • weixin_39797780 weixin_39797780 4月前

    The ejabberd server does not crash , it maybe only stuck at break point... (so no crash dump, no error log) I'm newer to erlang, can you give me some suggestion about how to generating a crash dump ?

    点赞 评论 复制链接分享
  • weixin_39760689 weixin_39760689 4月前

    call erlang:halt(1)

    点赞 评论 复制链接分享
  • weixin_39797780 weixin_39797780 4月前
    点赞 评论 复制链接分享
  • weixin_39760689 weixin_39760689 4月前

    try to identify the process that's supposed to be running but is stuck. You also may want to look at crash dump of the debugger node (the process spawned by the plugin to attach to your process). Also, look for suspicious cpu/disk activity spikes.

    点赞 评论 复制链接分享
  • weixin_39797780 weixin_39797780 4月前

    Yes, but this may need a lot of effort.... Is it possible that intellij-erlang plugin has received the message from the server but not process? Since official debugger works normally. (It may need compare erlang official debuger and intellij-erlang debugger)

    And...how to generate crash dump of the debugger node (the process spawned by the plugin to attach to your process) ?

    点赞 评论 复制链接分享
  • weixin_39760689 weixin_39760689 4月前

    Is it possible that your plugin has received the message from the server but not process?

    I don't think so, but I can't be 100% sure there's no bugs. Here's the debugger code. As you can see, it's basically forwarding messages to the IDE.

    And...how to generate crash dump of the debugger node (the process spawned by the plugin to attach to your process).

    The same way as any other erlang process: connect to it and execute the code you need. Look at how the debugger does that here.

    点赞 评论 复制链接分享
  • weixin_39797780 weixin_39797780 4月前

    Is it possible that there is inconsistent path caused? For example: windows path: is \ linux path: is / This cause plugin could not find source code. Please ignore this comment.

    点赞 评论 复制链接分享
  • weixin_39797780 weixin_39797780 4月前

    Hi , I found a phenomenon may be related to this issue.

    Using your plugin, I could debug ejabberd at some lines of code now, but at other lines of code it will crash (no dumpfile generated). Use the official debugger of erlang, it also have some opportunity to crash (no dumpfile generated). But when I set "Stack On, No Tail" to "Stack Off" in official debugger, the problem resolved.

    So I think it might be a stack overflow problem, but I don't know why. Is there any way to set stack_trace flag for intellij-erlang plugin "Stack On, No Tail" to "Stack Off" like the official debugger? ("Debugger node args?" but I dont know how to set...)

    点赞 评论 复制链接分享
  • weixin_39760689 weixin_39760689 4月前

    try calling int:stack_trace(false) in the vm being debugged: http://erlang.org/doc/man/int.html#stack_trace-1

    Although, I still wonder why the default no_tail doesn't suit you. Is it because you run out of memory?

    点赞 评论 复制链接分享
  • weixin_39797780 weixin_39797780 4月前

    I called int:stack_trace(false) at ejabberd node shell and use your plugin to remote debug. But the problem still unresolved. The different between intellij-erlang plugin debugger and official debugger is: intellij-erlang plugin debugger using remote debugging official debugger using local debugging

    点赞 评论 复制链接分享
  • weixin_39760689 weixin_39760689 4月前

    Could you try calling that on the debugger node then?

    点赞 评论 复制链接分享