NextPVR Forums

Full Version: Weather crashes GB PVR on MVP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Decided it was time to update Weather programe (from Weather to Weather 2 v1.1.0.3 ) but unfortunately once installed Weather 2 just causes MVP's to go really slow and then crash...

Done some investigating and have two observations
1) I don't have PVRX2 running (all access is via MVPs). Which means when MVP is switched on it forces Weather 2 data download which hangs - this does not happen if I open PVRX2

2) Recurring error - "FATAL UNHANDLED EXCEPTION:: System.IO.IOException: The process cannot access the file 'C:\Program Files\Devnz\GBPVR\Plugins\weather2\<unique directory name>\weather.xml' because it is being used by another process."

Also looks similar to this issue reported by steeb http://forums.nextpvr.com/showthread.php?t=44462

Regards,
I'm not sure why there are MVP problems. I haven't had tons of time to dig into it yet.

Is the MVP the only instance of Weather2? Or do you have multiple clients? The error you give indicates that something else is updating the weather.xml file at the same time. If you could post all the logs in the logs folder, I can see if something else is accessing at the same time.
I think there are definite problems with Weather2 on the MVP and NMT,

Some of the things you should be aware of

- you start processing in the ctor when the connection isn't even active. You should only do this on activate or initialise

- MVP and NMT instance share the same PC so they are all fighting for config.xml There can be many instances plus the PC on the same machine.

- I see lots of Fatal Errors

Martin
mvallevand Wrote:I think there are definite problems with Weather2 on the MVP and NMT,

Some of the things you should be aware of

- you start processing in the ctor when the connection isn't even active. You should only do this on activate or initialise
What is ctor? The constructor? If so, how do I get things loaded at startup, because Activate isn't called until the plugin is loaded. The "Update at Startup" option is suppose to allow the information to update at startup of PVRX2, instead of at activate time.

mvallevand Wrote:- MVP and NMT instance share the same PC so they are all fighting for config.xml There can be many instances plus the PC on the same machine.
This is my hangup then. How does my plugin know how many instances are running? I'm assuming I need something in my code that allows only 1 instance to update, while the other instances only load their information off what has already been downloaded.

mvallevand Wrote:- I see lots of Fatal Errors
Other than the Fatal System.IO.IOException?
>>How does my plugin know how many instances are running
I'd use a Mutex. The first instance grabs the mutex and runs the update, everyone else just waits.
When the mutex is released, the other instances should see the data is new and not attempt to re-update.
scb147 Wrote:What is ctor? The constructor? If so, how do I get things loaded at startup, because Activate isn't called until the plugin is loaded. The "Update at Startup" option is suppose to allow the information to update at startup of PVRX2, instead of at activate time.

It depends on your requirement. For the NMT and MVP I think the constructor is called three times. The server itself can run after "startup" for hours and even days without the device even being turned on.


Quote:This is my hangup then. How does my plugin know how many instances are running? I'm assuming I need something in my code that allows only 1 instance to update, while the other instances only load their information off what has already been downloaded.

I haven't run Weather2 but you seem to cache a lot of stuff in the GBPVR folder. I don't know how you determine when to reload the information but if you checked the cache info file's date and time multiple instances wouldn't be a problem.

Quote:Other than the Fatal System.IO.IOException?

I see other errors, but I can correlate that one to the MVP/NMT session dieing which is causing frustration for client users.

Martin
mvallevand Wrote:It depends on your requirement. For the NMT and MVP I think the constructor is called three times. The server itself can run after "startup" for hours and even days without the device even being turned on.
Why would the constructor get called three times? Shouldn't each MVP/NMT device only call a constructor one time?

mvallevand Wrote:I haven't run Weather2 but you seem to cache a lot of stuff in the GBPVR folder. I don't know how you determine when to reload the information but if you checked the cache info file's date and time multiple instances wouldn't be a problem.
I store local copies of the weather data, and the maps. This way, if PVRX2 is exited, and then entered before the next update time, it can just load from the local disk, instead of having to download all the stuff again. The only time I use the file date/time to update is at startup. Then I have a Timer that then handles updates.

mvallevand Wrote:I see other errors, but I can correlate that one to the MVP/NMT session dieing which is causing frustration for client users
If this is just since I've added update at startup, then I should suggest MVP/NMT users to use V1.1.0.0, as this doesn't have that capability.

I haven't really dealt with multi-thread programs before, so this is mostly new to me. So like InVermont suggested, I should put a mutex on my update thread, so only one process is in that code at a time. I need to do some code re-work because I think my update process is a mess.

Thanks for the info Martin.
This problem is definitely not just at Startup, at Startup the client isn't even running.

Martin
I can confirm I was having some update related crashes on the NMT with the old version but I didn't have the time to investigate what was causing it, so it's not just started with the new version.