[asterisk-bugs] [Asterisk 0013257]: crash if hangup during sip_read

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Aug 20 09:57:21 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13257 
====================================================================== 
Reported By:                travishein
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   13257
Category:                   Channels/chan_sip/General
Reproducibility:            unable to reproduce
Severity:                   minor
Priority:                   normal
Status:                     feedback
Asterisk Version:           1.4.20 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-08-07 21:26 CDT
Last Modified:              2008-08-20 09:57 CDT
====================================================================== 
Summary:                    crash if hangup during sip_read
Description: 
This one might be similar to http://bugs.digium.com/view.php?id=13256, although
this time it appears to crash
from within the sip_read. It is almost as if the application that was
invoked from the realtime_exec entered a state of waiting for an input from
the user, but the user hung up during this waiting period, so when the
system starts looking for the response after the wait period, in this case
the channel had closed,

At least that's my view from the outside impression, the last line printed
to teh console was:

WARNING[6784]: rtp.c:1140 ast_rtp_read: RTP Read error: Socket operation
on non-socket.  Hanging up.

currently on 1.4.20rc2
====================================================================== 

---------------------------------------------------------------------- 
 (0091580) putnopvut (administrator) - 2008-08-20 09:57
 http://bugs.digium.com/view.php?id=13257#c91580 
---------------------------------------------------------------------- 
The console trace that you provided showed that for some reason, recvfrom()
failed when trying to read RTP because it thought that the file descriptor
passed in was not a socket. The problem is that the rtp socket file
descriptor is always initialized using socket(2), so it can't be that we're
trying to read from an uninitialized file descriptor.

I did notice, however, that the return value of socket(2) is pretty much
ignored, so error handling needs to be handled better and earlier in case
something wrong occurs when attempting to create the socket. The problem is
that I thought that if  a call to socket(2) were to fail and later we
attempted to read from it, errno would be set to EBADF instead of ENOTSOCK.
I can't seem to find definitive documentation on this, though.

Also, since sip_rtp_read has the potential to return NULL, it needs to be
handled properly in sip_read. What I will do is add proper error checking
to all places which initialize the rtp socket and add error checking to
sip_read so that the possible NULL return does not cause a catastrophic
failure. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-08-20 09:57 putnopvut      Note Added: 0091580                          
======================================================================




More information about the asterisk-bugs mailing list