[fixed] Resource Server sometime fails (1 Viewer)

morpheus_xx

Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    @MJGraf @FreakyJ @osre

    There still seems to be issues with our used HttpServer and/or our CachedMultiSegmentHttpStream:
    https://github.com/MediaPortal/Medi...ccess/CachedMultiSegmentHttpStream.cs#L37-L49

    This class is used to load small chunks from the server, also in parallel (read ahead which improves linear access).

    Code:
    [2015-09-30 16:46:44,875] [179921 ] [114  ] [ERROR] - HttpRangeChunk: Error receiving data from http://192.168.2.21:64943/GetResource?ResourcePath=%7b03dd2da6-4da8-4d3e-9e55-80e3165729a3%7d%3a%2f%2f%2f%2fSERVERHOST%2fvideo%2fVideo-Archiv%2fThomas%2fklein%2fThomas+und+seine+Freunde+-+DVD01-E08+-+Eine+%c3%9cberraschung+f%c3%bcr+Percy.avi
    System.Net.WebException: Die Anfrage wurde abgebrochen: Die Anfrage wurde abgebrochen..
      bei System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
      bei MediaPortal.Common.Services.ResourceAccess.CachedMultiSegmentHttpStream.HttpRangeChunk.OnResponseReceived(IAsyncResult ar)

    This class is configurable in different parameters:
    • The chunk size (size of each chunk, fetched in a single request), 512kb
    • The number of read-ahead chunks (parallel fetched in advance), 4
    • The number of caches of the already read chunks, 20 (multiplied by chunk size = 10MB)
    The quite small chunk size was chosen to support nearly "blockwise" random access, which was better for seeking. It was also for requesting many file (i.e. you mount a remote BD image and the client side BD reader tries to access the metadata files).

    But i.e. for linear playback, probably a larger size and a reduces number of lookaheads/caches would be better.

    The small chunk size also leads to many request, which is probably the cause why the HttpServer in MP2-Server will "break" at some time and closes connections.

    What do you think about this issue? Should we try to tweak the parameters or is there another idea how to stream many files more efficiently from server?

    @ulischultz I would first modify this component and provide you a testbuild, so you can check if this improves situation for you.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #3
    Here's a first test build with modified parameters as follows:
    public const int CHUNK_SIZE = 4 * 512 * 1024; // 4 * 512 kB chunk size
    public const int NUM_READAHEAD_CHUNKS = 2;
    public const int MAX_NUM_CACHES = 10;

    So you have 4 times greater chunks, 2 less read aheads and half caches.

    Please make a backup of the existing file inside C:\Program Files (x86)\Team MediaPortal\MP2-Client\MediaPortal.Common.dll and then replace it with the one from archive.

    For testing there is nothing special to look for: only try playback and we will see if the interruptions are gone (or at least less)
     

    Attachments

    • 20151001-MediaPortal.Common.dll-Test_4MB_2_10.7z
      168 KB

    ulischultz

    Portal Pro
    September 16, 2009
    156
    8
    Munich
    Home Country
    Germany Germany
    It seems, that this solved my problem!
    Only when resuming from standby, it takes up to 45sec until the server is connected.
    If I restart MP2 after resume, the connection is immediatly there.
     

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Should we try to tweak the parameters or is there another idea how to stream many files more efficiently from server?
    Very good idea!
    I also thought about tweaking this class a couple of times. If I remember correctly, it could also need some more multithreading because it first blocks until all three chunks are loaded, but we can do this after it is stable.
    Sorry, I have very Little time currently and can't help (work is killing me...)
    Thanks for the initiative, Morph!
     

    Users who are viewing this thread

    Top Bottom