-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
100% CPU when opening terminal and takes lot of time #835
Comments
Thanks @adangel for this detailed report. Since pty4j uses code originally from Eclipse CDT I hope we can bring the fix back to CDT easily enough. Do you have the knowledge/capacity to apply the fix to CDT? I can help support the development.
FWIW I think all of it was derived from the CDT version. The code's blame is from 2004 and the code was introduced to fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=27663 |
@jonahgraham see #840 - hope this is OK copying from EPL 1.0 to EPL 2.0... |
…ipse-cdt#835) When _SC_OPEN_MAX (max nr of open files limit per process) is a very big number, then closing all possible file handles can take a while. This change first tries to use the syscall close_range() if available, falling back to use /proc/self/fd to close only open file handles, and lastly falling back to the old way of closing all possible handles one after another. In general, the first or second approach should be available which speeds up the pty spawning. Refs JetBrains/pty4j#147 Copied from JetBrains/pty4j@04685d8 (which is EPL 1.0) Co-authored-by: Sergey Simonchik <sergey.simonchik@jetbrains.com>
Hi adangel, many thanks for your post. It saved my day. My eclipse (CDT) got stucked with the command: I'm using the following versions: |
Hi @jonahgraham @adangel, thanks for the fix. I also stumbled across this issue on Debian unstable. I've downloaded libspawner.so from the PR into my eclipse installation, i.e. into configuration/org.eclipse.osgi/102/0/.cp/os/linux/x86_64/ So using the workaround echo 1048576 > /proc/sys/fs/nr_open helps in that case. |
Thanks @markusdrescher for highlighting this. I have reproduced the error launching debug session with the unfixed CDT and with the fix in #840. I see the CPU at 100% for 10 seconds, and then the error. The 10 seconds is because of: cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java Line 338 in 5654112
I am now looking to see if we need to apply the same fix from #840 to somewhere else in CDT. |
Indeed - the same fix is needed here:
|
…ipse-cdt#835) _This commit adds to eclipse-cdt#840 7bd8d52 to apply the same fix to another place that does the same operation on all fds._ When _SC_OPEN_MAX (max nr of open files limit per process) is a very big number, then closing all possible file handles can take a while. This change first tries to use the syscall close_range() if available, falling back to use /proc/self/fd to close only open file handles, and lastly falling back to the old way of closing all possible handles one after another. In general, the first or second approach should be available which speeds up the pty spawning. Refs JetBrains/pty4j#147 Copied from JetBrains/pty4j@04685d8 (which is EPL 1.0) Co-authored-by: Sergey Simonchik <sergey.simonchik@jetbrains.com>
@markusdrescher You can pull the updated libspawner out of PR #846 libspawner.so (x86_64) Once I get a clean build I should be able to merge this and then backport all the changes to CDT 11.6 release branch. |
…ipse-cdt#835) When _SC_OPEN_MAX (max nr of open files limit per process) is a very big number, then closing all possible file handles can take a while. This change first tries to use the syscall close_range() if available, falling back to use /proc/self/fd to close only open file handles, and lastly falling back to the old way of closing all possible handles one after another. In general, the first or second approach should be available which speeds up the pty spawning. Refs JetBrains/pty4j#147 Copied from JetBrains/pty4j@04685d8 (which is EPL 1.0) Co-authored-by: Sergey Simonchik <sergey.simonchik@jetbrains.com> (cherry picked from commit 7bd8d52)
…ipse-cdt#835) _This commit adds to eclipse-cdt#840 7bd8d52 to apply the same fix to another place that does the same operation on all fds._ When _SC_OPEN_MAX (max nr of open files limit per process) is a very big number, then closing all possible file handles can take a while. This change first tries to use the syscall close_range() if available, falling back to use /proc/self/fd to close only open file handles, and lastly falling back to the old way of closing all possible handles one after another. In general, the first or second approach should be available which speeds up the pty spawning. Refs JetBrains/pty4j#147 Copied from JetBrains/pty4j@04685d8 (which is EPL 1.0) Co-authored-by: Sergey Simonchik <sergey.simonchik@jetbrains.com> (cherry picked from commit 3875408)
…ipse-cdt#835) When _SC_OPEN_MAX (max nr of open files limit per process) is a very big number, then closing all possible file handles can take a while. This change first tries to use the syscall close_range() if available, falling back to use /proc/self/fd to close only open file handles, and lastly falling back to the old way of closing all possible handles one after another. In general, the first or second approach should be available which speeds up the pty spawning. Refs JetBrains/pty4j#147 Copied from JetBrains/pty4j@04685d8 (which is EPL 1.0) Co-authored-by: Sergey Simonchik <sergey.simonchik@jetbrains.com> cherry picked and squashed from commits: - 7bd8d52 - 24d9bd1 - 3875408
…ipse-cdt#835) When _SC_OPEN_MAX (max nr of open files limit per process) is a very big number, then closing all possible file handles can take a while. This change first tries to use the syscall close_range() if available, falling back to use /proc/self/fd to close only open file handles, and lastly falling back to the old way of closing all possible handles one after another. In general, the first or second approach should be available which speeds up the pty spawning. Refs JetBrains/pty4j#147 Copied from JetBrains/pty4j@04685d8 (which is EPL 1.0) Co-authored-by: Sergey Simonchik <sergey.simonchik@jetbrains.com> cherry picked and squashed from commits: - 7bd8d52 - 24d9bd1 - 3875408
When _SC_OPEN_MAX (max nr of open files limit per process) is a very big number, then closing all possible file handles can take a while. This change first tries to use the syscall close_range() if available, falling back to use /proc/self/fd to close only open file handles, and lastly falling back to the old way of closing all possible handles one after another. In general, the first or second approach should be available which speeds up the pty spawning. Refs JetBrains/pty4j#147 Copied from JetBrains/pty4j@04685d8 (which is EPL 1.0) Co-authored-by: Sergey Simonchik <sergey.simonchik@jetbrains.com> cherry picked and squashed from commits: - 7bd8d52 - 24d9bd1 - 3875408
Also STM32CubeIDE suffers from this problem, see https://community.st.com/t5/stm32cubeide-mcus/cubeide-does-not-start-and-spawner-reaper/m-p/690290 |
I can confirm that this also fixes long delays in "Build Targets". Thank you for the fix. |
Thank you for fixing these issues on such a short notice. Remarkable. Keep up the good work! |
Thank you all for confirming the fix - it is now in the 11.6 branch and I will release as soon as practical (It is Canada Day here so slightly delayed today) The pre-release can be installed from https://ci.eclipse.org/cdt/job/cdt/job/cdt_11_6/lastSuccessfulBuild/artifact/releng/org.eclipse.cdt.repo/target/repository/ in the meantime (zip option) The release means promoting the next build to the official download location so that Check for Updates picks it up. |
Once the mirrors do their thing Check for Updates in Eclipse will pick up this fix (assuming that https://download.eclipse.org/tools/cdt/releases/11.6/ or https://download.eclipse.org/tools/cdt/releases/latest are listed in available software sites) |
Describe the bug
Debian Testing recently fixed #1029152 which has the consequence that the hard limit for NOFILE is now much bigger than before. That means that
_SC_OPEN_MAX
is now as big as1073741816
instead of only1048576
.When closing the file descriptors of the forked child process, the for-loop now takes a lot of time:
cdt/core/org.eclipse.cdt.core.native/native_src/unix/exec_pty.c
Lines 110 to 117 in 0583a05
Eventually it finished and the terminal is working. But every time a new terminal window is opened, it takes again a lot of time (couple of minutes).
To Reproduce
Steps to reproduce the behavior:
Make sure you have a big number in
/proc/sys/fs/nr_open
:echo 1073741816 > /proc/sys/fs/nr_open
Start eclipse
Verify the limits of the eclipse process, e.g.
prlimit --nofile -p <PID OF eclipse>
should output:If the soft limit is lower, you can set it with
prlimit --nofile=1073741816:1073741816 -p <PID OF eclipse>
Open a new local terminal
It takes a long time until the prompt is shown
Expected behavior
The prompt is shown instantly and the terminal is directly usable.
Version Information (please complete the following information):
Additional context
This is the same problem as described in JetBrains/pty4j#147 .
It seems, that pty4j and the terminal functionality from eclipse-cdt stem from the same origin - ELT. Maybe the same fix (JetBrains/pty4j@04685d8) from pty4j can be reused here?
The text was updated successfully, but these errors were encountered: