WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] tce hangs in background and hogs the cpu (TCL13 Pure64)  (Read 1545 times)

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1343
I run TCL13 Pure64 on my X230 laptop. I do no use the  Apps  GUI--whenever I want to search or install extensions, I use  tce  at the command line.

Often, after using  tce  to browse the repo (I don't even have to install anything), my laptop's fans will turn on. Whenever this happens, running  top  shows me that  tce  is running in the background and consuming about 25% of my CPU (see attached).

Is this a known issue with tce?
« Last Edit: June 29, 2022, 05:16:30 AM by Rich »

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1343
Re: tce hangs in background and hogs the cpu (TCL13 Pure64)
« Reply #1 on: June 28, 2022, 02:45:42 PM »
I figured it out. The culprit is this line at the beginning of /usr/bin/tce:

Code: [Select]
trap 'echo && exit 1 1>&2' 1 2 15

If for any reason the terminal in which  tce  is running is closed, then the  tce  script receives SIGHUP (signal 1). The problem is that once the terminal is closed, the  echo  command fails because there is no stdout connected to the script. Script seems to enter an endless loop, driving CPU usage way up.

Fix is to simply change the line above to this, which allows the script to exit when it receives SIGHUP, regardless of whether  echo  succeeds or not:
Code: [Select]
trap 'echo; exit 1 1>&2' 1 2 15

I will submit a pull request on Github. Issue is solved.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: tce hangs in background and hogs the cpu (TCL13 Pure64)
« Reply #2 on: June 28, 2022, 11:28:13 PM »
Merged, thanks.
The only barriers that can stop you are the ones you create yourself.