Announcement

Collapse
No announcement yet.

Plugin won't initialize at startup

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Originally posted by w.vuyk View Post
    The only HSevent the plugin handles is indeed a CONFIG_Change, Which in the plugin is evaluated to see if the changed device is of the plugin. Sounds to me that HS is offering all devices as a change during startup? If it is a device owned by the plugin, it is handled in a seperate thread.
    If the plugin indeed handles the device change, a logline is created on level debug.
    I think the question is here why HS offers all devices (2000 of 3000?) to a plugin that won't do anything with it. I am a bit doubting if HS would offer those queued events all to the plugin, I think it just don't know where to deliver them if my plugin is the only one?
    Wim
    An interesting development in this. As I have gone deeper down the rabbit hole, I have come to realize that the HomeSeer server side has a single thread per plugin processing RPC calls. What this means is that say in your InitIO you launch a background thread. That background thread calls GetDeviceEnumerator() (which can take well over a minute on my system), and then you get an HSEvent. If you make a call in that event, say GetDeviceString(), that call is sent to the server and sits in the queue which is not being drained as the thread is executing the GetDeviceEnumerator() call still. So in effect, regardless of the number of threads in your plugin, all calls to HS go into a single serial queue. This helps explain why some of the event issues are occurring, you may be making what should be a light weight call but in actuality it could hang for seconds to minutes. I am changing the code (Rich was nice enough to send me the com code, so I have been doing some open heart surgery to figure some of these issues out) to use a thread pool so calls will get dispatched and not held up as today. Will be interesting to retest all this with that in place.

    Comment


    • #32
      In that case the logline of hs is not really describing the issue when it is not only "Events". It should just mention the "plugin queue overloaded" or similar?

      Code:
      11:56:18:2096:[Warning]->Dropping event callbacks due to full queue (Type: CONFIG_CHANGE) (2000 entries), system may be too busy, plugins and HSTouch may not receive all device updates
      The first GetDeviceEnumerator in the plugin is outside the INITIO, INITIO does basic initialisation of the database and then exits with starting a timerroutine for the plugin. This routine discovers it is a maiden start and gets bridges and other devices.
      -- Wim

      Plugins:RFXCOM, HSTouch Server, Squeezebox, BLGData, Restart, Jon00's Perfmon and Network monitor, WeatherXML, BLBackup, TenScripting, BC4, Pushover, PHLocation, JowiHue, Zwave, Sonos
      650 devices ---- 336 events ----- 40 scripts

      Comment


      • #33
        Originally posted by w.vuyk View Post
        In that case the logline of hs is not really describing the issue when it is not only "Events". It should just mention the "plugin queue overloaded" or similar?

        Code:
        11:56:18:2096:[Warning]->Dropping event callbacks due to full queue (Type: CONFIG_CHANGE) (2000 entries), system may be too busy, plugins and HSTouch may not receive all device updates
        The first GetDeviceEnumerator in the plugin is outside the INITIO, INITIO does basic initialisation of the database and then exits with starting a timerroutine for the plugin. This routine discovers it is a maiden start and gets bridges and other devices.
        FYI, put everything I currently know into one thread: https://forums.homeseer.com/forum/de...lugins-for-hs3

        Comment


        • #34
          Originally posted by w.vuyk View Post
          The only HSevent the plugin handles is indeed a CONFIG_Change, Which in the plugin is evaluated to see if the changed device is of the plugin. Sounds to me that HS is offering all devices as a change during startup?
          Wim
          Forgot to comment on this. I need to verify with Rich, what I *think* is occurring is that HS keeps a queue of changes and replays them to use as a kind of change log (without the intermediary changes) if your plugin has not been running to catch you up. Again, I need to verify that, but I have seen some startups where I get lots of changes and others where I get none or only a few...

          Comment


          • #35
            That indeed makes sense I guess
            -- Wim

            Plugins:RFXCOM, HSTouch Server, Squeezebox, BLGData, Restart, Jon00's Perfmon and Network monitor, WeatherXML, BLBackup, TenScripting, BC4, Pushover, PHLocation, JowiHue, Zwave, Sonos
            650 devices ---- 336 events ----- 40 scripts

            Comment

            Working...
            X