Stops receiving UDP once per week - restart fixes after hang

Found a bug in EventGhost? Report it here.
davidmark
Experienced User
Posts: 85
Joined: Thu Jan 01, 2015 5:25 pm

Re: Stops receiving UDP once per week - restart fixes after

Post by davidmark » Sat Apr 16, 2016 5:33 am

kgschlosser wrote:ok your gonna be my guinea pig.

i don't have anything that i deal with in UDP Broadcasts.

so ya have to tell me if it works.

I do know the server starts and i get no compilation errors.

file is attached.

i changed all the registration information including a new guid as well as a new class name as not to interfere with what you have going on already
Okay, so I can run this side by side with the old one or do I need to copy over it?

Thanks again for the quick response! Will try it out this weekend.

User avatar
kgschlosser
Site Admin
Posts: 2889
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stops receiving UDP once per week - restart fixes after

Post by kgschlosser » Sat Apr 16, 2016 5:37 am

so here is what i did.

i remove the parser and changed it out for something that just liiks to see if it might be a function or a global variable

i also removed the asyncore and replaced it for the threading instead (i have had problems in the past with the asyncore there are write ups about it on the net)

and i did some minor code changes to give it my "flare" i guess... gotta sign it somehow

i centralized repeating code as well.

K
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 2889
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stops receiving UDP once per week - restart fixes after

Post by kgschlosser » Sat Apr 16, 2016 5:37 am

side by side with it
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 2889
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stops receiving UDP once per week - restart fixes after

Post by kgschlosser » Sat Apr 16, 2016 5:38 am

i didn't want to muck up anything ya have going on over there so i figured this would be the best way (i am no expert python coder so we are bound to have some errors)

K
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 2889
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stops receiving UDP once per week - restart fixes after

Post by kgschlosser » Sat Apr 16, 2016 5:49 am

oh yeah, i fixed the closing problem also.
If you like the work I have been doing then feel free to Image

davidmark
Experienced User
Posts: 85
Joined: Thu Jan 01, 2015 5:25 pm

Re: Stops receiving UDP once per week - restart fixes after

Post by davidmark » Fri Apr 22, 2016 1:59 pm

Didn't have a chance to mess with this last weekend, but did remove some "disabled" plug-ins (Network Sender/Receiver comes to mind, whatever that was) from Startup and that seems to have fixed the hanging on close.

But the UDP outages continue regularly. Restarting VC does nothing. Can see the sends from VC scrolling by, but nothing appears in the EG log until it is restarted. Have my fingers crossed on this new version. There has to be something really wrong with the old one.

How can there not be a task to restart EG? Would do it once per evening and would at least work around this issue. Can restart VC from EG, but doesn't help the issue.

User avatar
kgschlosser
Site Admin
Posts: 2889
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stops receiving UDP once per week - restart fixes after

Post by kgschlosser » Fri Apr 22, 2016 5:34 pm

because EG doesn't start as a service at the moment, you have to remember this was originally developed back in like 97 i think.

and it's very much so in it's infancy, and had a shaky problem with the main dev few years back and he no longer wanted to work on the project, but he was kind enough to leave it. so development has slowed down for a while. Pako has done a great job of fixing bugs and getting new releases in and running the board and still getting plugins out. and all the people that have helped him over the years have done awesome. it's no small task doing all of those things. and you have to have a "real" job also. because EG is free and they don't make any money from it. if anything it costs them gobs of cash. which reminds me i gotta talk to the mrs i would like to fork over some loot in a donation.

but there is a version 5.0 in the future hopefully. and hopefully that is implemented because i know it has been asked about an awful lot

i have messed around with the new plugin a little and there are a couple of errors i have to attend to. and i do know the network receiver and broadcaster use the asyncore thing also. every time i come across something using that it binds up eventghost and i do not know why

the sender and receiver are for sending information from one computer to another with both computers running eventghost.

i think the parser that is in eventghost needs a once over also. i am going to take a look at the source and see if i can fix it up a little and maybe it will be used in the next version

i am pretty sure that's where most of your problems are stemming from

i had the plugin running for over a week receiving broadcasts every 60 seconds and it ran fine.

K
If you like the work I have been doing then feel free to Image

davidmark
Experienced User
Posts: 85
Joined: Thu Jan 01, 2015 5:25 pm

Re: Stops receiving UDP once per week - restart fixes after

Post by davidmark » Thu Jun 02, 2016 10:59 pm

kgschlosser wrote:because EG doesn't start as a service at the moment, you have to remember this was originally developed back in like 97 i think.

and it's very much so in it's infancy, and had a shaky problem with the main dev few years back and he no longer wanted to work on the project, but he was kind enough to leave it. so development has slowed down for a while. Pako has done a great job of fixing bugs and getting new releases in and running the board and still getting plugins out. and all the people that have helped him over the years have done awesome. it's no small task doing all of those things. and you have to have a "real" job also. because EG is free and they don't make any money from it. if anything it costs them gobs of cash. which reminds me i gotta talk to the mrs i would like to fork over some loot in a donation.

