App shuts randomly on POST method without a warning

My app is shutting down more or less randomly after the latest App Inventor update. I suspect that the latest web-component is giving me a fatal error in the case when the old web component just gave me error dialog. Is this a known issue?

Long story:
The idea of the app is to work as "proxy" between BLE-connection and server in internet. The app uses latest BLE-extension for bluetooth, TaifunTools to keep the screen on, the POST method is done to https-address, and in between it locally saves the BLE messages into a txt-file. The BLE-->POST is buffered so that if error occurs, the messages start to pile and they are sent in the right order later.

Before the latest AI update the app worked stable, but now it shuts down randomly without any error message. I was able to find out that everytime the shutting happens, it is when the POST method is used. Usually, the POST is just fine, so it does not happen everytime. I have the 1103-error in the "when screen.ErrorOccurred" block to sent the POST again:


After the latest AI update, I never see that 1103 error in my app, but the app crashes. That is why I suspect that.

I tried the same code, with rewritten web components, with Kodular today and I cannot get it to crash. I do get the 1103-error every once and a while, though. But the app can handle that easily. During the import Kodular told that the web-component were of too high version, and removed them. That's why I rewrote them.

Is this a known issue with the latest web-components and is there some way I can make it work myself?

Jussi

EDIT: I tested the operation of the app when I disable the WiFi from the mobile device, and the latest build in App Inventor crashed immediately when the Kodular build starts to make a pile in the buffer just as it should. I am now sure that it is the source of the error.

Do you want to show your POST method ?

I don't want to tell you the internet address (https://....) but I can show you the blocks inside the emptyFIFO


As stated, for 99% of the time, it works everytime.
Jussi

emptyFIFO procedure is called everytime there is new BLE information (comes in bursts, max few/sec), confirmation from the server about the earlier message going through successfully, or an error in the toServer (like timeout).

If you use adb to capture the log of the app when it crashes, we can use that to understand what's causing the crash.

I will track the problem with adb on Monday morning when I am back in the office. I didn't know about the tool. Good tip.
Jussi

Your dictionary lookup defaults might be poisoning your POST operations.
Consider replacing the yellow circled notfound blocks with default empty dictionaries,
and the light blue circled notfound block with a create empty list block, to match the expected data types.
05ca54bdeadb27a13a14d502fcd20cb0df3cc5a1_2_690x177

I changed the defaults into empty dictionaries and lists. It is better code now but it didn't help with the problem. Similar crash happends immediately after I shut down the WiFi

Those logs include quite a lot of text. I tried my best to get only the information that is relevant and added some pointers about what was happening in the app and device during the time.
Two logs can be loaded from the google drive:
https://drive.google.com/drive/folders/15DKurGhLWJqPSP0lnW54Wc6Ri6WcGtJ5?usp=sharing

Actually, I was able to do better logs with much shorter code. I made an app which only send a short text to test server after the button is pushed.


