MP1-4502 - ChannelState.DoSetChannelStates: An unknown error occured while setting channel states (1 Viewer)

popy

Super User
  • Team MediaPortal
  • Super User
  • July 3, 2011
    617
    141
    Country flag
    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:
    [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;
    Error: StatementErrorUnclassified
    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.
       bei System.Net.UnsafeNclNativeMethods.OSSOCK.recv(IntPtr socketHandle, Byte* pinnedBuffer, Int32 len, SocketFlags socketFlags)
       bei System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
       bei System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
       bei System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
       bei System.IO.BufferedStream.ReadByte()
       bei MySql.Data.MySqlClient.MySqlStream.LoadPacket()
       bei MySql.Data.MySqlClient.MySqlStream.OpenPacket()
       bei MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
       bei MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
       bei MySql.Data.MySqlClient.MySqlDataReader.NextResult()
       bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
       bei MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       bei System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
       bei Gentle.Framework.SqlStatement.Execute(IDbConnection conn, IDbTransaction tr)
       --- Ende der internen Ausnahmestapelüberwachung ---
       bei Gentle.Framework.SqlStatement.Execute(IDbConnection conn, IDbTransaction tr)
       bei Gentle.Framework.PersistenceBroker.Execute(SqlStatement stmt, IDbConnection dbConnection, IDbTransaction dbTransaction)
       bei TvDatabase.Channel.ReferringTuningDetail()
       bei TvDatabase.TvBusinessLayer.GetTuningChannelsByDbChannel(Channel channel)
       bei TvService.ChannelStates.DoSetChannelStates(IDictionary`2 cards, ICollection`1 channels, ICollection`1 allUsers, IController tvController)System.Threading.ThreadAbortException: Der Thread wurde abgebrochen.
       bei System.Net.UnsafeNclNativeMethods.OSSOCK.recv(IntPtr socketHandle, Byte* pinnedBuffer, Int32 len, SocketFlags socketFlags)
       bei System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
       bei System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
       bei System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
       bei System.IO.BufferedStream.ReadByte()
       bei MySql.Data.MySqlClient.MySqlStream.LoadPacket()
       bei MySql.Data.MySqlClient.MySqlStream.OpenPacket()
       bei MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
       bei MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
       bei MySql.Data.MySqlClient.MySqlDataReader.NextResult()
       bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
       bei MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       bei System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
       bei Gentle.Framework.SqlStatement.Execute(IDbConnection conn, IDbTransaction tr)
    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
     

    mm1352000

    Development Group
  • Team MediaPortal
  • September 1, 2008
    21,571
    8,218
    New Zealand New Zealand
    Country flag
    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
     

    popy

    Super User
  • Team MediaPortal
  • Super User
  • July 3, 2011
    617
    141
    Country flag
    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:

    popy

    Super User
  • Team MediaPortal
  • Super User
  • July 3, 2011
    617
    141
    Country flag
    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
     

    mm1352000

    Development Group
  • Team MediaPortal
  • September 1, 2008
    21,571
    8,218
    New Zealand New Zealand
    Country flag

    popy

    Super User
  • Team MediaPortal
  • Super User
  • July 3, 2011
    617
    141
    Country flag
    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
     

    mm1352000

    Development Group
  • Team MediaPortal
  • September 1, 2008
    21,571
    8,218
    New Zealand New Zealand
    Country flag
    You are right, the crash didnt happend very frequently. But the only exceptions i had in tvservice-error log was those dosetchannelstate exceptions.
    Okay.

    Does the Watchdog methode (like you mentioned above) also work if JUST tvservice is running on my server?
    No, and that is why I said:
    I want to see your Windows application event log. If using a TV Server only install, please export the application and system event log files to CSV and post them here.
    So, please post those files.

    Why dont investigate into the excpetion rather than the crash?
    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.

    From the exception there are many logs now and its reproducable.
    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
     

    popy

    Super User
  • Team MediaPortal
  • Super User
  • July 3, 2011
    617
    141
    Country flag
    ok, on next crash i will post event logs and tvservice logs.

    popy
     

    Wiedmann

    Portal Pro
    June 22, 2007
    107
    28
    Germany Germany
    Country flag
    Why dont investigate into the excpetion rather than the crash?
    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.
    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:
    This seems to be something to do with your database. Is your network connection dropping in and out?
    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.
     

    mm1352000

    Development Group
  • Team MediaPortal
  • September 1, 2008
    21,571
    8,218
    New Zealand New Zealand
    Country flag
    Why dont investigate into the excpetion rather than the crash?
    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.
    You're not serious, are you?
    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.

    An exception isn't harmless in any way.
    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.

    And if you read through the forum you can recognise: This (or similar) exceptions regarding database connections happens with or without a server crash.
    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.

    And of course:
    This seems to be something to do with your database. Is your network connection dropping in and out?
    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.
    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? :)

    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.
    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.
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    C Hauppauge HVR-1265 -- does it work with MP1? MediaPortal 1 Talk 1
    ajs MP2Web - MP1 compatibility MediaPortal 1 20
    T MadVR + LAV Filters, Perfect in MPC-BE, Bad in MP1 MediaPortal 1 Talk 13
    P MP2: US user, OTA - can NOT get SchedulesDirect plugin to work on MP1 or MP2 --> how do I get OTA schedule? General 5
    framug [solved] Some changes/fix in MP1 configuration client and server Submit: code patches (MediaPortal/TV-Server/etc.) 14
    S TV-Server MP1 - Automatic search doesn't work Installation, configuration support 2
    C Streaming/transcoding MP2 vs MP1? General 4
    ajs [fixed] 5015: Improving the MP1 installer, providing nicer GUI :) MediaPortal 1 138
    C Streaming to clients over Wifi. MP1 or MP2? Newcomers Forum 0
    S Shortcuts MP1 My Recorded & TV Guide General 10
    azzuro [WiP] MP1-4999 - Big changes with many related change at once by Sebastiii MediaPortal 1 12
    ajs [Help Us!] MP1 X64 Version MediaPortal 1 20
    joecrow How about a Launcher plugin for MP1? MediaPortal 1 6
    wizard123 [solved] MP1 Build help MediaPortal 1 21
    ajs [News] MediaPortal 1 - 1.24 Released! News and Announcements 3
    CyberSimian [fixed] MP1-4990 : Improve horizontal scrolling in the EPG MediaPortal 1 10
    azzuro [WiP] MP1-5019: Replace MySQL with MariaDB MediaPortal 1 40
    catalpa Umsteiger von MP1: Schwierigkeiten Allgemeines Support- und Diskussionsforum 17
    CyberSimian [solved] MP1-4976 Built-in skin variables for current date MediaPortal 1 8
    rbo [solved] Umsteiger MP1 zu MP2 Allgemeines Support- und Diskussionsforum 67
    azzuro [Info] MP2 TVE inside MP1 repo MediaPortal 2 12
    G MP1 TV Server "failed to upgrade the database" using MS Sql Server Installation, configuration support 3
    lisag Can I get MP1 to open in the Recorded TV screen? MediaPortal 1 Talk 2
    M MP1 stops responding after Starting Plugins General Support 14
    R Problem with MP1 and WifiRemote Skins and Plugins Installer (MPEI) 8
    Similar threads

























    Top Bottom