but there is a version 5.0 in the future hopefully. and hopefully that is implemented because i know it has been asked about an awful lot

i have messed around with the new plugin a little and there are a couple of errors i have to attend to. and i do know the network receiver and broadcaster use the asyncore thing also. every time i come across something using that it binds up eventghost and i do not know why

the sender and receiver are for sending information from one computer to another with both computers running eventghost.

i think the parser that is in eventghost needs a once over also. i am going to take a look at the source and see if i can fix it up a little and maybe it will be used in the next version

i am pretty sure that's where most of your problems are stemming from

i had the plugin running for over a week receiving broadcasts every 60 seconds and it ran fine.

K
Thanks very much. I never did get a chance to try the revised plugin, but the problem has vanished after I eliminated some other plugin machinations (e.g. weather fetch that had been hacked by me at some point, network receiver or some such, etc.) No restarts for a few weeks now and hopeful that will remain the case. BTW, is there some way to safely shut down EG from an action? My idea is to run it from a batch file and loop until a certain result code is returned (same as Misterhouse), that way I can restart or shut it down from an action (not that I want to have to do that, but may come in handy in future).

Love this thing. Runs for months on end without fail and seems to recover well after network outages. That's all I ask from a state machine.

But have one very minor issue with it that bothers me on occasion. When I stop a timer at what is likely the last possible ms, seems that events are already queued and run anyway. Will likely post another report (or question anyway) after reviewing the forum history.

For example, I send text to an alphanumeric display, I set a timer for n seconds to put it back to the idle clock display. Ever time there is a new send, the timer is stopped and restarted after the serial port operation. Works like a charm, except on the rare occasion that I see the text and immediately the clock comes back. So chew on that one if you would.

Thanks again! And had no idea EG dated back so far. I just "discovered" it a couple of years back. Had messed with Girder about a decade ago before settling on Misterhouse. Wish I'd found this thing sooner. :)

User avatar
kgschlosser
Site Admin
Posts: 2889
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stops receiving UDP once per week - restart fixes after

Post by kgschlosser » Fri Jun 03, 2016 4:00 am

that's because of threading. there is only one thread that runs the events. so it will only fire one at a time. until they are all done.

unless..... you run the

Code: Select all

eg.plugins.EventGhost.FlushEvents()
that will empty the "que" i think it just restarts the thread. never really looked into it.

funny tho your post helped me get into UDP and i designed a plugin for the xAP protocol for home automation.

someone had asked about making a plugin for xAP and since i had a little knowledge about UDP i took it on.

as far as shutting down eventghost. sure you would use the find window and then close it.

i would imagine that would work.

i know you can trigger an event in eventghost from a command line. also....

this will help you in sorting out anything you make in the future.

if you run a command prompt as admin. and go to the eventghost folder.


run eventghost with the -debug

it makes a log file in you appdata/roaming/eventghost folder

if EG hangs on startup that's ok. it found some crappy code.

go look at the log and investigate.

it will put things in there that don't even throw a traceback error. but are problems none the less
If you like the work I have been doing then feel free to Image

davidmark
Experienced User
Posts: 85
Joined: Thu Jan 01, 2015 5:25 pm

Re: Stops receiving UDP once per week - restart fixes after

Post by davidmark » Fri Jun 03, 2016 4:31 am

kgschlosser wrote:that's because of threading. there is only one thread that runs the events. so it will only fire one at a time. until they are all done.

unless..... you run the

Code: Select all

eg.plugins.EventGhost.FlushEvents()
that will empty the "que" i think it just restarts the thread. never really looked into it.

funny tho your post helped me get into UDP and i designed a plugin for the xAP protocol for home automation.

someone had asked about making a plugin for xAP and since i had a little knowledge about UDP i took it on.

as far as shutting down eventghost. sure you would use the find window and then close it.

i would imagine that would work.

i know you can trigger an event in eventghost from a command line. also....

this will help you in sorting out anything you make in the future.

if you run a command prompt as admin. and go to the eventghost folder.


run eventghost with the -debug

it makes a log file in you appdata/roaming/eventghost folder

if EG hangs on startup that's ok. it found some crappy code.

go look at the log and investigate.

it will put things in there that don't even throw a traceback error. but are problems none the less
Okay, so flush the queue before stopping the timer? Concerned that could discard unrelated events, but admittedly have no idea how this thing works behind the scenes.

Remember using xAP with Misterhouse to control some IR thing that had no other public API. Didn't know it was still around. Did you post the plugin?

As for closing the window unexpectedly by sending WM_CLOSE, was concerned the program might pop up a modal confirm in response. Had an issue with false changes in past, but it has gone away with the other problem, so will give that a try now. However, will only work for my intended purpose if a normal exit returns some other result code. Been a very long time since I've had to deal with this issue; so the details escape me, but it worked like a charm with MH.bat.

