Skip to main content
February 19, 2010
Question

LiveStreamcast: Failover bug?

  • February 19, 2010
  • 1 reply
  • 1244 views

I'm using the LiveStreamcast server-side scripts provided by Adobe to test out the failover capanilities of FMS. My setup is as follows:

               ---> Origin 1 ---

             /                       \

Encoder                           Edge ----> Client

             \                       /

               ---> Origin 2 ---

Failover works fine if I disconnect Origin 1 from the network for a short time:  the Edge switches to the feed from Origin 2 and continues streaming to the Client. I reconnect Origin 1 shortly after the switch and the Edge server finds and re-adds the Origin 1 feed as a backup. I can then disconnect Origin 2 and it will switch to Origin 1, ad infinitum.

However! If I leave Origin 1 disconnected from the network after the successful failover, it recieves a NetConnection.Closed event for Origin 1 and then the Origin 2 feed freezes.

I've added debug statements all over the code to make sure that the NetConnection.Closed event isn't somehow causing the LiveStreamcast to remove the Origin 2 feed, but as far as I can tell the Origin 2 feed is still set as the current feed and is never stopped, unsubscribed or otherwise affected. Furthermore, I can stream directly from Origin 2 with no problem. It's as if the NetConnection.Closed event for one feed causes FMS to completely stop all streaming.

Has anyone encountered this problem before (either with LiveStreamcast or otherwise)? It seems like a basic function of failover but I've found no mentions this problem online. Is there a known bug in the LiveStreamcast scripts? Or is there some logic for handling NetConnection.Closed events that I'm missing here? I couldn't find anything in the Server-side Actionscript API about such a case.

Any help would be much appreciated.

    This topic has been closed for replies.

    1 reply

    Asa_-_FMS
    Adobe Employee
    Adobe Employee
    February 20, 2010

    Nice ASCII art.

    As for the problem, what version of FMS are you using?  We fixed some similar problems in the most recent update to FMS.

    Asa

    February 20, 2010

    Thank you. ; )

    I was using the development version of FMS 3.5.1. I just updated to FMS 3.5.3 and tried it out, but I'm having the same problem

    February 20, 2010

    After a bit more inspection, it seems that the stream is freezing because it's being unpublished in the Edge server. Right after the "NetConnection.Connect.Closed" event, the Stream.onStatus returns a "NetStream.Unpublish.Success" event. I've no idea what is causing this Unpublish. The stream has already switched over successfully and the ExLiveStream class doesn't recieve a call to restart or stop the stream. The ExLiveStream does try to remove the original feed, but it has already done so at this point so nothing happens. Here's the trace:


    // Switching from the disconnected Origin 1 to Origin 2

    ExLiveStream livestream:  Unsubscribing from rtmp://192.168.0.5/livestreamcast_origin
    ExLiveStream livestream:  Subscribing to rtmp://192.168.0.4/livestreamcast_origin


    // Stream is restarted and plays successfully from Origin 2
    main: Stream  -- NetStream.Unpublish.Success: livestream is now unpublished.
    main: Stream  -- NetStream.Publish.Start: livestream is now published.
    main: Stream livestream -- NetStream.Play.Reset: Playing and resetting livestream.
    main: Stream livestream -- NetStream.Play.Start: Started playing livestream.


    // NetConnection.Connect.Failed event comes.

    // Tries to remove Origin 1 feed, but it is already gone by this point.
    ExLiveStream livestream:  Connection failed for rtmp://192.168.0.5/livestreamcast_origin. Removing...
    ExLiveStream livestream:  Removing feed rtmp://192.168.0.5/livestreamcast_origin
    ExLiveStream livestream:  rtmp://192.168.0.4/livestreamcast_origin = rtmp://192.168.0.5/livestreamcast_origin ? false


    // And then inexplicably, the stream is unpublished and the video freezes.
    main: Stream  -- NetStream.Unpublish.Success: livestream is now unpublished.