Vaadin 23 WebSockets iPhone updates with delays - iphone

I noticed a strange behavior - sometimes (not always) on my iPhone I click a button with asynchronous logic(#Push), but nothing happens. Then I press another button on the same screen and can see that the response for the first button comes, but now nothing happens for the second button. And so on… I always need to press the next button to complete the action called by the previous one… What could be causing this?
I do not see any issues in NGINX/Tomcat logs, I see requests in the access logs. Also, on my computer, everything is working fine. This issue is only appears on my iPhone. If I refresh the page - everything starts working properly.
UPDATED
In application logs I see the following DEBUG message:
2022-11-13 05:38:23.147 DEBUG 1545984 --- [http-nio-8080-exec-10] com.vaadin.flow.server.StaticFileServer : failed to read jar file contents
java.io.IOException: Can not read scheme 'war' for resource jar:war:file:/srv/..../ui-0.0.1.jar*/BOOT-INF/lib/flow-push-23.2.6.jar!/META-INF/resources/VAADIN/static/push/vaadinPush-min.js and will determine this as not a folder
at com.vaadin.flow.server.StaticFileServer.getFileSystem(StaticFileServer.java:173) ~[flow-server-23.2.6.jar!/:23.2.6]
at com.vaadin.flow.server.StaticFileServer.resourceIsDirectory(StaticFileServer.java:116) ~[flow-server-23.2.6.jar!/:23.2.6]
at com.vaadin.flow.server.StaticFileServer.serveStaticResource(StaticFileServer.java:277) ~[flow-server-23.2.6.jar!/:23.2.6]
at com.vaadin.flow.server.VaadinServlet.serveStaticOrWebJarRequest(VaadinServlet.java:401) ~[flow-server-23.2.6.jar!/:23.2.6]
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:356) ~[flow-server-23.2.6.jar!/:23.2.6]
at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:106) ~[vaadin-spring-23.2.6.jar!/:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:779) ~[tomcat-embed-core-9.0.68.jar!/:na]
Should I be worried about such a message?
and one more exception:
2022-11-13 05:42:12.308 DEBUG 1545984 --- [http-nio-8080-exec-8] org.atmosphere.container.JSR356Endpoint : Problem in web socket session
java.io.EOFException: null
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1340) ~[tomcat-embed-core-9.0.68.jar!/:na]
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1227) ~[tomcat-embed-core-9.0.68.jar!/:na]
at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:75) ~[tomcat-embed-websocket-9.0.68.jar!/:na]
at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:183) ~[tomcat-embed-websocket-9.0.68.jar!/:na]
at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:162) ~[tomcat-embed-websocket-9.0.68.jar!/:na]
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:157) ~[tomcat-embed-websocket-9.0.68.jar!/:na]
at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:60) ~[tomcat-embed-core-9.0.68.jar!/:na]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:59) ~[tomcat-embed-core-9.0.68.jar!/:na]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.68.jar!/:na]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789) ~[tomcat-embed-core-9.0.68.jar!/:na]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.68.jar!/:na]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.68.jar!/:na]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.68.jar!/:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.68.jar!/:na]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
What may be wrong with my setup? Please advise where to look in order to fix this.

Related

Unable to sync after Amplify.Datastore.clear()

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.

Android 11 EventSequenceValidator: IntentStarted during UNKNOWN. exception thrown at start of every activity

