It might be interesting to know how "fork" works...

On Fri, 29 Sept 2023, 19:56 Sreenivasulu Alapaka, <
sreenivasulu.alapaka...@gmail.com> wrote:

> Yes, Deepak
> the parent and child process are derived from same Base class.
> i defined a function name main in base class with empty implememationa and
> same got implemented for both parent and child in their own module.
> Below is a skeleton of code. the parent process is spawned while
> bootstrapping the httpd and then child process is spawned from parent.  I
> am using fork to spawn the process
>
> package Test::Base;
>
>   #common functionalities will define here
>
>   #abstract main method. should implement in derived modules
>   sub main {}
> }
>
> 1;
> --------------------------------------------
> package Test::Parent;
> use base qw(Test::Base);
>
> #specific functionality for Parent
>
> #task of main to spawn and monitor the child process
> sub main {
>   #spawn child process if its not spawned already
>
>   #check the spawned child process status. start the child process which
> are not alive
> }
>
> 1;
>
> -----------------------------------------------------------------------------
> package Test::Child;
> use base qw(Test::Base);
>
> #specific functionality of child process
>
> sub main {
>   #check and execute the tasks of child continuously
>    #use ally its never ending loop to check and execute the tsak
>     #even if its come out , i will exit the child process using
> CORE::exit()
> }
>
> 1;
>
>
> On Fri, Sep 29, 2023 at 6:24 PM Deepak Goel <deic...@gmail.com> wrote:
>
>> Obviously there is a common function which is being called by your
>> server, client threads.
>>
>> You will have to share your code for us to find out what's going on.
>>
>> On Fri, 29 Sept 2023, 17:08 Sreenivasulu Alapaka, <
>> sreenivasulu.alapaka...@gmail.com> wrote:
>>
>>> Hi Deepak,
>>>
>>>
>>> *Client Monitor Workers is application specific log.  This message will
>>> be logged by the parent process in my application but not the child
>>> process.         In the issue state, I am seeing the *
>>> *Client Monitor Workers in both parent and child logs as the child is
>>> executing the tasks of the parent instead of its own.          How can we
>>> debug this?*
>>>
>>> On Fri, Sep 29, 2023 at 4:44 PM Deepak Goel <deic...@gmail.com> wrote:
>>>
>>>>
>>>>
>>>> On Fri, Sep 29, 2023 at 4:35 PM Sreenivasulu Alapaka <
>>>> sreenivasulu.alapaka...@gmail.com> wrote:
>>>>
>>>>> Hi Deepak,
>>>>>
>>>>>                  Please find the logs below.
>>>>>                  Parent task is to monitor the workers(childs) and
>>>>> then remove/start additional workers based on the load.
>>>>>                   its performing its task.
>>>>>             Parent process logs
>>>>>              =================
>>>>> Wed Sep 27 20:36:36 2023: Started (PID: 3032)
>>>>> Fri Sep 29 16:12:07 2023: Removing some Client Monitor Workers
>>>>>
>>>>
>>>> I am not sure what is *Client Monitor Workers. *It might not be the
>>>> same as *Client Workers.*
>>>>
>>>>
>>>>> Fri Sep 29 16:12:18 2023: restarting Client Monitor Worker...
>>>>> Fri Sep 29 16:12:33 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:12:54 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:13:06 2023: restarting Client Monitor Worker...
>>>>> Fri Sep 29 16:13:22 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:13:36 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:13:54 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:14:09 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:14:23 2023: restarting Client Monitor Worker...
>>>>> Fri Sep 29 16:14:39 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:14:54 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:15:08 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:15:27 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:15:42 2023: Starting additional Client Monitor Workers
>>>>>
>>>>> After spawning the child process , it works for some time properly and
>>>>> then starts performing tasks of the parent.
>>>>> Child process logs
>>>>> ==================
>>>>> Wed Sep 27 20:36:43 2023: Started (PID: 5321)
>>>>> Wed Sep 27 20:41:16 2023: Synchronizing containment
>>>>> Wed Sep 27 20:41:16 2023: Synchronizing containment
>>>>> Wed Sep 27 20:41:17 2023: Sync complete; beginning audit
>>>>> Wed Sep 27 20:41:19 2023: Audit finished.
>>>>> Wed Sep 27 21:16:23 2023: Audit finished.
>>>>> Wed Sep 27 21:16:23 2023: nothing to do
>>>>> Wed Sep 27 21:43:39 2023: Removing some Client Monitor Workers
>>>>> Wed Sep 27 21:43:54 2023: Removing some Client Monitor Workers
>>>>> Wed Sep 27 21:44:09 2023: Removing some Client Monitor Workers
>>>>> Wed Sep 27 21:44:24 2023: Removing some Client Monitor Workers
>>>>> Wed Sep 27 21:44:39 2023: Removing some Client Monitor Workers
>>>>> Wed Sep 27 21:44:54 2023: Removing some Client Monitor Workers
>>>>> Wed Sep 27 21:45:09 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:13:29 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:13:44 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:13:58 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:14:17 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:14:32 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:14:51 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:15:06 2023: restarting Client Monitor Worker...
>>>>> Fri Sep 29 16:15:22 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:15:36 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:16:00 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:16:10 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:16:30 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:16:45 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:17:06 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:17:20 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:17:40 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:17:55 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:18:09 2023: Starting additional Client Monitor Workers
>>>>> Fri Sep 29 16:18:28 2023: Removing some Client Monitor Workers
>>>>> Fri Sep 29 16:18:43 2023: Starting additional Client Monitor Workers
>>>>>
>>>>> Child process worked perfectly till Wed Sep 27 21:16:23 2023: and
>>>>> after that I didn't see any logs. Suddenly it started dumping the parent
>>>>> process logs from Wed Sep 27 21:43:39 2023. It's not recovering , it's
>>>>> required to kill the child process then Parent process will spawn another
>>>>> child process to do the task and the newly spawned child will work for 
>>>>> some
>>>>> time and again enter into the issue state.
>>>>>
>>>>> On Fri, Sep 29, 2023 at 4:17 PM Deepak Goel <deic...@gmail.com> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, Sep 29, 2023 at 4:15 PM Sreenivasulu Alapaka <
>>>>>> sreenivasulu.alapaka...@gmail.com> wrote:
>>>>>>
>>>>>>> Hi Deepak,
>>>>>>>
>>>>>>>             I have specific logs for parent and child process and am
>>>>>>> able to see the logs of parent process dumped in child process log with
>>>>>>> child process id.
>>>>>>>
>>>>>>>
>>>>>> Please share the log files..
>>>>>>
>>>>>>
>>>>>>> On Fri, Sep 29, 2023 at 3:58 PM Deepak Goel <deic...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Sep 29, 2023 at 3:52 PM Sreenivasulu Alapaka <
>>>>>>>> sreenivasulu.alapaka...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi Team,
>>>>>>>>>
>>>>>>>>>         I am using httpd and mod_perl libraries to spawn the
>>>>>>>>> process to execute the tasks. httpd will spawn a process which is 
>>>>>>>>> parent
>>>>>>>>> and it will spawn the other child process to perform the tasks.
>>>>>>>>>           The parent process job is to monitor the child process
>>>>>>>>> and the child process has to perform the functionality taks. All of 
>>>>>>>>> sudden
>>>>>>>>> one of the child process is executing the tasks of the parent instead 
>>>>>>>>> of
>>>>>>>>> the child process tasks.
>>>>>>>>>
>>>>>>>>> How did you infer that the child process is executing the parent
>>>>>>>> task?
>>>>>>>>
>>>>>>>>
>>>>>>>>>              I am using RHEL8 environment and these below are
>>>>>>>>> library versions.
>>>>>>>>>              Same piece of code worked in Cent 7.
>>>>>>>>>
>>>>>>>>>                       httpd: 2.4.6
>>>>>>>>>                       mod_perl: 2.0.10
>>>>>>>>>
>>>>>>>>>                Could you please help here, how to debug the
>>>>>>>>> issue?
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Thanks & Regards
>>>>>>>>> *Sreenivasulu Alapaka*
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Deepak
>>>>>>>> "The greatness of a nation can be judged by the way its animals
>>>>>>>> are treated - Mahatma Gandhi"
>>>>>>>>
>>>>>>>> +91 73500 12833
>>>>>>>> deic...@gmail.com
>>>>>>>>
>>>>>>>> Facebook: https://www.facebook.com/deicool
>>>>>>>> LinkedIn: www.linkedin.com/in/deicool
>>>>>>>>
>>>>>>>> "Plant a Tree, Go Green"
>>>>>>>>
>>>>>>>> Make In India : http://www.makeinindia.com/home
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Thanks & Regards
>>>>>>> *Sreenivasulu Alapaka*
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Thanks & Regards
>>>>> *Sreenivasulu Alapaka*
>>>>>
>>>>
>>>
>>> --
>>> Thanks & Regards
>>> *Sreenivasulu Alapaka*
>>>
>>
>
> --
> Thanks & Regards
> *Sreenivasulu Alapaka*
>

Reply via email to