[Home]

Summary:ASTERISK-15589: [patch] 99.9 cpu when asterisk started with init.d script
Reporter:Paul Belanger (pabelanger)Labels:
Date Opened:2010-02-06 16:40:40.000-0600Date Closed:2010-06-09 12:34:40
Priority:BlockerRegression?Yes
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) __20100224-debian-rc-script.patch.txt
( 1) 20100530__issue16784__2.diff.txt
( 2) gdb.txt
( 3) issue16784.patch.v3
Description:Odd issue, starting asterisk from /etc/init.d/asterisk (under Ubuntu 8.04) causes asterisk to consume 100% cpu.  If you start it asterisk from the CLI, there is no issue.

****** ADDITIONAL INFORMATION ******

I don't see any locks using 'core show locks'
Comments:By: Paul Belanger (pabelanger) 2010-02-06 16:44:33.000-0600

Attached gdb.txt

By: Leif Madsen (lmadsen) 2010-02-08 11:12:58.000-0600

Are you creating this using DONT_OPTIMIZE from the Compiler Flags section of menuselect? I'm seeing optimized out values, which makes the backtrace less useful.

Can you also perform the commands:

bt
bt full
thread apply all bt

and from the Asterisk CLI:

core show locks

By: Leif Madsen (lmadsen) 2010-02-08 11:13:17.000-0600

I think you need to enabled MALLOC_DEBUG as well in Compiler Flags for 'core show locks'

By: Matthias Nick (mnick) 2010-02-12 08:00:13.000-0600

I get the same problem on Debian using Asterisk 1.6.2

no currently held locks.

By: Humberto Figuera (korihor) 2010-02-13 19:54:55.000-0600

I have the same problem on Debian GNU/Linux x86_64 with Asterisk 1.6.2.3-rc2

Run:

start-stop-daemon --start --oknodo --background --exec /usr/sbin/asterisk -- -c

With "--background" uses 100% CPU



By: Sean Bright (seanbright) 2010-02-14 11:16:34.000-0600

Right, because we busy-loop trying to read from /dev/null since we lose our controlling terminal when we go into the background.

By: David Woolley (davidw) 2010-02-15 07:23:34.000-0600

Specifically, it is a configuration error to use -c unless Asterisk will be connected to a terminal.

By: Leif Madsen (lmadsen) 2010-02-22 16:20:09.000-0600

Still waiting for an appropriate backtrace as well. We probably shouldn't crash, even if we aren't using the right option flags. Perhaps a patch could be created to avoid using -c if that's the issue.

By: Matthias Nick (mnick) 2010-02-23 02:11:58.000-0600

I am using the script without the '-c' flag, and it is working great

By: Leif Madsen (lmadsen) 2010-02-24 09:41:49.000-0600

I wonder if there is any reason that we need -c at all. Seems like that was just wrong in the first place based on the comments here.

By: Leif Madsen (lmadsen) 2010-02-24 09:47:36.000-0600

Just attached a patch. Is this all we need to do?

By: Paul Belanger (pabelanger) 2010-02-28 20:06:18.000-0600

Fixed the issue.

By: mutineer612 (mutineer612) 2010-03-07 22:14:13.000-0600

I experienced this issue running 1.6.2.4 with Ubuntu server 9.10.  I removed the '-c' from the end /etc/init.d/asterisk line 85, and cpu utilization is now normal.  Hopefully this is fixed in 1.6.2.5.

Original line 85:
start-stop-daemon --start --oknodo --background --exec $DAEMON -- $ASTARGS -c

Fixed Line 85:
start-stop-daemon --start --oknodo --background --exec $DAEMON -- $ASTARGS

By: Digium Subversion (svnbot) 2010-03-08 12:07:46.000-0600

Repository: asterisk
Revision: 251309

U   branches/1.4/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r251309 | lmadsen | 2010-03-08 12:07:45 -0600 (Mon, 08 Mar 2010) | 13 lines

Fix Debian init script to not use -c.
When using the init script as-is currently, it could cause issues on Debian
such as high CPU usage. This fix has worked for several people so I'm
implementing the change.


(closes issue ASTERISK-15589)
Reported by: pabelanger
Tested by: pabelanger, mnick, davidw, mutineer612

(closes issue ASTERISK-15678)
Reported by: jlpedrosa
Tested by: jlpedrosa, mutineer612
------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=251309

By: Digium Subversion (svnbot) 2010-03-08 12:08:45.000-0600

Repository: asterisk
Revision: 251310

_U  trunk/
U   trunk/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r251310 | lmadsen | 2010-03-08 12:08:45 -0600 (Mon, 08 Mar 2010) | 21 lines

