0

I want to debug my erlang project, and i have some problem in my work.

The goal of my project is playing a card game on internet. For now, i'm just running all the threads on the same machine (4 clients and the server), and i can't understand in deep about the correctness of my program.

First, if i put different breakpoints and then i go step by step to see what happening, my code seems working, but if i remove all the breakpoints some thread exit, with reason "terminated" or "killed". Maybe the reason is related to logic's thread, so:

  • When a thread exit by reason "terminated" and when it exit by "killed"?

One very strange thing is that, when i remove all breakpoints, threads exit during the execution of:

io:format()

I want to post here the 2 descriptions about thread's end, because it doesn't explain a lot the exit's reason:

<0.215.0>
[exit, {terminated,[{io,format,[#Pid<Scopone@acero.120.0>,"Super election...~n,
[]],[]},{client,loop,5,[{file,"client.erl"},{line,74}]}]}]  
comunication_core_manager:init(#Port<Scopone@acero.1303>, #Pid<Scopone@acero.213.0>)

<0.221.0>
[exit, {terminated,[{io,format,[#Pid<Scopone@acero.120.0>,"Super election...~n",[]],[]}, 
{client,loop,5,[{file,"client.erl"},{line,74}]}]}]  
comunication_scheduler_manager:loop(#Port<Scopone@acero.1303>, #Pid<Scopone@acero.215.0>, 
{state,{[],[]},{dict,0,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}},[],[],1,20})

Now my questions are:

  • How i can get useful information about these descriptions?
  • Why i get problems with io:format()? Maybe some deadlocks?

Of course every other suggestion in your opinion are appreciated, because i'm not a pro with debugging..

EDIT: all threads are started with spawn_link.

optimusfrenk
  • 1,271
  • 2
  • 16
  • 34

1 Answers1

0

Regarding the relation with erlide:

First of all, did you try to run outside Erlide and debug with the standard OTP debugger? In case there is some problem in your code, this will show if it is related to erlide or not.

The exact behaviour depends on your code: how the processes are linked their supervision hierarchy (if any). It is difficult to say exactly what is happening here. The only thing that is unusual about running in erlide is that the console is a remote shell, so not all output gets to it. Your io:formats seem to go to a file, so that should not be a problem.

Vlad Dumitrescu
  • 931
  • 5
  • 11