PxPlus User Forum

Twitter Twitter Twitter

Author Topic: <defunct> Linux Processes  (Read 871 times)

James Zukowski

  • Diamond Member
  • *****
  • Posts: 155
    • View Profile
<defunct> Linux Processes
« on: November 30, 2018, 01:51:15 PM »
We seem to have a lot of zombie processes on our Linux server, e.g.:
     user_id  26008 21801  0 13:37 ?        00:00:00 [date] <defunct>
Most of them seem to be a result of:
Code: [Select]
Temp$=""; open (hfn)"<date"; read (lfo,err=*proceed)Temp$; close (lfo)When the user logs out, then yes, the zombie disappears, but until then, it just hangs around, getting its time updated whenever that date call is processed. According to some online comments, these hang around "because their parent has not destroyed them properly." Also, "On Unix and Unix-like computer operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table. This entry is still needed to allow the parent process to read its child's exit status."
Is there anything we need to do to ensure these will disappear promptly, or do we simply have to wait for the user to log out?
Thanks, all!
James Zukowski
Programmer / ERP Analyst
Beauty Enterprises, Inc.
150 Meadow St.
Hartford, CT 06114
860.296.9303  Ext 231

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3361
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: <defunct> Linux Processes
« Reply #1 on: December 03, 2018, 01:16:41 PM »
When dealing with pipes you may need to set the 'WP' system parameter.

The issue is that with 'WP' set to zero we don't wait for the pipe process to complete when you issue a close.  This means that the termination status is still to be processed which is why the process hangs around in memory.

This approach allows you to create a pipe process, send it some data then close the pipe and monitor the process using the SYS function.

If you set the 'WP' parameter to 1 the system will wait for the process to ends avoiding these zombies..

NOTE: A subsequent pipe request will cause the system to clear the preceding request so no task will ever have more than one zombie process.  These will also be cleared when the PxPlus process ends.

James Zukowski

  • Diamond Member
  • *****
  • Posts: 155
    • View Profile
Re: <defunct> Linux Processes
« Reply #2 on: December 03, 2018, 01:38:52 PM »
Unfortunately, we also have some piped processes that take quite a while (UnForm). Rather than have a user wait for that to complete, we decided to have the program return immediately. I guess that means we'll have to live with the zombies lurking...
James Zukowski
Programmer / ERP Analyst
Beauty Enterprises, Inc.
150 Meadow St.
Hartford, CT 06114
860.296.9303  Ext 231

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3361
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: <defunct> Linux Processes
« Reply #3 on: December 03, 2018, 02:27:30 PM »
The 'WP' only impacts the close of a pipe -- not invokes or any other OS spawn.

You can also set/reset this parameter as required so you could just wrap your open/close of <date with setting/resetting the 'WP' parameter.