Fork() issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everyone,

    I encountered a problem with linux kernel, please help if you can.

    I am writing an application which is listening to multiple sockets.

 

    Scenario I:
    

    Say, the application is listening to 6000 sockets, while a socket receives any packet, the application will close the socket and fork a child process to reopen the socket and do the packets processes and so on. But for some reasons, the application could not fork more than 1000 child processes due to fork function failure as indicated in the following kernel code

 

       do_fork()->......copy_files()-> ... expand_fd_array()->...alloc_fd_array()à vmalloc ()->get_vm_area(){

       ........

           if (addr > VMALLOC_END-size) {

                        

                 goto out;

            }

       }

 

    It seems to me that VMALLOC_END is out of boundary, but system still has plenty of memory left and CONFIG_HIGHMEM4G enabled

 

 

    If I disabled CONFIG_HIGHMEM4G, then the application can fork more than 1000 child processes until memory exhausted.

 

 

    While CONFIG_HIGHMEM4G is enabled, we reduced # of sockets to be listened, then # of child processes which can be forked will be increased, but fork still failed at the same located above before the memory exhausted.

    

    

    My system settings:

 

1.    2G memory

2.    Redhat9 with kernel 2.4.25

3.    file_max = 102400

4.    ulimit -n

   	core file size        (blocks, -c) unlimited

   	data seg size         (kbytes, -d) unlimited

    	file size             (blocks, -f) unlimited

    	max locked memory     (kbytes, -l) unlimited

    	max memory size       (kbytes, -m) unlimited

    	open files                    (-n) 102398

   	pipe size          (512 bytes, -p) 8

  	stack size            (kbytes, -s) 8192

  	cpu time             (seconds, -t) unlimited

  	max user processes            (-u) 6143

   	virtual memory        (kbytes, -v) unlimited

 

    5. define __FD_SETSIZE      102400

   

 

    It seems to me that fork might take the wrong VMALLOC_END when CONFIG_HIGHMEM4G is enabled, I have no clue on where I should look into, and any help is much appreciated.

 

 

Thanks!

 

Hai Wang

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux