Flow: Stack traces

After pressing the Test4 button on the first invocation, I press the back button ("<", triangle in OS control bar at bottom left of display... )

... just the same as what I understand you to be doing as you describe:

... and then invoke it again by clicking on its icon...

However, if (after exiting as described) I "Force Quit" the app using the app info screen before I re-open it, then it works correctly.

Strange. :confused:

Perhaps I need to run the app on another device or on the emulator...

???,
-Randal

Both of the functions were independent.


From what I understand

  1. Open the app, Test1, Test3, Test4 works correctly
  2. You minimise the application, and reenter it again
  3. Now you do Reset + Test 1, but it results in incorrect stack trace (according to you?)

I did the same test, here were my results:

  1. Test1 + Test3 + Test 4

  1. Now I minimised the app using back button, and reenter the app, then I click Reset and Test 1:

?? It seems to be working fine here


Yes please..

Perhaps you can PM me a video recording of this behaviour. I'll be travelling tomorrow for a few days. I'll try to resolve this issue before that.

Well, I do, in fact, get different results on a different device:

  1. Original test device: Moto 5e play; Android 8
  2. Second test device: Pixel 3 XL; Android 12

The second invocation of the Pixel 3 screen (Reset+Test3) looks correct:

As a matter of fact, it looks more like what I would expect than the one you obtain.

In the above listTraces there appear only those procedures that have been executed on the second invocation, while those from your second invocation (Reset+Test3, quoted below) show the remnants of the FIRST invocation in listTraces in addition to those of the second/current invocation (as does my Moto result):

I

Any idea what is going on? We have 3 different devices with different results.

On two of them it seems that the listTraces contains remnants of the first execution of the app.

More ???,
-Randal

More on this one - the crash

This case is (as you no doubt know) started out as your Itoo Music player example. In the earlier case (itoo-flow_lblInfo_Err) it seemed to me that the failure was ass0ciated with the attempted execution of the ui_lblinfo procedure which is called implicitly by your "ui_xxx magic". ui_lblinfo is invoked from within procedure stopService which is invoked using the the broadcast mechanism from btnStop.Click event.

I have created another case that simply gets stopService invoked another way: Itoo CallBackgroundProcedure invoked from the btnStop.Click event.

This second method generates different logcat messages, including

06-23 16:33:32.357 11695 11695 E AndroidRuntime: Caused by: java.lang.StackOverflowError: stack size 8MB

which was not present in the earlier, similar case.

I thought it might give more clues as to the cause.

Blocks:

Code:

Itoo_Flow11B_lblInfo2_Err.aia (4.2 MB)

logcat:

itoo-flow11B_lblInfo2_Err.txt (1.7 MB)

Screen:

Hope this helps,
-Randal

My best guess is that the devices are handling the "back" action differently. Some devices are simply pausing the app while some others are instantly killing the app to save resources (from my experience from my previous phone).


That one is weird... I have not seen this type of error before. In case of Itoo...


We seem to be going down a rabbit hole here. We are not reaching any destination. From what I understand you would want to use this "whoCalledMe" in an Itoo process (in the background), am I right?

Is there any other way we can supplement your need? I've tried a lot of ways at my disposal... They seem to be not working...

That makes sense. So it seems that whoCalledMe can be relied upon (itoo excepted), in both cases 1) fresh invocation or 2) resumption of a "paused" process...and so also probably a whoAmI function.

Yes (and no :slight_smile: ) Yes, in an itoo environment, but, no, not actually from the itoo process itself.

I want to guard each procedure in my app that MUST be called in the background (Itoo service) so that if it is called from the UI/foreground, I can log whoCalledMe, which call would be not from the background but from the UI :slight_smile:

So I place code at the top of every procedure that must be called from the b/g:

If not itoo.InBackground then
   log (whoAmI " was called by " whoCalledMe);
endif

But the problem seems to be that even declaring a Flow component in an Itoo environment seems to "interfere" with the ui_logInfo call from the itoo service. While this call (ui_logInfo) is not a part of the guarding code that I would add, it is a functionality that I depend on for the app to work (i.e., from the bg calling a procedure in the foreground).

Perhaps I can refine the test case to hone in on what is causing the problem...maybe calling a procedure without any parameters that does no attempt to call a Notifier method.

Thanks for persisting in helping me with this,
-Randal

I think I may have created a very small test case.

Flow_with_Itoo.aia (187.7 KB)

It contains a single label (lblCaller) and includes (but does not reference) Flow and Itoo components.

...and these blocks:

Flow_with_Itoo-blocks

When the app is started a blank screen (white) is presented. If the "back" button is pressed, eventually the OS reports it as unresponsive:

If the itoo component is removed, the app works. Starting it produces the following:

I have not looked at logcat ...

Hope this helps...kind regards,
Randal

[Added about 19:00 GMT]
Here are some excerpts from logcat.

06-27 13:41:30.005 25759 25759 E AndroidRuntime: FATAL EXCEPTION: main
06-27 13:41:30.005 25759 25759 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{appinventor.ai_randal_andress.Flow_with_Itoo/appinventor.ai_randal_andress.Flow_with_Itoo.Screen1}: java.lang.ClassCastException: me.ekita.FlowContext$hookProcedures$1 cannot be cast to gnu.expr.ModuleMethod
06-27 13:41:30.005 25759 25759 E AndroidRuntime: Caused by: java.lang.ClassCastException: me.ekita.FlowContext$hookProcedures$1 cannot be cast to gnu.expr.ModuleMethod
06-27 13:41:30.005 25759 25759 E Form    : Uncaught Exception
06-27 13:41:30.005 25759 25759 E Form    : java.lang.RuntimeException: Unable to start activity ComponentInfo{appinventor.ai_randal_andress.Flow_with_Itoo/appinventor.ai_randal_andress.Flow_with_Itoo.Screen1}: java.lang.ClassCastException: me.ekita.FlowContext$hookProcedures$1 cannot be cast to gnu.expr.ModuleMethod
06-27 13:41:30.005 25759 25759 E Form    : Caused by: java.lang.ClassCastException: me.ekita.FlowContext$hookProcedures$1 cannot be cast to gnu.expr.ModuleMethod
06-27 13:41:30.006 25759 25759 E Form    : Form Screen1 ErrorOccurred, errorNumber = 909, componentType = Screen1, functionName = <unknown>, messages = java.lang.RuntimeException: Unable to start activity ComponentInfo{appinventor.ai_randal_andress.Flow_with_Itoo/appinventor.ai_randal_andress.Flow_with_Itoo.Screen1}: java.lang.ClassCastException: me.ekita.FlowContext$hookProcedures$1 cannot be cast to gnu.expr.ModuleMethod

[Added about 22:20 GMT]
From a cursory search of several logcat files, it looks like the java.lang.ClassCastException:

me.ekita.FlowContext$hookProcedures$1 to
gnu.expr.ModuleMethod

is common to several of the Itoo/Flow failure cases.

1 Like

As you likely realized, I was not paying close attention to the static content of listTraces on resumption of the app ... Looks like unless the UI/app is "closed" before resumption, listTraces does not get updated and therefore, whoCalledMe does not change :frowning:

So to assure that listTraces is updated upon resumption, I would have to put a "close application" block in the backPressed event.

-Randal