[Home]

Summary:ASTERISK-03263: Asterisk hangs if started with -c and then losing terminal
Reporter:Roy Sigurd Karlsbakk (rkarlsba)Labels:
Date Opened:2005-01-13 03:19:52.000-0600Date Closed:2008-01-15 15:21:51.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) mydiff.txt
Description:If starting asterisk with -c and then disconnecting from the terminal, asterisk hangs, using 100% CPU. with -pc, this will cause the whole box to hang.
Comments:By: () 2005-01-13 08:02:34.000-0600

I tried reproducing your problem with 1.0.3 stable that I am running and I cannot. How do you disconnect from the terminal? If you specify asterisk -vvvvvvvvvvvvvc on the command line, you cannot disconnect from the terminal unless you use stop now or CTRL+C. However, even that will kill the PBX. I tried doing asterisk -vvvvvvvvvvvvvvvvvvpc and it still did not hang up my box (thank god-the box is located 10 miles from here!).

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-01-13 08:08:37.000-0600

I just closed the terminal window with the ssh session.
try to kill the ssh pid locally

By: () 2005-01-13 08:18:08.000-0600

I just tried both. I killed the PID and closed the terminal window. Doesn't crash my box or Asterisk.

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-01-13 08:34:11.000-0600

it _didn't_ end up using all available CPU? and it _didn't_ crash with -pc? I know several people have reported it, and I beleive I've seen it since the earlier days of asterisk

By: () 2005-01-13 09:20:43.000-0600

Nope not at all. Plus, I don't have all the modules loaded either. I don't use mgcp or skinny, etc. I only use SIP so I only load the modules I need. I noticed Asterisk goes bananas and has memory leaks with some modules so I just disabled them a long time ago. Haven't had any problems since. This may be related to your problem, but I haven't seen the hangup or 100% CPU on a box when you kill the SSH pid.

By: Andrey S Pankov (casper) 2005-01-13 09:31:40.000-0600

Your system is probably misfunctioning. Can you reproduce the above mentioned behavior on a freshly installed system?

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-01-13 09:52:15.000-0600

I just reproduced it on three different servers with different distros and different hardware (distros Debian Sarge, Redhat 9 and SuSE 9.1, hardware "el-cheapo PC, HP 1U dual CPU server and IBM 1U single CPU server), all running 1.0.3. strace -p asterisk-pid says

ioctl(0, SNDCTL_TMR_STOP, {B9600 opost isig icanon echo ...}) = -1 EIO (Input/output error)
write(1, "*CLI> ", 6)                   = -1 EIO (Input/output error)
read(0, "", 1)                          = 0
ioctl(0, SNDCTL_TMR_STOP, {B9600 opost isig icanon echo ...}) = -1 EIO (Input/output error)
write(1, "*CLI> ", 6)                   = -1 EIO (Input/output error)

so it's a bug. not my fault....

By: () 2005-01-13 10:05:43.000-0600

Hmm, I'm running a Dell PowerEdge Dual Processor running Debian Sarge and do not see the problem you are having. I really wish I could reproduce it.

By: Andrey S Pankov (casper) 2005-01-13 10:10:24.000-0600

So, this is something soundcard (I assume chan_oss) related...

What happens if you manually unload chan_oss/chan_alsa before session disconnect?

By: Mark Spencer (markster) 2005-01-13 13:40:35.000-0600

In what way is this possibly considered major?

1) It does not affect Asterisk operation otherwise

2) You can easily just asterisk -g and then asterisk -vvvr

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-01-13 17:35:39.000-0600

I do not use either OSS nor ALSA
This is a server system only running VoIP stuff
It should be pretty obvious this should be fixed IMHO

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-01-13 17:37:42.000-0600

Excuse me, but who gave me a -2 karma for reporting a year old bug?

By: Brian West (bkw918) 2005-01-13 17:50:48.000-0600

Well the reason it goes 100% cpu is you close the ssh session out.. thus it loose the fd its trying to write to.. asterisk will slowly eat itself.  Same thing happens with just about EVERY SINGLE THING OUT THERE... have you seen a screen session lock up?  I have if one person in a -x drops off all screens will lock smooth up.

bkw

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-01-13 17:51:35.000-0600

Mark: This is major if the server is started in debug mode with -p. It makes the fscking box hang. Don't fscking dekarmise me about this!

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-01-13 17:59:51.000-0600

most apps can handle a terminal close. I beleive Asterisk should be able to do so as well, if people want it to. No offence, but perhaps the system should be built for sysadmins, and not just developers

By: Brian West (bkw918) 2005-01-13 18:00:01.000-0600

This is an operators choice to start asterisk in this manner.  Just about anything out there will react in the same manner.  In all honesty asterisk should DIE if you do this but then that defeats the purpose really.  The best way to start asterisk is with safe_asterisk or

"asterisk -pc >/dev/null 2>&1 &" <-- just off the top of my head but this should work.  In any case this is not a bug its the admins choice to start it in any way they see fit but in this case it is in my opinion the wrong way to start asterisk.

bkw

By: Mark Spencer (markster) 2005-01-13 21:41:59.000-0600

While clearly it is not MAJOR by bug guidelines, this is still clearly a bug (either in Asterisk or more likely in the tty layer of whatever system he's running) it should remain open until we can find the root cause.

royk: this will require root access to your machine since obviously most of us cannot duplicate this problem.

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-01-14 04:42:56.000-0600

I just reproduced it on yet another machine (debian sarge on this one as well). And anyway, given just -pc, this will hang up the whole box, making it a major bug imho (sorry - perhaps I should have chosen CRASH instead). If I had one of the test boxes crash, it'll mean I'd have to travel through all city to reboot it.

And, by all means, reporting this with potential wrong priority should not be enough to fuck up my karma!

Talk to me on IRC, and I will give you access to a box for debugging.

By: nick (nick) 2005-01-14 12:55:43.000-0600

My asterisk doesn't hang, but I do get 90%+ CPU usage.  If you're starting with -p, it only makes sense your system would hang with asterisk preempting everything.

Nick

By: Brian West (bkw918) 2005-01-14 12:59:51.000-0600

question is how does it act without the -p or just -c

bkw

By: nick (nick) 2005-01-14 13:24:01.000-0600

That's what I'm saying, with just -c it uses over 90% CPU.  I didn't try -p, because I don't have a preempting kernel.

By: Mark Spencer (markster) 2005-01-15 02:51:56.000-0600

Fixed in CVS head.

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-01-15 03:41:00.000-0600

Thanks. Patch from CVS mailing list applied on 1.0.3 as well.
Any chance of getting this into STABLE?

By: nick (nick) 2005-01-15 10:10:36.000-0600

It won't get into stable unless the bug is 'resolved'.  

Drumkilla manages the stable branch... you can bug him about it.

By: Russell Bryant (russell) 2005-01-15 13:55:16.000-0600

fixed in 1.0

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-06-29 04:23:19

hm
strange
i just witnessed this again with plain 1.0.8+MALLOC_DEBUG. while this was happening, restart (when convenient|now) didn't have any effect to stop it. after a 'stop now' and restart, i was not able to reproduce the error.

an strace -p xxx showed

ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbff80f3c) = -1 ENOTTY (Inappropriate ioctl for device)
write(1, "\nUse EXIT or QUIT to exit the as"..., 47) = 47
write(1, "*CLI> ", 6)                   = 6
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbff80f3c) = -1 ENOTTY (Inappropriate ioctl for device)
write(1, "\nUse EXIT or QUIT to exit the as"..., 47) = 47
write(1, "*CLI> ", 6)                   = 6

roy



By: Kevin P. Fleming (kpfleming) 2005-07-07 19:45:49

Those ioctl numbers do not appear in the Asterisk source code. If some other library on your system is issuing that ioctl on stdin after it has disappeared, it's doubtful whether Asterisk is going to be able to do anything about it.

Can you get us a 'show modules' list from one of the servers that has this problem?

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-07-08 02:16:55

I haven't seen this problem any later
it might have been a sangoma problem

please close the bug

roy

By: Michael Jerris (mikej) 2005-07-08 09:15:55

re-closed at users request.

By: Digium Subversion (svnbot) 2008-01-15 15:21:47.000-0600

Repository: asterisk
Revision: 4798

U   trunk/asterisk.c

------------------------------------------------------------------------
r4798 | markster | 2008-01-15 15:21:47 -0600 (Tue, 15 Jan 2008) | 2 lines

Keep dead console from killing asterisk (bu ASTERISK-3263)

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

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

By: Digium Subversion (svnbot) 2008-01-15 15:21:51.000-0600

Repository: asterisk
Revision: 4802

U   branches/v1-0/asterisk.c

------------------------------------------------------------------------
r4802 | russell | 2008-01-15 15:21:50 -0600 (Tue, 15 Jan 2008) | 2 lines

Keep dead console from killing asterisk (bug ASTERISK-3263)

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

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