[Home]

Summary:ASTERISK-01457: [patch] agi sometimes gets fdopen error
Reporter:jblumenfeld (jblumenfeld)Labels:
Date Opened:2004-04-22 15:53:02Date Closed:2008-01-15 14:51:39.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_agi.diff
( 1) app_agi.diff
Description:When running several AGI's at the same time, one or more may report an error on fdopen:

'Unable to fdopen file descriptor'

As a result, the spawned agi script cannot read in any of the environment information.  

I am able to reproduce this by starting several  agi scripts in very quick succession.

System Info:
Asterisk CVS-04/16/04-16:37:42 on a i686 running Linux

Red Hat Linux release 8.0 (Psyche)
Linux 2.4.18-27.8.0 #1 Fri Mar 14 07:36:43 EST 2003 i686 athlon i386 GNU/Linux

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

This appears to be caused by closing a file descriptor twice when finishing the agi.  First calling fclose() at the end of run_agi function and then again calling close() after run_agi has returned.

The two close events happen very close together so generally this is OK, but if there are several agi's starting up and finishing at the same time it's possible for a new agi to get the same file descriptor that has been closed the first time before it gets closed the second time.

I'll attach a proposed patch to file apps/app_agi.c.
Comments:By: Brian West (bkw918) 2004-04-22 16:53:19

diff -u please

By: Mark Spencer (markster) 2004-04-23 00:33:43

Fixed in -head and -stable.  Thanks!

By: Digium Subversion (svnbot) 2008-01-15 14:51:38.000-0600

Repository: asterisk
Revision: 2750

U   branches/v1-0_stable/apps/app_agi.c

------------------------------------------------------------------------
r2750 | markster | 2008-01-15 14:51:38 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix double close of file descriptor (bug ASTERISK-1457)

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

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

By: Digium Subversion (svnbot) 2008-01-15 14:51:39.000-0600

Repository: asterisk
Revision: 2751

U   trunk/apps/app_agi.c

------------------------------------------------------------------------
r2751 | markster | 2008-01-15 14:51:39 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix double close of file descriptor (bug ASTERISK-1457)

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

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