In Android 11 SDK 30 at the start of every activity I get a stack trace as follows:
2020-12-30 10:08:00.175 1417-1436/? D/EventSequenceValidator: IntentStarted during UNKNOWN. Intent { cmp=com.lampreynetworks.ahd.health.at.home/.DebugLogActivity }
java.lang.Throwable: EventSequenceValidator#getStackTrace
at com.google.android.startop.iorap.EventSequenceValidator.logWarningWithStackTrace(EventSequenceValidator.java:260)
at com.google.android.startop.iorap.EventSequenceValidator.onIntentStarted(EventSequenceValidator.java:106)
at com.android.server.wm.LaunchObserverRegistryImpl.handleOnIntentStarted(LaunchObserverRegistryImpl.java:139)
at com.android.server.wm.LaunchObserverRegistryImpl.lambda$veRn_GhgLZLlOHOJ0ZYT6KcfYqo(Unknown Source:0)
at com.android.server.wm.-$$Lambda$LaunchObserverRegistryImpl$veRn_GhgLZLlOHOJ0ZYT6KcfYqo.accept(Unknown Source:10)
at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:292)
at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:201)
at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
at com.android.server.ServiceThread.run(ServiceThread.java:44)
The activities all work and if I didn't look at Logcat I would never have known. However, I do not understand it and it must be sign of some issue that will come back (eventually) to bite me. Anyone understand this behavior and know how to fix it?
I have had this code over many versions from way back at 4.0.3 and have never seen this until now. Note this happens on EVERY activity.
I found the same suspicious log EventSequenceValidator: IntentStarted during UNKNOWN from logcat, haven't found a solution yet, but found a reference here, FYI EventSequenceValidator.java.
If any bad transition happened, the state becomse UNKNOWN. The UNKNOWN state
could be accumulated, because during the UNKNOWN state more IntentStarted may
be triggered. To recover from UNKNOWN to INIT, all the accumualted IntentStarted
should termniate.

UndeliverableException thrown within a RxAndroidBle stream

I have a misbehaving BLE device (temp sensor) that keeps throwing a status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT) exception everytime i try to connect to the device. I'm not concerned about this exception as the device is faulty.
However, I keep getting notified that i've not handled the error correctly by rxjava2 when using RxAndroidBle(1.9.1); see here;
This is my code.
rxBleClient
.getBleDevice(macAddress)
.establishConnection(false)
.flatMapSingle { it.readRssi() }
.subscribe({ "test1:Success" }, { "test1:error" })
and the Error
I/RxBle#GattCallback: MAC='E9:CF:8A:D0:01:19' onConnectionStateChange(), status=8, value=0
D/RxBle#ClientOperationQueue: FINISHED ConnectOperation(147547253) in 10257 ms
D/RxBle#ConnectionOperationQueue: Connection operations queue to be terminated (MAC='E9:CF:8A:D0:01:19')
com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='E9:CF:8A:D0:01:19' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)
at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback$2.onConnectionStateChange(RxBleGattCallback.java:77)
at android.bluetooth.BluetoothGatt$1$4.run(BluetoothGatt.java:249)
at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:725)
at android.bluetooth.BluetoothGatt.-wrap0(Unknown Source:0)
at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:244)
at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:70)
at android.os.Binder.execTransact(Binder.java:697)
D/BleDeviceManagerNew$observeRssiTest: test1:error
E/plication$setupApp: Terminal Exception From RXJAVA was Not handled correctly
io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='E9:CF:8A:D0:01:19' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
at io.reactivex.internal.operators.observable.ObservableUnsubscribeOn$UnsubscribeObserver.onError(ObservableUnsubscribeOn.java:67)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onError(ObservableSubscribeOn.java:63)
I'm not sure what else I should do - i've implemented a 'catch all' solution but don't like this approach;
RxJavaPlugins.setErrorHandler { e -> Timber.e(e, "Terminal Exception From RXJAVA was Not handled correctly") }
but don't see that as a good solution as expected that i should be-able to handle exception on the steam. Any suggestions of where I went wrong?
Your code is fine. The library has a flaw that does not allow to achieve your desired behaviour. More on the topic is on this library's wiki page.
While it is possible to design an API that would not throw UndeliverableException it would need to have a separate error Observable or Completable for BluetoothAdapter turning off and a separate one for RxBleConnection disconnect. The user would be responsible to mix those into their chain appropriately.
Current API does not allow it.

Issue with iText when doing document.Close... Unbalanced Save Restore state operators