And thanks for the debugging advice as well. Makes sense that some errors could happen before EG is ready to present them. Such a log would be the only place to look.

Thanks again!

User avatar
kgschlosser
Site Admin
Posts: 2889
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stops receiving UDP once per week - restart fixes after

Post by kgschlosser » Fri Jun 03, 2016 12:30 pm

the flush events stops all events. it cleans the slate. i would have to look and see if you could iterate the event database and clean out specific ones.

and as far as the false modal. it really isn't false. it's because there are threads in the plugins that are doing things. that's why it happens. it can cause a hang (waiting for you to confirm save) on shutdown or reboot of the computer also.

it was designed that way intentionally because EG really doesn't know what the plugin is doing. that's what's nice about it and keeps it very open and not having to code a plugin in a very specific way.

i know i can reboot EG. i would have to take a look into the reboot sequence to see how it's done and pilfer the shutdown pieces

i know someone made some kind of EG system plugin i would have to go and look for it.

it is quite handy if you have a need for doing those kinds of things

i just recently found a way to add plugins and refresh the plugin list without the need for restarting EG. i find that very useful for adding new plugins and event updating the code for plugins.

and yes the xAP plugin is posted.

that was a really cool piece of coding. it's in the plugins thread on the forum.

it allows for being a software hub as well as a client. (auto sensing) also shows all xAP broadcasts made on the network. with a dialog to "ignore" specific events from a specific client like heartbeats. with a table and all to select from. also allows for real time debugging of xAP messages again same deal as the ignore on a per message basis. incoming or outgoing.

you can also send xAP messages to eventghost specifically for it to perform a prefix, suffix, payload of your choosing

you can select to have the message schema or the hostname of the broadcasting computer be the prefix of the event triggered (not the client style event)

i actually changed all the communications on my network to using this because i really liked the fact that i do not have to run static IP addresses anymore. it's far easier now. because i run a lot of arduinos and this has such a tiny footprint.

you can also use the xfx viewer at the same time that EG is running.

there is one glitch tho and that has to do with the logitech media server because that thing will broadcast on the same port as eventghost. you just have to make sure that you select that there is a software hub running if you have eventghost and the LMS on the same computer

the plugin will also detect if you are running another software hub and that hub crashes for some reason. and the EG plugin will automatically change up to being the hub
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 2889
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stops receiving UDP once per week - restart fixes after

Post by kgschlosser » Fri Jun 03, 2016 12:36 pm

the plugin does create a bunch of files in your my documents folder.

it does this for several reasons. i am going to build a message builder of sorts for it. (so it monitors all events for a target and then copies all of the commands to files for later use)

it also writes all of the items you have set to ignore to file as well as all of the different class types and machine names that have broadcast something at one point or another and i also makes 3 backups of each of the files and also writes all of the settings data to file that way you have that information the files are simple text files and easily edited and will only write if something has changed.


and xap is pretty much a dead protocol. but it doesn't rely on any other software to function. and that's why i like it. and the footprint is super tiny. arduinos only have 2k of memory. so i can fit the protocol and all the information for connecting using Ethernet and all the code for sending and receiving IR onto one and still have room to spare.
If you like the work I have been doing then feel free to Image

davidmark
Experienced User
Posts: 85
Joined: Thu Jan 01, 2015 5:25 pm

Re: Stops receiving UDP once per week - restart fixes after

Post by davidmark » Tue Jun 07, 2016 2:08 pm

So after a few weeks, this "asynccore" thing crapped out again.

Have found that I do *not* need to restart EG, just re-execute the Broadcaster plugin. So how do I do this programmatically (e.g. after a period of proxy inactivity?) I saw an EG method for restarting "asynccore", but no idea if that's what I need here.

This is why I'm building proxy interfaces with both HTTP and UDP. Just can't trust UDP with this plugin (haven't tried the rewrite yet). Odd that it once worked for *months* without issue.

User avatar
kgschlosser
Site Admin
Posts: 2889
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stops receiving UDP once per week - restart fixes after

Post by kgschlosser » Tue Jun 07, 2016 3:41 pm

if you dun eventghost from a command line with the -debug command switch it will creat a log file of what is exactly is happening to cause the problem. thing is if you have alot of code that you have added to it. it may freeze on startup so you will have to read the log file and it will tell you what's going on. it will even do it for files that are just in the plugins folder and not even being used. so make sure you have any kind of temporary files cleaned up and then do it. if EG freezes on start with the -debug go to your appdata/roaming/eventghost folder and read the log.


this will narrow down the exact source of the problem
If you like the work I have been doing then feel free to Image

davidmark
Experienced User
Posts: 85
Joined: Thu Jan 01, 2015 5:25 pm

Re: Stops receiving UDP once per week - restart fixes after

Post by davidmark » Tue Jun 07, 2016 10:40 pm

One clue is that restarting Broadcaster fixes the issue. How to do that from a macro? Then I won't care what the issue is (at least for the moment).

Post Reply