Skip to main content
June 1, 2010
Question

TIME_WAIT then disconnect when republishing

  • June 1, 2010
  • 1 reply
  • 821 views

Hi there

I am using FMIS 3.5.3 (Linux)  to fork an RTMP stream from FMS to two different CDNs.  My FMS  application does roughly the following:

1) Client.prototype.FCPublish()  creates two NetConnections, one for each CDN

2) Each  NetConnection's onStatus() creates a new NetStream object if info.code  == 'NetConnection.Connection.Success'

3) The stream that's  supplied to FCPublish() is attached to each NetStream

4)  .publish(stream.name, "live") is run on each NetStream

The stream  coming out of the CDNs works fine for about 3-4 minutes, and then  stalls.  When this happens I see no NetConnection, NetStream or Stream  status changes (their onStatus()s don't get fired), and when I check  netstat, I see the connections to the CDNs are no longer there.

I did a bit  more investigating, and found that the connections are in ESTABLISHED while working, then just before the stream stalls the connections go into TIME_WAIT and then disappear.

Can anyone shed some light on what's happening  here?

    This topic has been closed for replies.

    1 reply

    June 1, 2010

    If it helps anyone to help me, I get this in the log just before the disconnection:

    session connect-pending 2010-06-01      10:50:31        30605   CDN1-IP-REMOVED  3209    8838946 -       -       -       -       100     -
    session connect 2010-06-01      10:50:31        30605   CDN1-IP-REMOVED  3209    8838946 -       -       -       -       400     -
    session disconnect      2010-06-01      10:50:31        30605   CDN1-IP-REMOVED  3209    8838946 -       -       -       -       200     -
    session connect-pending 2010-06-01      10:50:31        30605   CDN2-IP-REMOVED  3198    8824677 -       -       -       -       100     -
    session connect 2010-06-01      10:50:31        30605   CDN2-IP-REMOVED  3198    8824677 -       -       -       -       400     -
    session disconnect      2010-06-01      10:50:31        30605   CDN2-IP-REMOVED  3198    8824677 -       -       -       -       200     -

    Janaki Lakshmikanthan
    Adobe Employee
    Adobe Employee
    June 1, 2010

    Can you pass me your server side application? it was a clean disconnect from the access log statement. Just wondering if the connection is broken because of network issues.

    Regards,

    Janaki L

    June 1, 2010

    My Client.prototype.FCPublish looks like this.  My other application methods like onAppStart just trace().

    Client.prototype.FCPublish = function (streamName) {
            trace("Client.prototype.FCPublish(): "+streamName);
            var stream = Stream.get(streamName);

            stream.onStatus = function (info) {
                    trace("stream.onStatus(): "+info.code);
            }

            var ns1;
            var nc1 = new NetConnection();
            nc1.onStatus = function (info) {
                    trace("nc1.onStatus(): "+info.code);
                    if (info.code == "NetConnection.Connect.Success") {
                            ns1 = new NetStream(nc1);
                            ns1.onStatus = function (info) {
                                    trace("ns1.onStatus(): "+info.code);
                            }
                            ns1.attach(stream);
                            ns1.setBufferTime(2);
                            ns1.publish("stream1", "live");
                    }
                    else { 
                            trace("nc1.onStatus(): "+info.code);
                    }
            }
            nc1.connect("RTMP OF CDN 1");

            var ns2;
            var nc2 = new NetConnection();
            nc2.onStatus = function (info) {
                    trace("nc2.onStatus(): "+info.code);
                    if (info.code == "NetConnection.Connect.Success") {
                            ns2 = new NetStream(nc2);
                            ns2.onStatus = function (info) {
                                    trace("ns2.onStatus(): "+info.code);
                            }
                            ns2.attach(stream);
                            ns2.setBufferTime(2);
                            ns2.publish("stream2", "live");
                    }
                    else { 
                            trace("nc2.onStatus(): "+info.code);
                    }
            }
            nc2.connect("RTMP OF CDN 2");
    }