I did similar apps with AppInventor and Kodular and tested the app without WiFi enabled. The other app crashes without error, and the other app only gives error-message.
Program compiled with App Inventor:
START PROGRAM WITHOUT WIFI AND IT CRASHES WHEN THE BUTTON IS PUSHED TO SEND JSON
08-10 08:53:38.196 1191 1191 E RecyclerView: No adapter attached; skipping layout
08-10 08:54:18.985 248 248 E DumpTunnel: finding regDump() failed
08-10 08:54:19.167 30058 30058 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:54:19.168 30058 30058 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:54:19.650 30058 30058 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:54:19.651 30058 30058 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:54:19.734 248 248 E DumpTunnel: finding regDump() failed
08-10 08:54:19.750 30058 30074 E GED : Failed to get GED Log Buf [GPU_FENCE], err(0)
08-10 08:54:19.788 30058 30074 E GED : Failed to get GED Log Buf [fence_trace], err(0)
08-10 08:54:19.802 30058 30074 E GED : Failed to get GED Log Buf [fence_trace], err(0)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: FATAL EXCEPTION: main
08-10 08:54:22.912 30058 30058 E AndroidRuntime: Process: appinventor.ai_kinnunen_jmk.justJSON, PID: 30058
08-10 08:54:22.912 30058 30058 E AndroidRuntime: java.util.MissingFormatArgumentException: Format specifier '%s'
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at java.util.Formatter.format(Formatter.java:2522)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at java.util.Formatter.format(Formatter.java:2458)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at java.lang.String.format(String.java:2770)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at com.google.appinventor.components.runtime.util.ErrorMessages.formatMessage(ErrorMessages.java:701)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at com.google.appinventor.components.runtime.Form$5.run(Form.java:1015)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:790)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6548)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
08-10 08:54:22.912 30058 30058 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
08-10 08:54:22.972 248 248 E DumpTunnel: finding regDump() failed
08-10 08:54:23.485 248 248 E DumpTunnel: finding regDump() failed
08-10 08:54:23.596 514 573 E DumpTunnel: finding regDump() failed

Program compiled with Kodular:
START PROGRAM WITHOUT WIFI AND IT GIVES 1103 ERROR MESSAGE WHEN THE BUTTON IS PUSHED TO SEND JSON
08-10 08:56:26.905 1191 1191 E RecyclerView: No adapter attached; skipping layout
08-10 08:56:47.216 248 248 E DumpTunnel: finding regDump() failed
08-10 08:56:47.637 30111 30111 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:56:47.637 30111 30111 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:56:47.652 30111 30111 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:56:47.652 30111 30111 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:56:48.221 30111 30111 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:56:48.221 30111 30111 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:56:48.566 248 248 E DumpTunnel: finding regDump() failed
08-10 08:56:48.585 30111 30126 E GED : Failed to get GED Log Buf [GPU_FENCE], err(0)
08-10 08:56:48.612 30111 30129 E KodularBranding: java.net.UnknownHostException: Unable to resolve host "api.creator.kodular.io": No address associated with hostname
08-10 08:56:48.621 30111 30131 E KodularCommission: java.net.UnknownHostException: Unable to resolve host "api.creator.kodular.io": No address associated with hostname
08-10 08:56:48.625 30111 30126 E GED : Failed to get GED Log Buf [fence_trace], err(0)
08-10 08:56:48.639 30111 30126 E GED : Failed to get GED Log Buf [fence_trace], err(0)
08-10 08:56:51.880 30111 30111 E Form : Form Screen1 ErrorOccurred, errorNumber = 1103, componentType = Web, functionName = PostText, messages = Unable to post or put the text "settii" with the specified URL: http://ptsv2.com/t/odhqh-1597045061/post
08-10 08:56:51.888 30111 30111 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:56:51.889 30111 30111 E libc : Access denied finding property "vs.wt_current_version"
08-10 08:56:51.916 248 248 E DumpTunnel: finding regDump() failed

If you are crashing on loss of Internet connection,
you can fail more gracefully if you intercept the failure before trying to use
non-existent connections.

This won't fix your lost connection, but might clue you in faster:

2 Likes

Thanks for the stack trace. I think I've identified the problem and will put together a patch.

Thanks. Looks like a useful tool to figure out why I get those random crashes (is it really the internet access, or server end, or whatever). Now, it is easy to reproduce the problem by switching the wifi, but that is not my root cause. My first impression of constant testing of the internet is that it takes unnecessary amount of computing resources, so it's not going to be part of my final app.

We have updated our test server with a fix for your crash. You may want to try out your project there and confirm that the fix works for you.

1 Like

Thank you. I will try it. The welcoming screen on the server says " Please use Companion 2.59t1u available here.", but there is no link. Let's see if it works with regular 2.59.
EDIT: The companion seems to update automatically when connecting to App Inventor.
I tested and the fix works for me.

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