Plugins MUST NOT display message boxes! was:Update must not halt AMI Broker

I woke up this morning to see that my overnight automation had not executed. I run two hourly systems that simple stopped 10 hours ago due to this dialogue.

2021-12-14 08_19_18-precision - Remote Desktop Connection

Non-critical message must not halt AMI Broker, even those of plug-ins. I will mention also that the ODBC plug-in can halt preceding's when the SQL query does not succeed for some reason. There is no graceful error handling.

Can I request a product enhancement to better handle these messages and events. Thanks.

This is a Norgate Data message and nothing to do with AmiBroker. It's simply there to ensure that AmiBroker is running the correct version. For example, let's say we had a significant database schema change - we can't let past versions of client apps/plugins use the old version forever - they have to be upgraded. (For what it's worth, the ugprade on Saturday, so you must have had AmiBroker for most of the weekend and into today). It's good practice to restart various components of your system every once in a while.

Note too that this is a consequence of us having upgraded your system to a tester level to deal with a different issue ( NorgateOriginalVolumeTimeSeries() and issues with padding). Normal users are not affected by this until we release it to them. Updates/upgrades to AmiBroker plugins are quite infrequent.

I run my hardware and software 24/7/365 and expect enterprise grade performance, as trading is a business after all. As I have a number of fully automated systems executing, I do not restart anything and expect seamless performance with 100% up time. Windows does not stop when an upgrade is required and nor should any other component. Norgate requires nonmodal update notifications to fit into my solution stack.

I do note however your comment on my tester status and acknowledge that edge case.

2 Likes

@NorgateData - I was advocating against modal boxes displayed by plugins for YEARS. Plugins SHOULD NOT do that.

There is absolutely NO good reason to display modal boxes like that from plugin.

If you need to display message, launch a separate process and display message in a way that does NOT stop main program on message box requiring user to click "OK". Doing blocking message boxes in random times is BAD design. A message box can only be displayed in immediate response to user action.

I have been issuing warnings like that and even if this did not happen in 2021 eventually we will enforce "NO MESSAGE BOXES" policy.

Let me remind you that data plugins that need to display text to the user have such ability via GetStatus() call back function. This way data plugin can display non-intrusive message in the form of "bubble" / tooltip that is displayed in lower right corner of the screen. Normally this message disappears in few seconds but the message can be held displayed for long times if you just change nStatus code field. IB plugin uses that technique to display information about backfill progress and does so for prolonged times (as long as backfill takes).

PLUGINAPI int GetStatus( struct PluginStatus *status )
{
	status->nStatusCode = 0x10000000;
	strcpy( status->szShortMessage, "INFO" );
	strcpy( status->szLongMessage, "The text you want to display" );
	status->clrStatusColor = RGB( 255, 255, 0 );
	return 1;
}
1 Like

Whilst this is a rare event, it's not something with an easy solution.

  1. We have a breaking change on a dependent system (database format)
  2. We can't "hot reload" plugins once loaded into AmiBroker
  3. We need a way of telling a user that they have to do something

An alternative is to pop up a timed box and then stop the plugin from any further functionality.

What we will do is have some more granular capabilities in this area and only pop up a timed box IF an actual breaking change occurs rather than a routine upgrade. There would also be user notification in the form of bulletins about the (breaking) upgrade too.

This ONLY affects a user accessing a database using the Norgate Data plugin.

However, there are certain other messages that are critical, such as a portion of user's data subscriptions expiring and during database maintenance, this would result in a significant number of symbols being removed. This is quite precautionary as a user may have inadvertently forgotton to renew a subscription - clearly they don't want all of their chart trendlines etc. to disappear as a result.

It's difficult to engineer systems to please everybody.

  • Expiring subscription - does not need MODAL blocking box. You can display this info in non-intrusive way
  • Breaking change after upgrade - user should have ability to block forced upgrades altogether and have ability to do them manually only at the convenient time they choose
  • Database format change - again, there should be option to opt-out from forced automatic upgrades

The plugin really does not need to "stop" at any time. In all above cases, the plugin should simply deliver existing (old) data. This is as easy as returning immediately from GetQuotesEx() function without doing anything. If upgrade is needed, the message can be displayed in separate process. Even simple WINAPI:

ShellExecute("open", "the_document_you_want_to_display.html", NULL, NULL, SW_SHOW );

would give you ability to display information you need without blocking AmiBroker. It is single line of code and prevents problems like this.

The alternative way to display messages in non-intrusive way is GetStatus() function described in my earlier reply.

If you for some reason really and desperately need a dialog window with that OK button to display text like in MessageBox, create a NON-modal window (CreateWindow/CreateDialog WINAPI) and display text there, so it does NOT block main application, here is example how you do that (disclaimer I did not check it for correctness it just pop-ed out in google search), generally the idea is not to call dlg.DoModal() and call dlg.Create() instead.

No, what I am saying is not difficult. Technically it is super-easy: a) replace message boxes with ShellExecute single call (or GetStatus(); b) keep existing data - return from GetQuotesEx without changing anything.

1 Like

My affected hourly systems are crypto and don't use Norgate at all yet it halts the entire stack.

We have found the issue - we had an extra version check in the wrong part of the plugin that caused this. It was supposed to be removed in the last round of upgrades but wasn't - our apologies for this.

I'll liaise directly with you on the release of this.

Tomasz - understood. We will continue to improve this area.

3 Likes

FYI, This change is currently in testing:
image

5 Likes

Very nice. Thank you.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.