Re: The Chromium Dilemma

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

 



* Omair Majid:

> Florian Weimer <fweimer@xxxxxxxxxx> writes:
>
>> * Jan Kratochvil:
>>
>>> gold is also limited by 'ulimit -S -n', I had to raise it while building LLDB
>>> (using -DLLVM_USE_LINKER=gold).
>>
>> gold should either do this upon start (like OpenJDK does),
>
> Do you have any pointers to source or docs that explain the OpenJDK
> technique for this?

Uhm, now I have to look.  I hope it really does that, I noticed it only
because it was possible to open more than 1024 files, contrary to what I
expected based on the system configuration.

The responsible code is os::init_2(), in
src/hotspot/os/linux/os_linux.cpp:

  if (MaxFDLimit) {
    // set the number of file descriptors to max. print out error
    // if getrlimit/setrlimit fails but continue regardless.
    struct rlimit nbr_files;
    int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
    if (status != 0) {
      log_info(os)("os::init_2 getrlimit failed: %s", os::strerror(errno));
    } else {
      nbr_files.rlim_cur = nbr_files.rlim_max;
      status = setrlimit(RLIMIT_NOFILE, &nbr_files);
      if (status != 0) {
        log_info(os)("os::init_2 setrlimit failed: %s", os::strerror(errno));
      }
    }
  }

rlim_max is what is sometimes called the hard limit, rlim_cur the soft
limit.  It is the difference between “ulimit -S -n” and “ulimit -H -n”.
The quoted code fragment raises the soft limit up to the hard limit,
which is as far as you can go without additional privileges.

Does this answer your question?

There is some risk in doing this, if the JVM uses JNI with some library
that still uses the select system call (with the risk of memory
corruption due to the use of FD_SET/FD_CLR with out-of-range
descriptors), but for the JVM, this is likely the right trade-off.

Thanks,
Florian
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux