Summary: | ASTERISK-07670: chan_misdn + AGI + ChanIsAvailable(): "Too many open files" and open pipes | ||
Reporter: | alexb (alexb) | Labels: | |
Date Opened: | 2006-09-04 05:38:10 | Date Closed: | 2006-09-06 13:32:29 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_misdn |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | Using chan_misdn via AGI scripts leads to server crash because of a large number of open pipes left behind. The following output shows the problem and the current numbers of open pipes (2800 is Asterisk PID): # lsof -p 2800 | grep pipe asterisk 2800 root 564w FIFO 0,7 323741 pipe asterisk 2800 root 565w FIFO 0,7 323188 pipe asterisk 2800 root 566r FIFO 0,7 323426 pipe asterisk 2800 root 567w FIFO 0,7 323426 pipe asterisk 2800 root 570r FIFO 0,7 325565 pipe asterisk 2800 root 571w FIFO 0,7 325565 pipe asterisk 2800 root 572r FIFO 0,7 325785 pipe asterisk 2800 root 573w FIFO 0,7 325785 pipe asterisk 2800 root 576r FIFO 0,7 323892 pipe asterisk 2800 root 577w FIFO 0,7 323892 pipe asterisk 2800 root 578r FIFO 0,7 325990 pipe asterisk 2800 root 579w FIFO 0,7 325990 pipe asterisk 2800 root 580u FIFO 0,7 328576 pipe asterisk 2800 root 581u FIFO 0,7 328576 pipe asterisk 2800 root 582r FIFO 0,7 328837 pipe asterisk 2800 root 583w FIFO 0,7 328837 pipe # lsof -p 2800 | grep pipe -c 532 Please note that the server is running since only a couple of hours, so you can understand that open pipes grow very fast. I've also found that every mISDN call leaves 2 open pipes behind: root@efw-voiceone:~ # lsof -p 2682 | grep pipe -c 4 root@efw-voiceone:~ # lsof -p 2682 | grep pipe -c // 1st call start 10 root@efw-voiceone:~ # lsof -p 2682 | grep pipe -c 10 root@efw-voiceone:~ # lsof -p 2682 | grep pipe -c 10 root@efw-voiceone:~ # lsof -p 2682 | grep pipe -c // 1st call end: 4->6 6 root@efw-voiceone:~ # lsof -p 2682 | grep pipe -c // 2nd call start 12 root@efw-voiceone:~ # lsof -p 2682 | grep pipe -c 12 root@efw-voiceone:~ # lsof -p 2682 | grep pipe -c 12 root@efw-voiceone:~ # lsof -p 2682 | grep pipe -c // 2nd call end: 6->8 8 Chan_misdn w/o AGI works like a charm! | ||
Comments: | By: crich (crich) 2006-09-04 06:52:18 Could you briefly describe what the agi does, or put here this agi script so i can test that. By: alexb (alexb) 2006-09-04 10:16:56 Hi Crich, I've simply tested with an AGI that launches a dialplan macro: dial.php: . . if ($action==RULE_ALLOW) { if ($resource!="0" and $mandatoryChannel=="") { $agi->set_variable("TRUNK", $channel); error_log(" Set Trunk to $channel"); } else if ($mandatoryChannel!="") { $agi->set_variable("TRUNK", $mandatoryChannel); error_log(" Set Trunk to the mandatory $mandatoryChannel"); } else error_log(" It's Allowed (Trunk: *)"); $extension=substr($extension,strlen($outgoing_prefix)); error_log(" ----------------> macro dialout|$extension"); //$agi->text2wav ("You are calling the number $extension"); $agi->exec("macro dialout|$extension"); $canContinue=false; } . . where TRUNK is something like "mISDN/g:ext1&SIP/MessageNet&IAX2/FWD" and $extension is the destination number. [macro-dialout] exten = s,1,Set(TOUCH_MONITOR=${TIMESTAMP}_${CALLERIDNUM}-${ARG1}) exten = s,n,ChanIsAvail(${TRUNK}) exten = s,n,Set(OUTGOING_CHANNEL=${CUT(AVAILCHAN,,1)}) exten = s,n,NoOp(${OUTGOING_CHANNEL}) exten = s,n,Dial(${OUTGOING_CHANNEL}/${ARG1}${TRUNKOPTIONS}||gTW) exten = s,n,NoOp(DIALSTATUS = ${DIALSTATUS}) exten = s,n,Goto(s-${DIALSTATUS},1) exten = s-BUSY,1,Playtones(busy) exten = s-CONGESTION,1,Playtones(congestion) exten = _s-.,1,Goto(s-CONGESTION,1) The PHP script is quite complex and can't work "as is" out of our platform - needs some additional information from a db. However you should be able to reproduce the same behaviour with a simple script that just launches the macro. Let me know if I can help. By: alexb (alexb) 2006-09-04 11:45:39 Forgot to say that we currently use both the script and the macro with other channels, i.e. chan_sip, chan_iax, etc., and they have no problems at all. By: alexb (alexb) 2006-09-04 11:59:12 Slightly changed my previous post (ASTERISK-4985195) because I mixed up some variables definition, sorry. By: alexb (alexb) 2006-09-04 12:06:10 Full code can be retrieved from here, although I don't think it will be particularly useful: http://svn.sourceforge.net/viewvc/voiceone/trunk/voiceone_webservices/agi/dial.inc.php?view=markup By: alexb (alexb) 2006-09-06 08:54:21 Hi Crich, any news, please? By: crich (crich) 2006-09-06 10:53:16 well i'm sorry i have tested the following setup: ISDN Phone <--> mISDN <--> asterisk <---> agi <---> macro <--> dial(SIP) <--> SIP Phone either with connect or without connect. I can see the pipes growing after the connect, but the shrink after the hangup back to the original value. So unfortunately i cannot reproduce your problem By the way i've used the agi-test.agi script and modified it to call a macro from the dialplan, this uses perl, but this should not make any difference. Are you maybe using eagi ? By: alexb (alexb) 2006-09-06 11:40:26 No, I use AGI, for example: exten = _X.,1,AGI(dial.php|entity=&group=5&extension=${EXTEN}) However, I've just found that the problem is related to ChanIsAvail!!! If I use that application in my macro (and I use it! - please see my first post), it leaves two open pipes behind. Without ChanIsAvail, I have no open pipes... By: crich (crich) 2006-09-06 11:44:02 you're right, this has nothing to do with AGI, i just used the following extensions.conf: exten => s,1,ChanIsAvail(mISDN/g:out/123) exten => s,2,hangup and every call leaves 2 pipes open :-) ! That's great i think i can try to fix it now, let me see.. By: alexb (alexb) 2006-09-06 11:46:51 This is a sample macro that leaves open pipes: [macro-dialout] exten = s,1,ChanIsAvail(mISDN/g:ext1) ; I even do not use its output!!! exten = s,n,Dial(mISDN/g:ext1/${ARG1}||gTW) The same macro, just changed as follows [macro-dialout] exten = s,1,Dial(mISDN/g:ext1/${ARG1}||gTW) works like a charm! However, please note that chan_sip, etc. have no problems with the first macro. Hope this will help you. In the meanwhile, thanks! By: crich (crich) 2006-09-06 12:11:31 fixed the bug in svn (1.2, revision 42110) just svn up and test again. By: Serge Vecher (serge-v) 2006-09-06 13:32:28 also, fixed in trunk with r42126. If the problem still persists after the upgrade, please feel free to reopen the issue. |