[Live-devel] RTSP server hang
Ross Finlayson
finlayson at live555.com
Sun Jun 13 19:16:32 PDT 2010
>Under load, I'm noticing our RTSP server occasionally hangs in this location:
>
>static int blockUntilReadable(UsageEnvironment& env,
> int socket, struct timeval* timeout) {
> int result = -1;
> do {
> fd_set rd_set;
> FD_ZERO(&rd_set);
> if (socket < 0) break;
> FD_SET((unsigned) socket, &rd_set);
> const unsigned numFds = socket+1;
>
> result = select(numFds, &rd_set, NULL, NULL, timeout); <--HANG
You know what? Now that we have fixed "RTSPClient" so that we no
longer do any synchronous socket reads - i.e., we now read from a
socket only when we're notified from the event queue that new data is
available on the socket - we should no longer ever need to call
"blockUntilReadable()" at all!
I.e., you should be able to remove the following code from the
implementation of "readSocket()" in "groupsock/GroupsockHelper.cpp"
(line 265):
int result = blockUntilReadable(env, socket, timeout);
if (timeout != NULL && result == 0) {
bytesRead = 0;
break;
} else if (result <= 0) {
break;
}
and I think everything will work OK (only more efficiently!).
So give this a try. If you run into any problems, let us know. (If
not, I'll remove this code from the next release of the software.)
--
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list