Merged revisions 251309 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r251309 | lmadsen | 2010-03-08 12:07:44 -0600 (Mon, 08 Mar 2010) | 13 lines
 
 Fix Debian init script to not use -c.
 When using the init script as-is currently, it could cause issues on Debian
 such as high CPU usage. This fix has worked for several people so I'm
 implementing the change.
 
 
 (closes issue ASTERISK-15589)
 Reported by: pabelanger
 Tested by: pabelanger, mnick, davidw, mutineer612
 
 (closes issue ASTERISK-15678)
 Reported by: jlpedrosa
 Tested by: jlpedrosa, mutineer612
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=251310

By: Digium Subversion (svnbot) 2010-03-08 12:09:29.000-0600

Repository: asterisk
Revision: 251311

U   branches/1.6.2/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r251311 | lmadsen | 2010-03-08 12:09:29 -0600 (Mon, 08 Mar 2010) | 28 lines

Merged revisions 251310 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r251310 | lmadsen | 2010-03-08 12:08:44 -0600 (Mon, 08 Mar 2010) | 21 lines
 
 Merged revisions 251309 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r251309 | lmadsen | 2010-03-08 12:07:44 -0600 (Mon, 08 Mar 2010) | 13 lines
   
   Fix Debian init script to not use -c.
   When using the init script as-is currently, it could cause issues on Debian
   such as high CPU usage. This fix has worked for several people so I'm
   implementing the change.
   
   
   (closes issue ASTERISK-15589)
   Reported by: pabelanger
   Tested by: pabelanger, mnick, davidw, mutineer612
   
   (closes issue ASTERISK-15678)
   Reported by: jlpedrosa
   Tested by: jlpedrosa, mutineer612
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=251311

By: Digium Subversion (svnbot) 2010-03-08 12:09:57.000-0600

Repository: asterisk
Revision: 251312

U   branches/1.6.1/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r251312 | lmadsen | 2010-03-08 12:09:57 -0600 (Mon, 08 Mar 2010) | 28 lines

Merged revisions 251310 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r251310 | lmadsen | 2010-03-08 12:08:44 -0600 (Mon, 08 Mar 2010) | 21 lines
 
 Merged revisions 251309 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r251309 | lmadsen | 2010-03-08 12:07:44 -0600 (Mon, 08 Mar 2010) | 13 lines
   
   Fix Debian init script to not use -c.
   When using the init script as-is currently, it could cause issues on Debian
   such as high CPU usage. This fix has worked for several people so I'm
   implementing the change.
   
   
   (closes issue ASTERISK-15589)
   Reported by: pabelanger
   Tested by: pabelanger, mnick, davidw, mutineer612
   
   (closes issue ASTERISK-15678)
   Reported by: jlpedrosa
   Tested by: jlpedrosa, mutineer612
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=251312

By: Digium Subversion (svnbot) 2010-03-08 12:10:21.000-0600

Repository: asterisk
Revision: 251313

U   branches/1.6.0/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r251313 | lmadsen | 2010-03-08 12:10:21 -0600 (Mon, 08 Mar 2010) | 28 lines

Merged revisions 251310 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r251310 | lmadsen | 2010-03-08 12:08:44 -0600 (Mon, 08 Mar 2010) | 21 lines
 
 Merged revisions 251309 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r251309 | lmadsen | 2010-03-08 12:07:44 -0600 (Mon, 08 Mar 2010) | 13 lines
   
   Fix Debian init script to not use -c.
   When using the init script as-is currently, it could cause issues on Debian
   such as high CPU usage. This fix has worked for several people so I'm
   implementing the change.
   
   
   (closes issue ASTERISK-15589)
   Reported by: pabelanger
   Tested by: pabelanger, mnick, davidw, mutineer612
   
   (closes issue ASTERISK-15678)
   Reported by: jlpedrosa
   Tested by: jlpedrosa, mutineer612
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=251313

By: Tilghman Lesher (tilghman) 2010-05-29 23:41:19

Patch breaks color display.  Reopened.  We need a new patch.

By: Digium Subversion (svnbot) 2010-05-29 23:43:28

Repository: asterisk
Revision: 266437

U   branches/1.4/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r266437 | tilghman | 2010-05-29 23:43:28 -0500 (Sat, 29 May 2010) | 2 lines

Reverting patch and reopening issue ASTERISK-15589, as patch breaks color display.

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=266437

By: Digium Subversion (svnbot) 2010-05-29 23:44:28

Repository: asterisk
Revision: 266438

_U  trunk/
U   trunk/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r266438 | tilghman | 2010-05-29 23:44:28 -0500 (Sat, 29 May 2010) | 9 lines