We have an application which was working fine as a monolith.
Now we are in the process of splitting the application
In this process, I am getting an error stating something as shown here below...
This happens only at the place of d.close()
Document d = new Document(PageSize.A4, 10, 10, 50, 50);
......
.....
finally{
if(d.isOpen()) {
d.close();
}
byteOutputStream.flush();
byteOutputStream.close();
pw.close();
return byteOutputStream.toByteArray();
}
(As a monolith the whole application was working fine)
(iText2.1.7 jar is used)
at com.ibm.CORBA.iiop.UtilDelegateImpl.mapSystemException(UtilDelegateImpl.java:241)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:84)
at <<stub path>>.retrieve(_fileName1Remote_Stub.java:1)
at <<filePath>>.retrieve(fileName2.java:778)
at <<filePath>>.onCustomAction1(fileName3.java:403)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.el.parser.AstValue.invoke(AstValue.java:266)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
at org.apache.myfaces.view.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:83)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:83)
... 43 more
Caused by: com.itextpdf.text.exceptions.IllegalPdfSyntaxException: Unbalanced save/restore state operators.
at com.itextpdf.text.pdf.PdfContentByte.sanityCheck(PdfContentByte.java:3171)
at com.itextpdf.text.pdf.PdfContentByte.toPdf(PdfContentByte.java:245)
at com.itextpdf.text.pdf.PdfFormXObject.(PdfFormXObject.java:88)
at com.itextpdf.text.pdf.PdfTemplate.getFormXObject(PdfTemplate.java:241)
at com.itextpdf.text.pdf.PdfWriter.addSharedObjectsToBody(PdfWriter.java:1257)
at com.itextpdf.text.pdf.PdfWriter.close(PdfWriter.java:1169)
at com.itextpdf.text.pdf.PdfDocument.close(PdfDocument.java:780)
at com.itextpdf.text.Document.close(Document.java:409)
at <>.createPDF(<>.java:135)
at <>.getPdfData(fileName1Bean.java:339)
at <>.retrieve(fileName1Bean.java:205)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5730)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:568)
at <>.retrieveIntercept(<>.java:43)
at sun.reflect.GeneratedMethodAccessor215.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:229)
at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5621)
at <>_c01dfd09.retrieve(EJSRemote0SL<>Bean_c01dfd09.java)
at <>Bean_c01dfd09_Tie.retrieve(_<>Bean_c01dfd09_Tie.java:1)
at <>.invoke(<>_c01dfd09_Tie.java)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:669)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:523)
at com.ibm.rmi.iiop.ORB.process(ORB.java:523)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1575)
at com.ibm.rmi.iiop.Connection.doRequestWork(Connection.java:3039)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2922)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64)
at com.ibm.ws.giop.threadpool.WorkQueueElement.dispatch(WorkQueueElement.java:165)
at com.ibm.ws.giop.filter.GiopFilterChain.processMessage(GiopFilterChain.java:203)
at com.ibm.ws.giop.threadpool.PooledThread.handleRequest(PooledThread.java:81)
at com.ibm.ws.giop.threadpool.PooledThread.run(PooledThread.java:102)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
So here it is...
First of all, I apologize if there was ambiguity in my question.
As said, version 2.1.7 is also used (thanks to the point made by Amedee). There is a 5.x version which I found in the shared libraries of the server.
Since the directory structure is totally different between the two versions, both the jars are maintained for a specific reason.
Also, I am new to this whole application myself and trying to get an understanding with people around in this project. When people who developed it may not be here, I thought a post may give me some idea. So, you are also partly correct Mr.Lowagie - I am ignorant on iText and doing my learning as well - I do not have a reason to Lie! :-).
Mkl, there is no exception in the try block. What eventually turned out was that the image was not getting generated or getting garbled for some other reasons. And it is being investigated. I have given this activity to a person who understands the system better than I do.
Thanks to all your mails and support my dear friends!

Problem loading range_slices in Cassandra

I'm having just a little bit of trouble getting data out of Cassandra. The main problem is this exception:
ERROR 15:45:07,037 Internal error processing get_range_slices
java.lang.AssertionError: (162293240116362681726824838407749997815,35552186147124906726154103286687761342]
at org.apache.cassandra.db.ColumnFamilyStore.getRangeSlice(ColumnFamilyStore.java:1251)
at org.apache.cassandra.service.StorageProxy.getRangeSlice(StorageProxy.java:428)
at org.apache.cassandra.thrift.CassandraServer.get_range_slices(CassandraServer.java:513)
at org.apache.cassandra.thrift.Cassandra$Processor$get_range_slices.process(Cassandra.java:2868)
at org.apache.cassandra.thrift.Cassandra$Processor.process(Cassandra.java:2555)
at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:167)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
So what do I do? I use describe_ring to get the topology of the network, then I ask each of the nodes in the network describe_splits which gives me the tokens I should use to fetch the ranges, and then I just start asking for them, making sure that I set the start_token and end_token on the keyranges.
Any ideas?
That's a bug fixed for 0.6.9 and 0.7rc2.