[Asterisk-Dev] ast_waitstream_full: Wait failed (Resource temporarily unavailable)

Dinesh Nair dinesh at alphaque.com
Wed Sep 29 02:10:46 MST 2004


hi * developers,

for a given extension,

exten => 16,1,Read(ENTERED,privacy-prompt,10)
exten => 16,2,NoOp(${ENTERED})
exten => 16,3,SayDigits(${ENTERED})
exten => 16,4,Playback(vm-and)
exten => 16,5,SayNumber(${ENTERED})
exten => 16,6,Hangup

i get the following out when "987654321" is entered for the Read:

     -- Executing Read("SIP/1234-8285", "ENTERED|privacy-prompt|10") in new
stack
     -- Accepting a maximum of 10 digits.
     -- Playing 'privacy-prompt' (language 'en')
     -- User entered '987654321'
     -- Executing NoOp("SIP/1234-8285", "987654321") in new stack
     -- Executing SayDigits("SIP/1234-8285", "987654321") in new stack
     -- Playing 'digits/9' (language 'en')
     -- Playing 'digits/8' (language 'en')
     -- Playing 'digits/7' (language 'en')
     -- Playing 'digits/6' (language 'en')
     -- Playing 'digits/5' (language 'en')
     -- Playing 'digits/4' (language 'en')
     -- Playing 'digits/3' (language 'en')
     -- Playing 'digits/2' (language 'en')
     -- Playing 'digits/1' (language 'en')
     -- Executing Playback("SIP/1234-8285", "vm-and") in new stack
     -- Playing 'vm-and' (language 'en')
     -- Executing SayNumber("SIP/1234-8285", "987654321") in new stack
     -- Playing 'digits/9' (language 'en')
     -- Playing 'digits/hundred' (language 'en')
     -- Playing 'digits/80' (language 'en')
     -- Playing 'digits/7' (language 'en')
     -- Playing 'digits/million' (language 'en')
Sep 29 15:24:39 WARNING[135177216]: file.c:1058 ast_waitstream_full: Wait
failed (Resource temporarily unavailable)
   == Spawn extension (default, 16, 5) exited non-zero on 'SIP/1234-8285'

the error, (Wait failed) happens quite frequently and is largely
unpredictable, i.e. in some cases 987654321 goes thru fine. other times, it
occurs for smaller numbers as well (1,025 or 4,387 et al). i've narrowed
down the problem to ast_waitfor_nandfds() (in channel.c) returning NULL to
ast_waitstream_full()(in file.c) which itself returns -1.

i also found that replacing ast_waitstream_full() with ast_waitstream() 
makes this go away. the relevant snippet from ast_say_number_full_en() (in 
say.c) is

if (!res) {
	if(!ast_streamfile(chan, fn, language)) {
		if (audiofd && ctrlfd)
			res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
		else
			res = ast_waitstream(chan, ints);
	}
	ast_stopstream(chan);
}

i've tried to debug ast_waitfor_nanfds() but could not discover exactly
what condition is causing it to return the NULL. all my ast_log()
statements before any return were oddly not executed.

based on my testing (limited though it may be), audiofd and ctrlfd is 
always -1, and thus there shouldn't be a need to listen for i/o on any file 
descriptors. what would the implications be if i patched say.c to be:

if (!res) {
	if(!ast_streamfile(chan, fn, language)) {
		if (audiofd > -1 && ctrlfd > -1)
			res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
		else
			res = ast_waitstream(chan, ints);
	}
	ast_stopstream(chan);
}

in essence, would the above be correct and not break anything else ?
pointers would be much appreciated.'

some background info:

Asterisk 1.0.0 (as released by mark at astricon)
patched for FreeBSD 4.10
no Zaptel/Digium cards, hence no timing info
(compiled without ZAP support)

-- 
Regards,                           /\_/\   "All dogs go to heaven."
dinesh at alphaque.com                (0 0)    http://www.alphaque.com/
+==========================----oOO--(_)--OOo----==========================+
| for a in past present future; do                                        |
|   for b in clients employers associates relatives neighbours pets; do   |
|   echo "The opinions here in no way reflect the opinions of my $a $b."  |
| done; done                                                              |
+=========================================================================+


-- 
Regards,                           /\_/\   "All dogs go to heaven."
dinesh at alphaque.com                (0 0)    http://www.alphaque.com/
+==========================----oOO--(_)--OOo----==========================+
| for a in past present future; do                                        |
|   for b in clients employers associates relatives neighbours pets; do   |
|   echo "The opinions here in no way reflect the opinions of my $a $b."  |
| done; done                                                              |
+=========================================================================+



More information about the asterisk-dev mailing list