Merged revisions 266437 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r266437 | tilghman | 2010-05-29 23:43:28 -0500 (Sat, 29 May 2010) | 2 lines
 
 Reverting patch and reopening issue ASTERISK-15589, as patch breaks color display.
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=266438

By: Digium Subversion (svnbot) 2010-05-29 23:45:25

Repository: asterisk
Revision: 266439

_U  branches/1.6.2/
U   branches/1.6.2/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r266439 | tilghman | 2010-05-29 23:45:25 -0500 (Sat, 29 May 2010) | 16 lines

Merged revisions 266438 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r266438 | tilghman | 2010-05-29 23:44:28 -0500 (Sat, 29 May 2010) | 9 lines
 
 Merged revisions 266437 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r266437 | tilghman | 2010-05-29 23:43:28 -0500 (Sat, 29 May 2010) | 2 lines
   
   Reverting patch and reopening issue ASTERISK-15589, as patch breaks color display.
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=266439

By: Paul Belanger (pabelanger) 2010-06-02 08:59:02

For some reason, patch did not apply clean.  Attached new version.

By: Paul Belanger (pabelanger) 2010-06-02 09:14:38

+1 for patch.

By: Paul Belanger (pabelanger) 2010-06-02 09:22:29

I should also note, under Ubuntu 10.04 (Lucid) I did get a warning when installing the script:

---
update-rc.d: warning: /etc/init.d/asterisk missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
---
The fix would be to add a new header (IE):

### BEGIN INIT INFO
# Provides:          asterisk
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Should-Start:      dahdi
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Asterisk PBX
# Description:       Controls the Asterisk PBX
### END INIT INFO
---
If we wanted to address it now.

By: Leif Madsen (lmadsen) 2010-06-08 09:48:27

I think it might not be a bad idea to address that now.

By: Digium Subversion (svnbot) 2010-06-09 12:24:54

Repository: asterisk
Revision: 269334

U   branches/1.4/contrib/init.d/rc.debian.asterisk
U   branches/1.4/main/term.c

------------------------------------------------------------------------
r269334 | pabelanger | 2010-06-09 12:24:53 -0500 (Wed, 09 Jun 2010) | 12 lines

Fix Debian init script to not use -c.

When using the init script as-is currently, it could cause issues on Debian
such as high CPU usage. This fix has worked for several people so I'm
implementing the change.  We now handle color displays properly.

(closes issue ASTERISK-15589)
Reported by: pabelanger
Patches:
     20100530__issue16784__2.diff.txt uploaded by tilghman (license 14)
Tested by: pabelanger, tilghman

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=269334

By: Digium Subversion (svnbot) 2010-06-09 12:32:52

Repository: asterisk
Revision: 269346

_U  trunk/
U   trunk/contrib/init.d/rc.debian.asterisk
U   trunk/main/term.c

------------------------------------------------------------------------
r269346 | pabelanger | 2010-06-09 12:32:52 -0500 (Wed, 09 Jun 2010) | 19 lines

Merged revisions 269334 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r269334 | pabelanger | 2010-06-09 13:24:53 -0400 (Wed, 09 Jun 2010) | 12 lines
 
 Fix Debian init script to not use -c.
 
 When using the init script as-is currently, it could cause issues on Debian
 such as high CPU usage. This fix has worked for several people so I'm
 implementing the change.  We now handle color displays properly.
 
 (closes issue ASTERISK-15589)
 Reported by: pabelanger
 Patches:
       20100530__issue16784__2.diff.txt uploaded by tilghman (license 14)
 Tested by: pabelanger, tilghman
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=269346

By: Digium Subversion (svnbot) 2010-06-09 12:34:38

Repository: asterisk
Revision: 269347

_U  branches/1.6.2/
U   branches/1.6.2/contrib/init.d/rc.debian.asterisk
U   branches/1.6.2/main/term.c

------------------------------------------------------------------------
r269347 | pabelanger | 2010-06-09 12:34:38 -0500 (Wed, 09 Jun 2010) | 26 lines

Merged revisions 269346 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r269346 | pabelanger | 2010-06-09 13:32:52 -0400 (Wed, 09 Jun 2010) | 19 lines
 
 Merged revisions 269334 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r269334 | pabelanger | 2010-06-09 13:24:53 -0400 (Wed, 09 Jun 2010) | 12 lines
   
   Fix Debian init script to not use -c.
   
   When using the init script as-is currently, it could cause issues on Debian
   such as high CPU usage. This fix has worked for several people so I'm
   implementing the change.  We now handle color displays properly.
   
   (closes issue ASTERISK-15589)
   Reported by: pabelanger
   Patches:
         20100530__issue16784__2.diff.txt uploaded by tilghman (license 14)
   Tested by: pabelanger, tilghman
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=269347