MP1-4502 - ChannelState.DoSetChannelStates: An unknown error occured while setting channel states

Discussion in 'General Support' started by popy, February 5, 2014.

  1. popy
    • Super User

    popy Super User

    Joined:
    July 3, 2011
    Messages:
    616
    Likes Received:
    83
    Ratings:
    +141 / 2
    Show System Specs
    Hey guys.

    Trying to find an issue on my MP 1.6 Multiseat installation.
    Also have opened an Thread in the german section: https://forum.team-mediaportal.com/...e-setting-channel-states.124083/#post-1056150
    But there is no answer since an month now, so i decided to post here in the english forum.

    My setup:
    Multiseat: Server with TVService 1.6 Final and 2x MP Clients with 1.6 Final

    Issue:
    Mediaportal and TVService running stable for some time/days.
    Then there are some exceptions in the TVService Error Log.
    two times also TVservice.exe has closed itself.

    Code (Text):
    1.  
    2. [2014-02-05 12:35:34,743] [Log    ] [Channel state thread] [ERROR] - ChannelState.DoSetChannelStates: An unknown error occured while setting channel states - select idTuning, idChannel, name, provider, channelType, channelNumber, frequency, countryId, isRadio, isTv, networkId, transportId, serviceId, pmtPid, freeToAir, modulation, polarisation, symbolrate, diseqc, switchingFrequency, bandwidth, majorChannel, minorChannel, videoSource, audioSource, isVCRSignal, tuningSource, band, satIndex, innerFecRate, pilot, rollOff, url, bitrate from TuningDetail where idChannel = ?idChannel;
    3. Error: StatementErrorUnclassified
    4. Gentle.Common.GentleException: select idTuning, idChannel, name, provider, channelType, channelNumber, frequency, countryId, isRadio, isTv, networkId, transportId, serviceId, pmtPid, freeToAir, modulation, polarisation, symbolrate, diseqc, switchingFrequency, bandwidth, majorChannel, minorChannel, videoSource, audioSource, isVCRSignal, tuningSource, band, satIndex, innerFecRate, pilot, rollOff, url, bitrate from TuningDetail where idChannel = ?idChannel; ---> System.Threading.ThreadAbortException: Der Thread wurde abgebrochen.
    5.    bei System.Net.UnsafeNclNativeMethods.OSSOCK.recv(IntPtr socketHandle, Byte* pinnedBuffer, Int32 len, SocketFlags socketFlags)
    6.    bei System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
    7.    bei System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
    8.    bei System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    9.    bei System.IO.BufferedStream.ReadByte()
    10.    bei MySql.Data.MySqlClient.MySqlStream.LoadPacket()
    11.    bei MySql.Data.MySqlClient.MySqlStream.OpenPacket()
    12.    bei MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
    13.    bei MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
    14.    bei MySql.Data.MySqlClient.MySqlDataReader.NextResult()
    15.    bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
    16.    bei MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
    17.    bei System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
    18.    bei Gentle.Framework.SqlStatement.Execute(IDbConnection conn, IDbTransaction tr)
    19.    --- Ende der internen Ausnahmestapelüberwachung ---
    20.    bei Gentle.Framework.SqlStatement.Execute(IDbConnection conn, IDbTransaction tr)
    21.    bei Gentle.Framework.PersistenceBroker.Execute(SqlStatement stmt, IDbConnection dbConnection, IDbTransaction dbTransaction)
    22.    bei TvDatabase.Channel.ReferringTuningDetail()
    23.    bei TvDatabase.TvBusinessLayer.GetTuningChannelsByDbChannel(Channel channel)
    24.    bei TvService.ChannelStates.DoSetChannelStates(IDictionary`2 cards, ICollection`1 channels, ICollection`1 allUsers, IController tvController)System.Threading.ThreadAbortException: Der Thread wurde abgebrochen.
    25.    bei System.Net.UnsafeNclNativeMethods.OSSOCK.recv(IntPtr socketHandle, Byte* pinnedBuffer, Int32 len, SocketFlags socketFlags)
    26.    bei System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
    27.    bei System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
    28.    bei System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    29.    bei System.IO.BufferedStream.ReadByte()
    30.    bei MySql.Data.MySqlClient.MySqlStream.LoadPacket()
    31.    bei MySql.Data.MySqlClient.MySqlStream.OpenPacket()
    32.    bei MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
    33.    bei MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
    34.    bei MySql.Data.MySqlClient.MySqlDataReader.NextResult()
    35.    bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
    36.    bei MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
    37.    bei System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
    38.    bei Gentle.Framework.SqlStatement.Execute(IDbConnection conn, IDbTransaction tr)
    39.  
    What i have done:
    • Setup TVSERVICE.exe to restart on error (on an WHS2011)
    • Reinstall tvserver from scratch
    • Do a new channel search, not importing the old ones
    • Setup tvservice settings, have made screenshots and setup all from the SetupTV.exe GUI
    • now i am able to reproduce the issue with "test Channels" function in the SetupTV, after starting the test, ignored counts up (also succeed) and those errors are in the TVService-Error.log
    upload_2014-2-5_12-42-41.png

    here are the logs:



    Log from normale use of clients: https://forum.team-mediaportal.com/attachments/log-dosetchannelstate-2-zip.144959/
    Log from "test channels" test: https://forum.team-mediaportal.com/attachments/log-dosetchannelstate-test-channels-zip.144961/

    Please can a MP dev check the logs and help me.

    thx
    pOpY
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,527
    Likes Received:
    4,738
    Ratings:
    +8,205 / 17
    Home Country:
    New Zealand New Zealand
    Hello popy

    Sorry but I don't see the connection between the exception and the crash. If the TV service was crashing and set to restart on error then I'd expect to see it auto-restart... but I don't see that.

    mm
     
  4. popy
    • Super User

    popy Super User

    Joined:
    July 3, 2011
    Messages:
    616
    Likes Received:
    83
    Ratings:
    +141 / 2
    Show System Specs
    Hello mm1352000.

    You are rigth, i have changed logs and it seems there was no crash.
    The crash doesnt come up immediately, there are those DoSetChannelState Exceptions and after a couple of days it crashes.
    have now set the log level to debug and disabled automatic restart on crash. So if it happens i have debug logs of the crash.

    I AM NOT ALONE, in the german thread another user has the problem.
    He means the Problem is reproduceable and also the crash doesnt come up immediately, but after some time the service crashes.

    The crash ill think is related to the exception, so we should try to find the cause of the exception.

    Steps to reproduce, thx JayDee1704 from german thread:
    When you change a channel on a client and the tv service must change the card -> the issue (exception) occurs.
    Also when you change the channel with "manual control" in Setuptv.exe

    Example:
    if channel 1 (ARD) is mapped to card 1 and channel 2 (ZDF) is mapped to card 2.
    Now when you change channel from ARD to ZDF -> the issue (exception) occurs.

    If no card is changed on changing channel or you stop playback before changing the channel, the issue DOESNT come up.

    hope a dev could reproduce fix the issue.
    here logs from yesterday where the exception occurs (but no crash, yet) and loglevel is DEBUG.

    thx
    pOpY[DOUBLEPOST=1391760889][/DOUBLEPOST]ok guys, have tried to reproduce the issue, like described from JayDee1704.
    But with manual control in setuptv.exe i am not able to reproduce the issue.

    Will try it when i am at home with mediaportal as clients.

    cu
    pOpY
     
    Last edited: February 7, 2014
  5. popy
    • Super User

    popy Super User

    Joined:
    July 3, 2011
    Messages:
    616
    Likes Received:
    83
    Ratings:
    +141 / 2
    Show System Specs
    JayDee (from german thread) and i was able to reproduce the issue like described above.
    Just the exception and not the crash, like mentioned before, the crash comes a few days later.

    Here are the logs: this (from JayDee) and this from me

    Can please any dev have a look at those logs?

    thx
    pOpY
     
  6. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,527
    Likes Received:
    4,738
    Ratings:
    +8,205 / 17
    Home Country:
    New Zealand New Zealand
  7. popy
    • Super User

    popy Super User

    Joined:
    July 3, 2011
    Messages:
    616
    Likes Received:
    83
    Ratings:
    +141 / 2
    Show System Specs
    You are right, the crash didnt happend very frequently. But the only exceptions i had in tvservice-error log was those dosetchannelstate exceptions.
    Does the Watchdog methode (like you mentioned above) also work if JUST tvservice is running on my server?

    Why dont investigate into the excpetion rather than the crash?
    From the exception there are many logs now and its reproducable.

    thx
    pOpY
     
  8. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,527
    Likes Received:
    4,738
    Ratings:
    +8,205 / 17
    Home Country:
    New Zealand New Zealand
    Okay.

    No, and that is why I said:
    So, please post those files.

    Because if the exception is harmless - ie. not related to the crash - then I don't see much point in spending a lot of time investigating it.
    If I could be sure that the exception was related to the crash then I'd investigate it... but right now I don't know that, so I'm more interested in focusing on the crash.

    Sure. As above:
    1. The exception might or might not be related to the crash.
    2. I care more about the crash than the exception.
    mm
     
  9. popy
    • Super User

    popy Super User

    Joined:
    July 3, 2011
    Messages:
    616
    Likes Received:
    83
    Ratings:
    +141 / 2
    Show System Specs
    ok, on next crash i will post event logs and tvservice logs.

    popy
     
  10. Wiedmann

    Wiedmann Portal Pro

    Joined:
    June 22, 2007
    Messages:
    107
    Likes Received:
    12
    Ratings:
    +27 / 3
    Home Country:
    Germany Germany
    You're not serious, are you?

    An exception isn't harmless in any way.
    And if you read through the forum you can recognise: This (or similar) exceptions regarding database connections happens with or without a server crash.

    And of course:
    It's not a problem with the MySQL daemon or the network connection (in my case I use a local pipe). It's just something in TV service is dropping the connection (or destroying the connection object) even the connection is still in use by some other part.

    Every time this happens, MySQL is also counting this as aborted client.

    This guy is having this problem if he is using channel groups, but not without groups.

    BTW database usage. Can you explain this:

    Connections from TV Service to MySQL:
    ø per second: 58
    ø per minute: 3454

    ø per hour : 207265


    Statements:
    change db: 102900 / hour = 49.64 %
    select : 56600 / hour = 27,31 %
    update : 46100 / hour = 22,26 %
    other : 1665 / hour = 0,79 %


    Half the time (29/second) TV Server is doing a "useless" command, because connection and setting default database is already done. And don't you think a lot of db usage for a single-seat system?
    If you look at the other statistics, even a couple of indexes seem to be missing. Or some queries should be rewritten.
     
  11. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,527
    Likes Received:
    4,738
    Ratings:
    +8,205 / 17
    Home Country:
    New Zealand New Zealand
    I'm absolutely serious. Maybe "harmless" wasn't the best choice of word, but the "not related to the crash" part definitely says what I meant to say. I'm interested in focusing on the crash. I'm not interested in investigating the exception unless it is related to the crash or some other serious problem.

    As above: maybe "harmless" wasn't the best choice of word. However these days some developers use exception throwing and catching routinely. In other words, exceptions don't always point to a fatal condition or failure that ought to be exhaustively investigated and fixed.

    Sure. If an exception is causing some kind of error or bug - for example, the UI fails to load a channel list or EPG data - then sure it might be necessary to investigate and fix something. However most of the time with MP database related exceptions this is not the case.

    In this case I have yet to see any evidence that the exception you're referring to is related to the crash. I also don't see any evidence that it is causing any kind of error or bug. If you have evidence then please by all means provide it.

    I'm not sure what you want me to do with this information.
    Please understand that I'm working within a much larger context. TVE 3 uses a third party persistence framework (gentle.NET) to handle all the database related stuff. That framework is no longer being developed. Most of my time working on MP these days is spent on TVE 3.5, which has removed gentle.net in favour of Microsoft's Entity Framework. TVE 3.5 is already in use with MP2, and I'm hoping a version for MP1 will be released this year.

    In my opinion it is not worth my time investigating such database exceptions with TVE 3 unless they are really causing operational or reliability problems. gentle.net is going away and my belief is that these sorts of exceptions will go away with it. EF will bring its own set of challenges.

    Does this help you understand my perspective? :)

    Nope, I can't explain it.
    As above: TV Server doesn't interact with the database directly. Everything goes through the gentle.NET framework which I consider obsolete. Gentle.NET is responsible for converting code expressions to queries which are database engine specific. It is entirely possible that some of these queries are not as efficient as they could be. That is a common tradeoff when using a database abstraction layer.
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!