Can anyone explain me what's going wrong. I am trying for two days but unable to solve, the app is crashing again and again. Download was working normally, but after adding a new page,just to add new download, the app crashed, and even after deleting the page also it continued crashing.
First crash: No information, sudden disconnect.
Second crash:
D/EgretLoader(28378): EgretLoader(Context context)
D/EgretLoader(28378): The context is not activity
W/WM-WorkSpec(28378): Backoff delay duration less than minimum value
D/DownloadWorker(28378): DownloadWorker{url=https://bppimt.ac.in/nu/Notice/Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf,filename=Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf,savedDir=/storage/emulated/0/Download,header=,isResume=false
D/DownloadWorker(28378): Update notification: {notificationId: 1, title: Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf, status: 2, progress: 0}
D/DownloadWorker(28378): Open connection to https://bppimt.ac.in/nu/Notice/Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf
I/com.mcd.twb(28378): Background concurrent copying GC freed 23356(1592KB) AllocSpace objects, 90(3MB) LOS objects, 49% free, 5MB/10MB, paused 19.531ms total 75.666ms
W/ContentCatcher(28378): Failed to notify a WebView
E/libEGL (28378): call to OpenGL ES API with no current context (logged once per thread)
I/flutter (28378): Fatal: could not find callback
E/libEGL (28378): validate_display:92 error 3008 (EGL_BAD_DISPLAY)
I/chatty (28378): uid=10621(com.mcd.twb) RenderThread identical 3 lines
E/libEGL (28378): validate_display:92 error 3008 (EGL_BAD_DISPLAY)
F/OpenGLRenderer(28378): Failed to set damage region on surface 0x79eadeef00, error=EGL_BAD_DISPLAY
Lost connection to device.
Rest of the crashes:
D/DownloadWorker(32459): DownloadWorker{url=https://bppimt.ac.in/nu/Notice/Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf,filename=Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf,savedDir=/storage/emulated/0/Download,header=,isResume=false
D/DownloadWorker(32459): Update notification: {notificationId: 1, title: Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf, status: 2, progress: 0}
D/DownloadWorker(32459): Open connection to https://bppimt.ac.in/nu/Notice/Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf
I/com.mcd.twb(32459): NativeAlloc concurrent copying GC freed 22912(1545KB) AllocSpace objects, 82(2MB) LOS objects, 49% free, 5MB/10MB, paused 116us total 227.920ms
I/flutter (32459): Fatal: could not find callback
Lost connection to device.
Answering my own question. The problem is finally solved, it was the problem with my code. Actually I have created the new page outside the main channel. So it was not properly initialized. Now it is working fine.
If someone facing same issue, application get crash immediately after starting download.
Then please ensure that you've register the download callback, check it #445
For anybody experiencing this issue, do something like this:
initFlutterDownloader() async {
await FlutterDownloader.initialize(
debug: true // optional: set false to disable printing logs to
console
);
}
then paste this code in initState in the page you want to download the file from:
initFlutterDownloader();
Related
Performed tests:
Test1: The whole memory 383KB (left the first 1KB for BLE stack) is allocated to Datalogger and Logbook.
All the previous logs are cleared and datalogger is started with a new id and data paths to use full memory.
When all the memory is used and full, it starts to overwrite the previously saved content in the same log and the size stagnates at (382-383 KB). I could all the 383kB of data right after stopping the datalogger without resetting the sensor, but if I reset the device and check the size of the saved log it gives a different size (something way less than 383kB, I am assuming it's the size of data that is left after overwriting)
Test2: Cleared the whole memory and created two logs of the sizes 50kB, 100kB and started another log (all with different log Id's) to full capacity.
Now when the memory is full, it starts to overwrite the firs most log that is saved and then the next and finally it overwrites itself and size again stagnates at 383kB.
Could read the whole contents before reset but after a reset the size changes as it happened with the previous test.
I tried to subscribe to /Mem/Logbook/IsFull/Subscription but it throws an error like res=FULL, unsuported datatype. etc
Couldn't find a way to resolve that.
How to make the Datalogger stop logging when memory is full?
And get a call back to the application when it happens?
You can subscribe to the /Mem/Logbook/IsFull with the following firmware code:
// Subscribe to mem full notification
asyncSubscribe(WB_RES::LOCAL::MEM_LOGBOOK_ISFULL());
And stop the logging by adding this piece in the switch statement in onNotify() callback:
case WB_RES::LOCAL::MEM_LOGBOOK_ISFULL::LID:
{
// Stop Logging when logbook mem is full
const bool isFull = value.convertTo<bool>();
DEBUGLOG("onNotify MEM_LOGBOOK_ISFULL: %d", isFull);
if (isFull)
{
asyncPut(WB_RES::LOCAL::MEM_DATALOGGER_STATE(), AsyncRequestOptions::Empty, WB_RES::DataLoggerStateValues::DATALOGGER_READY);
}
break;
}
Full disclosure: I work for the Movesense team
I have a home page that does the initial datastore sync in the init() function. There are QueryPredicates that are based on a variable that can change (on a different page).
So basically, after I start the app, everything syncs correctly. Then, I go to another page and change the value that those QueryPredicates depend on, but the sync doesn't occur. Instead, I get an error (that I'm almost positive is caused from the datastore.clear()).
Here is a look at what the QueryPredicate and value change looks like...
List<String> variableThatChanges = ['initialValue']; // belongs to a global class instance
QueryPredicate sampleTest() {
QueryPredicate res = Sample.AUTHGROUP
.eq(variableThatChanges.isEmpty ? '' : variableThatChanges[0]);
return res;
}
// And when the value is changed, it's changed like this...
variableThatChanges = ['newValue'].toList(); // Not sure if .toList() is actually necessary or not
And this is the rest of the logic...
// Change the variable value, then...
await Amplify.DataStore.stop();
await Amplify.DataStore.clear();
await Amplify.DataStore.start();
Amplify.DataStore.listen([HubChannel.DataStore], (msg) {// do things with the events});
await Amplify.DataStore.save("basic log message to log the change and initiate sync if hasn't already happened");
NOTE: I actually have these commands wrapped in a try/catch and have some other small things going on so each of the above commands is in it's own function and I call them in the following way...
stopStore().then((_) => clearStore()).then((_) => startStore()).then((_) => listenToHub()).then((_) => logEvent());
The error that is produced is the following:
I/amplify:aws-api(11613): No more active subscriptions. Closing web socket.
W/amplify:aws-api(11613): Thread interrupted awaiting subscription acknowledgement.
W/amplify:aws-api(11613): at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1081)
W/amplify:aws-api(11613): at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1369)
W/amplify:aws-api(11613): at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:278)
W/amplify:aws-api(11613): at com.amplifyframework.api.aws.SubscriptionEndpoint$Subscription.awaitSubscriptionReady(SubscriptionEndpoint.java:381)
W/amplify:aws-api(11613): at com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(SubscriptionEndpoint.java:183)
W/amplify:aws-api(11613): at com.amplifyframework.api.aws.MutiAuthSubscriptionOperation.dispatchRequest(MutiAuthSubscriptionOperation.java:113)
W/amplify:aws-api(11613): at com.amplifyframework.api.aws.MutiAuthSubscriptionOperation.$r8$lambda$iziEcYpvlINdYbit2it7fDbbt8A(Unknown Source:0)
W/amplify:aws-api(11613): at com.amplifyframework.api.aws.MutiAuthSubscriptionOperation$$ExternalSyntheticLambda4.run(Unknown Source:2)
W/amplify:aws-api(11613): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
W/amplify:aws-api(11613): at java.util.concurrent.FutureTask.run(FutureTask.java:264)
W/amplify:aws-api(11613): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
W/amplify:aws-api(11613): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
W/amplify:aws-api(11613): at java.lang.Thread.run(Thread.java:1012)
D/TrafficStats(11613): tagSocket(71) with statsTag=0xffffffff, statsUid=-1
E/amplify:aws-datastore(11613): Failure encountered while attempting to start API sync.
...
W/amplify:aws-datastore(11613): API sync failed - transitioning to LOCAL_ONLY.
...
I/amplify:aws-datastore(11613): Orchestrator transitioning from SYNC_VIA_API to LOCAL_ONLY
I/amplify:aws-datastore(11613): Setting currentState to LOCAL_ONLY
I/amplify:aws-datastore(11613): Stopping subscription processor.
Of note, the only other time we use Datastore.clear() in our app is prior to the the user signing out, and the same No more active subscriptions. Closing web socket. message comes up.
Any help at figuring out how to fix this to allow for the re-sync after changing the QueryPredicate value would really be appreciated.
It's weird, a lot of times, if I go back to the homepage the init() code with run again and then things start working as desired. This isn't all the time, but most of the time. The thing about that is, that I believe Amplify.configure() is being called again (which I know isn't recommended to do more than once in the apps lifecycle).
I've tried everything listed above, but can't get the subscription error to go away and the app to re-sync correctly.
The end goal is to be able to clear the datastore and get a fresh sync using the new variable in the QueryPredicate.
After reviewing open tickets in the amplify-flutter github repo I came across this one:
https://github.com/aws-amplify/amplify-flutter/issues/1479
Basically, you can't await Datastore.clear() or Datastore.close() (on Android). It's a bug that is supposed to be being worked on, but the ticket is still open and it'll be a year next month, so who knows when it'll be fixed.
Anyways, one of the suggestions in there is to simply implement a manual delay of 2 seconds after you call Datastore.clear().
I ended up doing this after both of my calls, (Datastore.stop() and Datastore.clear()) and everything works just fine now. It's just a timing issue with the asynchronous functions.
So, as mentioned, this isn't the best solution, but until the amplify-flutter team implements a fix, this seems to be a valid workaround.
Here's an error that occurs occasionally and intermittently when using Flutter's justaudio plugin with .m4a audio files;
createTrack returned error -12
E/AudioTrack(22346): createTrack_l(8194608): AudioFlinger could not create track, status: -12 output 0
E/AudioTrack-JNI(22346): Error -12 initializing AudioTrack
D/AudioTrack(22346): gather(): no metrics gathered, track status=-12
E/android.media.AudioTrack(22346): Error code -20 when initializing AudioTrack.
E/IAudioFlinger(22346): createTrack returned error -12
The file seems there and clicking play with forward the progress bar but I can't hear anything. If I close and restart Android Studio the problem goes away but it makes me worried about going live. How do I troubleshoot this?
On Android, audio players are resource intensive and there are a limited number of them that you can allocate before you get this error. You need to ensure that you dispose of a player once it's no longer being used, before you create new ones, otherwise you'll run out of resources.
I am loading the data in the NSdata before viewdidload
I got following message
void SendDelegateMessage(NSInvocation*): delegate failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
If you were not using the touch screen for this entire interval (which can prolong this wait), please file a bug.
I'd suggest not doing something on your main thread which will take 10 seconds at startup. Show some UI, use a background thread to load large data sets.
I have a uiscrollview within three subUIViews 1, 2, 3. I load content for subUIView1, 2,3 dynamically. Here are steps
I create scrollview with these 3
subUIview and with a default size
for each subUIView
I create an operation for each subUIView, let us say Operation 1,2,3. add to operation queue
every Operation (operation 1) calculate the content that will be later draw in related subUIView (subview 1). after calculate completed, create CGLayer and attach it with UISubview1. reset all UIsubviews frame and bound and layout scrollview subviews and setNeedDisplay for related subUIview1. then move to next operation
in SubUIView drawRect method, i call CGLayerDrawInRect.
then occasionly i
get this error Invalid Context.
sometimes, it work fine, no error sometime it happened
Any idea about this error will be welcome.
.
Take a very long time to debug and finally find what is the problem and resolved. Here is the thing
When operation 1 setNeedDisplay sent out, drawRect have not called yet
Once drawRect is called, operation 2 is already running, during drawRect running,operation 2 somehow change subview1,2,3, layout and frame at the same time.
So, the bad thing happened, context will become invalid that time because frame are changing, and also worst, you may receive exe_bad_access false message
Resolve solution, i set a singal to make sure operation 1 drawRect is done then let operation 2 start run.
I have to say XCode is terrible development tools compare what MS studio tools. It gives message like invalid Context or exe_bad_access randomly. where is the productivity for our poor developer. However, Iphone OSX is much better than MS windows mobile. that is why i am working hard to use XCode creatively.