473,471 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

debian C defunct process.... why

13 New Member
Hi I have the following code which is basically a function to open a file and load the data into a memory file (bob), i have a basic logging feature (logs to a text file) you will notice the last line "logfile" at which point this is where the program terminates as far as the log is concerned. where it is supposed to drop back to a main function where there is another immediate "logfile" but this never seems to get logged. and 'ps -aux' lists the routine as defunct.

You will notice i have commented the loop out to eliminate the bob memory variable that the data is being loaded into but regardless it does not seem to drop back to the main and the next log statement.

I am stumped here. i like to think of programming as a puzzle, but this has had me going for a couple of months now due to the complexity of this program in relation to my skills.

I would much appreciate as with my last posts if someone could 'hint' to me the direction i should be researching in. even beter if someone could point me to a good resource on how to troubleshoot defuncts on gcc under linux.

Thanks in advance guys and gals....

Rabid Monkey...

Expand|Select|Wrap|Line Numbers
  1. int loadgeneticfile()
  2. {
  3.     logfile("loadgeneticpair");
  4.     char fnamegen[40];
  5.     sprintf(fnamegen,"%s%s%s","./Database/",GLOBAL_alivefilerec.name,".gen");
  6.     logfile(fnamegen);
  7.     FILE * geneticfileP;
  8.     long p=2000;
  9.     if (geneticfileP = fopen (fnamegen,"r")) {flockfile(geneticfileP);logfile("loading");
  10. /*        for (p=2000;p<GLOBAL_alivefilerec.size-1;p++) {
  11.             fread(&childlogicrec, sizeof(childlogicrec), 1, geneticfileP);
  12.             bob[p].IO=childlogicrec.portIO;
  13.             bob[p].logik=childlogicrec.logictype;
  14.             bob[p].output=childlogicrec.output;
  15.             bob[p].inputA=childlogicrec.inputA;
  16.             bob[p].inputB=childlogicrec.inputB;
  17.  
  18.  
  19.         }*/
  20.         funlockfile(geneticfileP);fclose(geneticfileP);
  21.         } else {logfile("failed");}
  22.     logfile("end loadgenticpair.....");
  23. }
Oct 1 '07 #1
3 1787
rabidmonkey
13 New Member
sorry here as an example of the log file cat from terminal...


granit:/mnt/md0/home/damian/ai/tree/Database# cat 1191276062.1016000202.log

2 reset daycount
3 loadgeneticpair
4 ./Database/1191276062.1016000202.gen
5 loading
6 end loadgenticpair.....granit:/mnt/md0/home/damian/ai/tree/Database#
Oct 1 '07 #2
RRick
463 Recognized Expert Contributor
A <defunct> program in unix is knowned as a "zombie" program. The creation of a zombie process takes a couple of things to happen, but basically the program is dead, but an entry in the process table remains. This entry usually lasts until the machine is rebooted. Check out http://en.wikipedia.org/wiki/Zombie_process for more details.

Sooo, it looks like you process/program died before it could print out the next log. That is a good place to begin your search. These problems can be tough to debug.

The best way to find the problem is to have the debugger find the problem. This means the program has to be compiled with the debugger info enabled and you then attach the debugger to the program. Gdb can attach to a process id or you can have the parent start the child program in the debugger. The second method works well if the parent is using the system command. If so, start the debugger in an xterm (i.e. xterm -e gdb programName) when the xterm shows up run the program with the correct parameters.
Oct 1 '07 #3
rabidmonkey
13 New Member
Hi RRick,

Thanks Very much for your help, this will give me lots to get my teeth into

Thanks again

RabidMoney
Oct 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Guillaume Gervais | last post by:
Hello there, I'm using Debian GNU/Linux testing/unstable (sarge) as an operating system. About a month ago, I installed python 2.3 on my machine, from the sources. And it worked perfectly. ...
2
by: John Abel | last post by:
Hi! I'm currently writing a script which launches external programs, but it keeps leaving zombie/defunct processes behind, until I kill the launching script, which is a bit of a pain, as it's...
2
by: adamg | last post by:
Hello My native distribution is Linux Debian. I have written the C++ multithreaded application (using ptypes libs). After compilation on debian everything works ok (6 threads workinng) but...
7
by: Oliver Elphick | last post by:
Debian packages of PostgreSQL 7.4beta4 are available in the experimental section of the Debian archive. -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight,...
1
by: vduber6er | last post by:
Hi I want to have a wait page while the rest of the cgi does its process, but it seems like the wait page waits till everything is complete and never appears. I've tried forking twice already as...
6
by: BartlebyScrivener | last post by:
If there is a wxPython on Debian user in the house? I am using the version of the demo that came with the apt-get download of wxPython. I thought I'd followed the instructions for installing and...
1
by: Mswed | last post by:
Hi all! I hope someone can help me out here! I'm running a GUI in python which is able to launch a separate python process that will run forever. In rare cases I will want to kill the launched...
1
by: Gabriel Genellina | last post by:
En Tue, 29 Jul 2008 10:04:46 -0300, Gordon Maria <Maria.Gordon@afconsult.comescribi�: You should call os.waitpid() after killing the child process, to let the OS free the resources allocated...
3
by: Scottman | last post by:
I am writing a server daemon that forks a child for every incoming request. The child process terminates when the client closes the connection. My problem is that I am unsure how to prevent the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.