Dear all,

I have one more query, when i run mtest01w on my target, it gives a message "stopped at 731906048 bytes: errno=ENOMEM(12): Cannot allocate memory".

Should this be considered as a test case failure, If not, why?

Regards,
Shashank J Bilgi


On Tue, Jul 16, 2013 at 5:59 PM, <chrubis@suse.cz> wrote:
Hi!
> <<<test_start>>>
> tag=mtest01w stime=2336
> cmdline="mtest01 -p80 -w"
> contacts=""
> analysis=exit
> <<<test_output>>>
> [ 2351.111281] rmon:L
> mtest01     0  TINFO  :  Total memory already used on system = 22796 kbytes
> mtest01     0  TINFO  :  Total memory used needed to reach maximum =
> 1750246 kbytes
> mtest01     0  TINFO  :  Filling up 80% of ram which is 1727450 kbytes
> mtest01     1  TBROK  :  stopped at 716177408 bytes: errno=ENOMEM(12):
> Cannot allocate memory
>
>
> * When the malloc fails the child process seems to be calling tst_exit().
> mtest01.c
> .....
> .....
>         if (pid == 0) {
>                 bytecount = chunksize;
>                 while (1) {
>                         if ((mem = malloc(chunksize)) == NULL) {
>                                 tst_resm(TBROK | TERRNO,
>                                          "stopped at %lu bytes", bytecount);
>                                 free(pid_list);
>                                 tst_exit();
>                         }
>
> .....
> .....
>
> * but in this case i can see the child process in the process list(ps -ax)
> in sleep state.
>
>  333 ttyAM0   S      0:00 mtest01 -p80 -w
>  334 ttyAM0   Z      0:14 [mtest01] <defunct>
>  335 ttyAM0   S      0:13 mtest01 -p80 -w
>
> Here is my query , why tst_exit() isn't ending the child process?

Using tst_exit() and any other tst interface from child is a mistake but
tst_exit() should end the child process.

However there may be other childrens still running as tst_exit() is just
equivalent to exit() (it does flush output buffers and exits the process
with result as return value but nothing more).

So my guess is that the rest of the childrens continue to fill the
chunks and then waits to be reaped by the parent. Which may hang the
machine if there is not enough memory.

--
Cyril Hrubis
chrubis@suse.cz