5 Replies Latest reply on Jul 29, 2011 8:38 AM by Avikal Jain

    Difference in ulimit value

    Avikal Jain

      One of the customer asked if there is a difference in ulimit output when we try to connect to a server using BL than manually. I ran some tests and figured out that there is a difference indeed.

       

      Even though the ulimit value for 'user' is set to unlimited (-1) in /etc/security/limits file, when I run the ulimit in external command the output is the default  fsize value which is 3984588.

       

      Here is the output of ulimit commands from server:

       

      {host}:/home/user:>ulimit unlimited

      {host}:/home/user:>ulimit -a time(seconds)        unlimited file(blocks)         unlimited data(kbytes)         131072 stack(kbytes)        32768 memory(kbytes)       32768 coredump(blocks)     2097151 nofiles(descriptors) 8000


      {host}:/home/udbiap1:>cat /etc/security/limits * * Sizes are in multiples of 512 byte blocks, CPU time is in seconds * * fsize      - soft file size in blocks * core       - soft core file size in blocks * cpu        - soft per process CPU time limit in seconds * data       - soft data segment size in blocks * stack      - soft stack segment size in blocks * rss        - soft real memory usage in blocks * nofiles    - soft file descriptor limit * fsize_hard - hard file size in blocks * core_hard  - hard core file size in blocks * cpu_hard   - hard per process CPU time limit in seconds * data_hard  - hard data segment size in blocks * stack_hard - hard stack segment size in blocks * rss_hard   - hard real memory usage in blocks * nofiles_hard - hard file descriptor limit * * The following table contains the default hard values if the * hard values are not explicitly defined: * *   Attribute        Value *   ==========    ============ *   fsize_hard    set to fsize *   cpu_hard      set to cpu *   core_hard         -1 *   data_hard         -1 *   stack_hard      8388608 *   rss_hard          -1 *   nofiles_hard      -1 * * NOTE:  A value of -1 implies "unlimited" *
      default:         fsize = 3984588         core = 2097151         cpu = -1         data = 262144         rss = 65536         stack = 65536         nofiles = 2000
      root:
      daemon:
      bin:
      sys:
      adm:
      guest:
      nobody:
      lpd:

      user:         fsize = -1

       

       

       

      Any ideas why this is happening?

       

      Thanks for all the help in advance.

        • 1. Re: Difference in ulimit value
          Bill Robinson

          when you act as a user through the agent on a target we are not loading a full user profile, so that may be the cause of the discrepancy.

          • 2. Re: Difference in ulimit value
            Avikal Jain

            Apologies, I should have mentioned this in my previous post. I am loading the .profile using routine below:

             

            #!/bin/ksh

            USER=`who am i |awk -F" " '{print $1}'`

            HOME=`cat /etc/passwd|grep ^$USER | awk  -F: '{printf $6}'`

            echo $HOME

            if [ "$HOME" = "" ]; then

                            HOME=`ypcat passwd|grep ^$USER | awk  -F: '{printf $6}'`

                            echo $HOME

                            echo $USER

            fi

            cd $HOME

            . ./.profile

             

            The ulimit value through blpackage is always returned as 3984588 with or without loading the .profile.

            • 3. Re: Difference in ulimit value
              Bill Robinson

              is 3984588  set at the system level?  if you put a ulimit unlimited in the external command, what happens?

               

              also, are you running everything in 1 external command or multiple ?

              • 4. Re: Difference in ulimit value
                Francois FURSTOSS

                Hello,

                 

                In some cases, only the root user is able to see the true value in use of ulimit (soalris 9 is an example).
                Do the test as the root user

                • 5. Re: Difference in ulimit value
                  Avikal Jain

                  Here's the content of /etc/security/limits file:

                   

                  {host}:/home/udbiap1:>ulimit -a
                  time(seconds)        unlimited
                  file(blocks)         unlimited
                  data(kbytes)         131072
                  stack(kbytes)        32768
                  memory(kbytes)       32768
                  coredump(blocks)     2097151
                  nofiles(descriptors) 8000

                   

                  {host}:/home/udbiap1:>cat /etc/security/limits
                  *
                  * Sizes are in multiples of 512 byte blocks, CPU time is in seconds
                  *
                  * fsize      - soft file size in blocks
                  * core       - soft core file size in blocks
                  * cpu        - soft per process CPU time limit in seconds
                  * data       - soft data segment size in blocks
                  * stack      - soft stack segment size in blocks
                  * rss        - soft real memory usage in blocks
                  * nofiles    - soft file descriptor limit
                  * fsize_hard - hard file size in blocks
                  * core_hard  - hard core file size in blocks
                  * cpu_hard   - hard per process CPU time limit in seconds
                  * data_hard  - hard data segment size in blocks
                  * stack_hard - hard stack segment size in blocks
                  * rss_hard   - hard real memory usage in blocks
                  * nofiles_hard - hard file descriptor limit
                  *
                  * The following table contains the default hard values if the
                  * hard values are not explicitly defined:
                  *
                  *   Attribute        Value
                  *   ==========    ============
                  *   fsize_hard    set to fsize
                  *   cpu_hard      set to cpu
                  *   core_hard         -1
                  *   data_hard         -1
                  *   stack_hard      8388608
                  *   rss_hard          -1
                  *   nofiles_hard      -1
                  *
                  * NOTE:  A value of -1 implies "unlimited"
                  *

                  default:
                          fsize = 3984588
                          core = 2097151
                          cpu = -1
                          data = 262144
                          rss = 65536
                          stack = 65536
                          nofiles = 2000

                  root:

                  daemon:

                  bin:

                  sys:

                  adm:

                  guest:

                  nobody:

                  lpd:


                  udbiap1:
                          fsize = -1

                   

                  The system default is 3984588 (in bold), however for the user to whom my role is mapped (udbiap1 in this case) the value is unlimited (-1, in bold). when I run ulimit from command prompt the output is unlimited:

                   

                  {host}:/home/udbiap1:>ulimit

                  unlimited

                   

                  However when I run ulimit as external command in blpackage the output is 3984588.

                   

                  Yes, i am using everything in one external command, the complete command is:

                   

                  #!/bin/ksh

                  USER=`who am i |awk -F" " '{print $1}'`

                  HOME=`cat /etc/passwd|grep ^$USER | awk  -F: '{printf $6}'`

                  echo $HOME

                  if [ "$HOME" = "" ]; then

                                  HOME=`ypcat passwd|grep ^$USER | awk  -F: '{printf $6}'`

                                  echo $HOME

                                  echo $USER

                  fi

                  cd $HOME

                  . ./.profile

                  pwd >> /tmp/bl-out.lst

                  hostname >> /tmp/bl-out.lst

                  id >> /tmp/bl-out.lst

                  env >> /tmp/bl-out.lst

                  ulimit >> /tmp/bl-out.lst

                   

                  I will make the ulimit value unlimited in external command and will post the output.