1 (edited by Ratzfatz 2010-05-07 04:12:16)

Topic: Bug: Widget gets restarted after parameter upload

Short: There's something happening on my C1 exactly every 10 minutes (30 seconds after the full minute) that causes the currently running widget to be restarted, if (and only if) it has uploaded widget-parameters (to xml.chumby.com).
This happens both for cooperative-mode and if I pin the widget down (make the widget "stay" in the control-panel.

I think, this might be related to the problem described here : http://forum.chumby.com/viewtopic.php?id=4335

Long: I should mention first that I use FlashDevelop, no Adobe-Tools. For the YouStreams-widget I tried to make use of loading/storing parameters on xml.chumby.com as shown in the example here: http://wiki.chumby.com/mediawiki/index. … r_Example. I store only a few strings (the last radio-category and station, volume etc.) using the XML.send_and_load()-method.
It's working fine so far (although I wonder why XML.send(..., ..., "POST") does not work ?), I can store and retrieve the desired widget-parameters.

Unfortunately, I noticed that the widget got restarted from time to time. It does not get replaced by the next widget in the channel, even when in cooperative mode, but simply gets restarted (starts from main-routine).
I spent hours searching for bugs in my AS2-code, but now I think the problem has an external cause, mainly because restarting takes place at a fixed Interval every hh:mm:30, where mm=00,10,20,30,40,50. If the widget uploads any parameters, it will be restarted at the next mm:30.

Could it be that the instance that controls widget-cycling etc (the Master-flashprogram), periodically checks the availability of new widget-parameters in the chumby-db and then restarts the widget if there are new parameters ?

For Widgets with external configuration, this could be seen as a feature, not a bug...
Is there a way to disable restarting ?

Re: Bug: Widget gets restarted after parameter upload

Yes that's correct - if the chumby detects that the currently running widget's parameters have changed, then it will be restarted.  This is so the widgets will not continue to show stale data.  The devices polls for these changes approximately every 10 minutes or so.

Re: Bug: Widget gets restarted after parameter upload

No way to disable this feature for a widget, at least temporarily ? Like, e.g. uploading an additional parameter dontRestart=true, or whatever ?

Re: Bug: Widget gets restarted after parameter upload

Not at the moment - I'll have to take a look at the code....

Re: Bug: Widget gets restarted after parameter upload

Ok, so the best practice is to only update the parameter persistence when you are about to unload?

This basically means you don't want to use the parameters as any sort of storage that is referenced more than once at runtime if your widget behavior is sensitive to restarts.

This probably means that if you want this sort of persistence that you would have to host it yourself?

Just trying to wrap my head around the capabilities. smile

Re: Bug: Widget gets restarted after parameter upload

Yeah, that's basically it, but it seems like it needs to be revisited.

Perhaps I should define a new _root parameter, like "_root._chumby_no_restart" that would prevent the CP from relaunching the widget.

Re: Bug: Widget gets restarted after parameter upload

Can you call an event on the widget and ask it if it wants a restart or to let it know there are param updates? Does the param file maintain a version that gets iterated when something changes?

Does this work the same way on the Dash?

Re: Bug: Widget gets restarted after parameter upload

The way this works is that, periodically, the CP asks the service for information about the currently playing channel, in order to detect changes that were made from another device or the website (additions, removals, edits, etc).  On most devices, there's a token sent up taken from the most recent channel fetch, like a timestamp that indicates the "version" of the channel - the server responds with either "no change", or an updated channel and a new token.

When the CP loads this new channel, it sees if the currently playing widget is still in this new channel - if not, then it is halted and the CP moves on to the "next" widget.  If the widget *is* in the current channel, it then looks to see if any of the parameters have changed - if so, then it will restart it with the new parameters.

You can see why this would seem to be useful - if you had a weather widget pointed at one city, you go to the server (or another device) and change that, you'd like to see that change reflected on the widget - in fact, this feature was added as a result of complaints from users.

However, it appears that this is not ideal behavior for some widgets that are smarter about reloading their parameters from the server. Disabling this behavior is not the best answer, but having some better way for the widgets to tell the CP what it's doing seems like a good idea.

Whatever we do, we have to handle the situation where RatzFatz's widget is running in the same channel on *two* devices.

Dashes are currently a little different, since they use a completely different server protocol, however, I expect they'll eventually work the same way as the other devices as far as this feature goes.

Re: Bug: Widget gets restarted after parameter upload

Duane,

Thanks for the great info.

I completely understand the update issue. Partly because I actually manually change the channel to get by widget to update faster during testing.

I did not know that more than one device can share the same channel instance. I didn't know this because my channels are prepended with my device name. Also, because I've just been running the Dash (just got my C1's last night) I haven't seen what my account is going to look like with multiple devices.

Are you saying that a Widget and it's configuration/persistent parameter file lives in a channel, but this channel can run on more than one Chumby? This would surprise me. I had assumed that the config parameters for a widget would always be a one to one with a device.

Dashes are currently a little different, since they use a completely different server protocol, however, I expect they'll eventually work the same way as the other devices as far as this feature goes.

Do you think you could comment a little on this statement? I'm considering the issue of cross platform compatibility from a coding and development point of view. We are pretty early in the release of the Dash, but it would be helpful to know how the difference impact the development and how the differences can be leveraged.

I'm facing the need to basically embed or dynamically configure the widget UI based on the device. On the Dash there is obviously more real estate, but it appears that the widgets, channels and themes may need to be addressed as well.

(My one big disappointment so far on the Dash is that the security is not letting me shut off the Sony logo light using asnative hehe..)

Re: Bug: Widget gets restarted after parameter upload

The same channel, with the same widget parameters, can be shown on multiple devices at the same time.  If you configure widget parameters from one device, those changes will eventually be reflected on the other devices showing that same channel.

From the widget parameters standpoint, not much is different, though the dash sets fewer "_root._chumby_*" properties on the main timeline than the regular chumbys.  Some of these omissions are being restored, but you probably won't see any of the music-related properties, because music is handled in a completely different architecture.

As I mentioned in another thread, the biggest impact that this device and others will have is that widgets can no longer count on being 320x240, or that the the Stage is static while the widgets is running - one should consider building "liquid layouts" and listen to the events coming from the Stage object.