title: Wrong rlimit information in hs_err_pidXXX.log file when JVM crashes
body: <p>I have a java application running with jdk 1.8.0_102. When the application crashes (out of memory - see below) a file hs_err_pidXXX is generated with several information about the jvm, system, memory, threads etc...</p>
  
  <pre>
  
      #
      # There is insufficient memory for the Java Runtime Environment to continue.
      # Native memory allocation (mmap) failed to map 65536 bytes for committing reserved memory.
      # Possible reasons:
      #   The system is out of physical RAM or swap space
      #   In 32 bit mode, the process size limit was hit
      # Possible solutions:
      #   Reduce memory load on the system
      #   Increase physical memory or swap space
      #   Check if swap backing store is full
      #   Use 64 bit Java on a 64 bit OS
      #   Decrease Java heap size (-Xmx/-Xms)
      #   Decrease number of Java threads
      #   Decrease Java thread stack sizes (-Xss)
      #   Set larger code cache with -XX:ReservedCodeCacheSize=
      # This output file may be truncated or incomplete.
      #
      #  Out of Memory Error (os_linux.cpp:2627), pid=1094, tid=0x00007fac4041e700
      #
      # JRE version: Java(TM) SE Runtime Environment (8.0_102-b14) (build 1.8.0_102-b14)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode linux-amd64 compressed oops)
      # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
      #
  
  </pre>
  
  <p>...</p>
  
  <pre>
  
      ---------------  S Y S T E M  ---------------
  
      OS:DISTRIB_ID=Ubuntu
      DISTRIB_RELEASE=14.04
      DISTRIB_CODENAME=trusty
      DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
  
      uname:Linux 3.13.0-101-generic #148-Ubuntu SMP Thu Oct 20 22:08:32 UTC 2016 x86_64
      libc:glibc 2.19 NPTL 2.19 
      rlimit: STACK 8192k, CORE 0k, NPROC 30034, NOFILE 4096, AS infinity
      load average:10.38 6.50 2.88
  
  </pre>
  
  <p>In the list of information above, i can see the following line:
  rlimit: STACK 8192k, CORE 0k, NPROC 30034, NOFILE 4096, AS infinity</p>
  
  <p>My question is the following:
  why NOFILE does not correspond to the value I have set on my system (in limits.conf file, it should be 20000)? When I run the command ulimit -n with the same user as the one running the jvm, i have a different value. Note that STACK displayed is the correct value that I have set on my system, not the default one.
  JVM is run on AWS c3.large on demand instance.</p>
  
  <p>Here is the result of the ulimit -a command :</p>
  
  <pre><code>core file size          (blocks, -c) 0
  data seg size           (kbytes, -d) unlimited
  scheduling priority             (-e) 0
  file size               (blocks, -f) unlimited
  pending signals                 (-i) 30034
  max locked memory       (kbytes, -l) 64
  max memory size         (kbytes, -m) unlimited
  open files                      (-n) 20000
  pipe size            (512 bytes, -p) 8
  POSIX message queues     (bytes, -q) 819200
  real-time priority              (-r) 0
  stack size              (kbytes, -s) 8192
  cpu time               (seconds, -t) unlimited
  max user processes              (-u) 30034
  virtual memory          (kbytes, -v) unlimited
  file locks                      (-x) unlimited
  </code></pre>