RSocket : RejectedResumeException (0x4): unknown resume token - rsocket

I am using rsocket starter in Spring Boot (2.5.3). I have a requester and responder set up and its working quite well (for all kind of rsocket communication). The issue is when I am trying to implement resumability option on the requester side.
Here is the code for requester
#Bean
public RSocketRequester rSocketRequester(RSocketRequester.Builder builder) {
Resume resume = new Resume()
.sessionDuration(Duration.ofMinutes(15))
.streamTimeout(Duration.ofMinutes(15))
.retry(Retry.fixedDelay(Long.MAX_VALUE, Duration.ofSeconds(5))
.doBeforeRetry(s -> System.out.println("Resume: Before Retry : "+s))
.doAfterRetry(s -> System.out.println("Resume: After Retry : "+s))
);
return builder
.dataMimeType(MimeType.valueOf("application/json"))
.rsocketConnector(rSocketConnector -> {
rSocketConnector.reconnect(Retry.fixedDelay(10, Duration.ofSeconds(20)).doBeforeRetry(s -> {
System.out.println("Reconnect : Disconnected. Trying to reconnect..."+s);
}));
rSocketConnector.resume(resume);
})
.websocket(URI.create("ws://localhost:9190/api/workflow/realtime"));
}
On the responder side:
#Bean
RSocketServerCustomizer rSocketResume() {
Resume resume = new Resume()
.sessionDuration(Duration.ofMinutes(15))
.streamTimeout(Duration.ofMinutes(15))
.retry(Retry.fixedDelay(Long.MAX_VALUE, Duration.ofSeconds(5))
.doBeforeRetry(s -> System.out.println("Resume: Before Retry : "+s))
.doAfterRetry(s -> System.out.println("Resume: After Retry : "+s))
);
return rSocketServer -> rSocketServer.resume(resume );
}
But when responder goes down and comes back alive, I get below error on requester console:
**[----> Responder dead at this point]**
Resume: Before Retry : attempt #1 (1 in a row), last failure={io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:9190}
Resume: After Retry : attempt #1 (1 in a row), last failure={io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:9190}
Resume: Before Retry : attempt #2 (2 in a row), last failure={io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:9190}
Resume: After Retry : attempt #2 (2 in a row), last failure={io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:9190}
Resume: Before Retry : attempt #3 (3 in a row), last failure={io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:9190}
Resume: After Retry : attempt #3 (3 in a row), last failure={io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:9190}
**[<---- Responder back to live at this point]**
2021-08-08 04:48:39.404 ERROR 24748 --- [actor-tcp-nio-5] reactor.core.publisher.Operators : Operator called default onErrorDropped
reactor.core.Exceptions$ErrorCallbackNotImplemented: RejectedResumeException (0x4): unknown resume token
Caused by: io.rsocket.exceptions.RejectedResumeException: unknown resume token
at io.rsocket.exceptions.Exceptions.from(Exceptions.java:64) ~[rsocket-core-1.1.1.jar:na]
at io.rsocket.resume.ClientRSocketSession.tryReestablishSession(ClientRSocketSession.java:271) ~[rsocket-core-1.1.1.jar:na]
at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:196) ~[reactor-core-3.4.8.jar:3.4.8]
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) ~[reactor-core-3.4.8.jar:3.4.8]
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:249) ~[reactor-core-3.4.8.jar:3.4.8]
at reactor.core.publisher.FluxFirstWithSignal$FirstEmittingSubscriber.onNext(FluxFirstWithSignal.java:330) ~[reactor-core-3.4.8.jar:3.4.8]
at reactor.core.publisher.MonoCreate$DefaultMonoSink.success(MonoCreate.java:160) ~[reactor-core-3.4.8.jar:3.4.8]
at io.rsocket.core.SetupHandlingDuplexConnection.onNext(SetupHandlingDuplexConnection.java:114) ~[rsocket-core-1.1.1.jar:na]
at io.rsocket.core.SetupHandlingDuplexConnection.onNext(SetupHandlingDuplexConnection.java:19) ~[rsocket-core-1.1.1.jar:na]
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:120) ~[reactor-core-3.4.8.jar:3.4.8]
at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:279) ~[reactor-netty-core-1.0.9.jar:1.0.9]
at reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:388) ~[reactor-netty-core-1.0.9.jar:1.0.9]
at reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:404) ~[reactor-netty-core-1.0.9.jar:1.0.9]
at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:706) ~[reactor-netty-http-1.0.9.jar:1.0.9]
at reactor.netty.http.client.WebsocketClientOperations.onInboundNext(WebsocketClientOperations.java:159) ~[reactor-netty-http-1.0.9.jar:1.0.9]
at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:93) ~[reactor-netty-core-1.0.9.jar:1.0.9]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) ~[netty-codec-4.1.66.Final.jar:4.1.66.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) ~[netty-codec-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) ~[netty-transport-4.1.66.Final.jar:4.1.66.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[netty-common-4.1.66.Final.jar:4.1.66.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.66.Final.jar:4.1.66.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.66.Final.jar:4.1.66.Final]
at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_261]
2021-08-08 04:48:39.407 ERROR 24748 --- [actor-tcp-nio-5] reactor.Flux.Map.1 : onError(RejectedResumeException (0x4): unknown resume token)
Can anyone suggest why this behavior? Also I want to understand what is this token on resume?
Thanks.

Related

Getting SocketTimeOutException , what is diff between results I'm getting for 2 different time outs

On test and prod environment getting lot of socketTimeOut Exception when the timeout limit was 2sec the error rate was a lot 37% but there were successful calls as well not all of them failed.
As a trail we tried increasing timeout limit to 10sec the error rate is 0.9% with still lot of SocketTimeOUtException in the logs , here again there are many successful calls as well.
So my question is, if the service get response in 2Sec for few request does it mean the server is capable of serving the request within 2 sec? and there could be a bottle neck at the server side so it is not responding.
Recently it has started occurring. Also I could see this generally happens between 12 pm to 4 pm when there is lots of request.
Can I assume if there are few requests which are successful, does it means all the connection related majors are in place correctly for eg. the port it is trying to connect to
Will it be a good try to see by creating an extra kubernetes pod when there is load on the service during peek time.
java.net.SocketTimeoutException: timeout
at okio.Okio$4.newTimeoutException(Okio.java:232)
at okio.AsyncTimeout.exit(AsyncTimeout.java:286)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:241)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:358)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:230)
at okhttp3.internal.http1.Http1ExchangeCodec.readHeaderLine(Http1ExchangeCodec.java:242)
at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.java:213)
at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.java:115)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:43)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at datadog.trace.instrumentation.okhttp3.TracingInterceptor.intercept(TracingInterceptor.java:35)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:223)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at com.product.composition.client.config.ExceptionTranslatorInterceptor.intercept(ExceptionTranslatorInterceptor.java:15)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
at okhttp3.RealCall.execute(RealCall.java:81)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:186)
at com.product.billing.platform.retrofit.adapter.UnwrappedCallAdapterFactory$BodyCallAdapter.adapt(UnwrappedCallAdapterFactory.java:51)
at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:89)
at retrofit2.Retrofit$1.invoke(Retrofit.java:147)
at com.sun.proxy.$Proxy134.generatePDF(Unknown Source)
at com.product.main.composition.service.PdfGeneratorServiceImpl.lambda$null$0(PdfGeneratorServiceImpl.java:56)
at reactor.core.publisher.MonoCallable.subscribe(MonoCallable.java:56)
at reactor.core.publisher.FluxRetryPredicate$RetryPredicateSubscriber.resubscribe(FluxRetryPredicate.java:124)
at reactor.core.publisher.MonoRetryPredicate.subscribeOrReturn(MonoRetryPredicate.java:51)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)
at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:173)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782)
at reactor.core.publisher.MonoCompletionStage.lambda$subscribe$0(MonoCompletionStage.java:86)
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
at java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:792)
at java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2153)
at java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:110)
at reactor.core.publisher.MonoCompletionStage.subscribe(MonoCompletionStage.java:61)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782)
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241)
at reactor.core.publisher.FluxHide$SuppressFuseableSubscriber.onNext(FluxHide.java:127)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782)
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241)
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782)
at reactor.core.publisher.MonoCallable.subscribe(MonoCallable.java:61)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782)
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73)
at reactor.core.publisher.FluxRetryPredicate$RetryPredicateSubscriber.onNext(FluxRetryPredicate.java:82)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782)
at reactor.core.publisher.MonoCallable.subscribe(MonoCallable.java:61)
at reactor.core.publisher.FluxRetryPredicate$RetryPredicateSubscriber.resubscribe(FluxRetryPredicate.java:124)
at reactor.core.publisher.MonoRetryPredicate.subscribeOrReturn(MonoRetryPredicate.java:51)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)
at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:173)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782)
at reactor.core.publisher.MonoCompletionStage.lambda$subscribe$0(MonoCompletionStage.java:86)
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
at java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:792)
at java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2153)
at java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:110)

Error trapping Swift Google upload to Firebase code

We are writing an iOS app that uploads data to Google Firebase storage. We use the code below to upload text data to the location we specify. It works fine, except when we are not connected to the internet.
For the case of not being connected to the internet, we are having trouble trapping and handling the error. As far as we can tell, the delegate is never called (MyFirebaseProtocol_UploadTextComplete doesn't fire until much later, perhaps after a timeout) , and it just tries to upload repeatedly. If we are connected to the Mac and watching the debug window, it continuously generates errors in a loop, indefinitely. These certainly look like they are intended to be trappable (class names like NSErrorFailingURLStringKey, and helpful error messages and codes), but so far we are unable to trap them as they occur.
We are relatively new at swift, but is there some syntax, something like exception handling, that will allow us to trap and handle these errors, rather than just loop indefinitely?
Thanks!
func UploadTextFile(filepath : String, text: String, delegate : MyFirebaseProtocol)
{
let storage = Storage.storage()
let storageRef = storage.reference()
let textfileref = storageRef.child(filepath)
let data: Data? = text.data(using: .utf8)
textfileref.putData(data!, metadata: nil)
{
(metadata, error) in
delegate.MyFirebaseProtocol_UploadTextComplete(error: error)
}
}
Error messages in Xcode debug window:
2022-01-20 15:15:38.553528-0500 GarmentTest[431:60410] Connection 1: received failure notification
2022-01-20 15:15:38.553552-0500 GarmentTest[431:60410] Connection 1: failed to connect 1:50, reason -1
2022-01-20 15:15:38.553564-0500 GarmentTest[431:60410] Connection 1: encountered error(1:50)
2022-01-20 15:15:38.555426-0500 GarmentTest[431:60410] Connection 2: received failure notification
2022-01-20 15:15:38.555442-0500 GarmentTest[431:60410] Connection 2: failed to connect 1:50, reason -1
2022-01-20 15:15:38.555452-0500 GarmentTest[431:60410] Connection 2: encountered error(1:50)
2022-01-20 15:15:38.557057-0500 GarmentTest[431:60410] Task .<1> HTTP load failed, 0/0 bytes (error code: -1009 [1:50])
2022-01-20 15:15:38.557104-0500 GarmentTest[431:60410] Task <1D0E3033-5A15-4435-AF3D-99A06EAB4C3C>.<2> HTTP load failed, 0/0 bytes (error code: -1009 [1:50])
2022-01-20 15:15:38.557485-0500 GarmentTest[431:60410] Connection 3: received failure notification
2022-01-20 15:15:38.557544-0500 GarmentTest[431:60410] Connection 3: failed to connect 1:50, reason -1
2022-01-20 15:15:38.557664-0500 GarmentTest[431:60410] Connection 3: encountered error(1:50)
2022-01-20 15:15:38.558844-0500 GarmentTest[431:60268] Task .<1> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x280374a80 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask .<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask .<1>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://firebasestorage.googleapis.com/v0/b/garmenttest-8897e.appspot.com/o/Snapshots%2FAn%2FAn_20220120_151528_Relaxed_Center_Image_1B.png?uploadType=resumable&name=Snapshots%2FAn%2FAn_20220120_151528_Relaxed_Center_Image_1B.png, NSErrorFailingURLKey=https://firebasestorage.googleapis.com/v0/b/garmenttest-8897e.appspot.com/o/Snapshots%2FAn%2FAn_20220120_151528_Relaxed_Center_Image_1B.png?uploadType=resumable&name=Snapshots%2FAn%2FAn_20220120_151528_Relaxed_Center_Image_1B.png, _kCFStreamErrorDomainKey=1}

Occasional error o.k.k.s.common.zk.ControlNodeTracker - Unknown Error on KAA server

To give you the background, we are running kaa server on ubuntu in combination with MongoDB and have Endpoints attached to it (max 10). Apparently I am seeing following error way too frequently on our server and this makes our Kaa client (C client) throw a segment fault error.
The work around we have found out is restarting kaa-node service on server.
We are planning to go live with product with IoT enabled features and we are worried about this.
Can someone throw light as to what might be going wrong?
I understand the problem is with zookeeper and looks like it does not find operations servers
2017-05-11 12:31:23,808 [EPS-core-dispatcher-208419] DEBUG o.k.k.s.o.s.a.a.core.TenantActor - [f8d64123-6861-446f-b937-1e1d398159c8] Processing status request
2017-05-11 12:31:23,808 [EPS-core-dispatcher-208419] TRACE o.k.k.s.o.s.a.a.c.ApplicationActor - [26309946599256320307] Received: org.kaaproject.kaa.server.operations.service.akka.messages.core.stats.StatusRequestMessage#fb460fe
2017-05-11 12:31:23,808 [EPS-core-dispatcher-208419] DEBUG o.k.k.s.o.s.a.a.c.ApplicationActor - [f8d64123-6861-446f-b937-1e1d398159c8] Processing status request
2017-05-11 12:31:23,808 [EPS-core-dispatcher-208419] TRACE o.k.k.s.o.s.a.a.core.TenantActor - [1] Received: org.kaaproject.kaa.server.operations.service.akka.messages.core.stats.ApplicationActorStatusResponse#4ab6ff6c
2017-05-11 12:31:23,808 [EPS-core-dispatcher-208419] DEBUG o.k.k.s.o.s.a.a.c.OperationsServerActor - Received: org.kaaproject.kaa.server.operations.service.akka.messages.core.stats.TenantActorStatusResponse#2fc38dcf
2017-05-11 12:31:23,813 [pool-5-thread-1] ERROR o.k.k.s.common.zk.ControlNodeTracker - Unknown Error
org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /operationsServerNodes/operationsServerNodes0000000021
at org.apache.zookeeper.KeeperException.create(KeeperException.java:111) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.zookeeper.ZooKeeper.setData(ZooKeeper.java:1270) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.curator.framework.imps.SetDataBuilderImpl$4.call(SetDataBuilderImpl.java:274) ~[curator-framework-2.9.0.jar:na]
at org.apache.curator.framework.imps.SetDataBuilderImpl$4.call(SetDataBuilderImpl.java:270) ~[curator-framework-2.9.0.jar:na]
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:107) ~[curator-client-2.9.0.jar:na]
at org.apache.curator.framework.imps.SetDataBuilderImpl.pathInForeground(SetDataBuilderImpl.java:267) ~[curator-framework-2.9.0.jar:na]
at org.apache.curator.framework.imps.SetDataBuilderImpl.forPath(SetDataBuilderImpl.java:253) ~[curator-framework-2.9.0.jar:na]
at org.apache.curator.framework.imps.SetDataBuilderImpl.forPath(SetDataBuilderImpl.java:41) ~[curator-framework-2.9.0.jar:na]
at org.kaaproject.kaa.server.common.zk.operations.OperationsNode$1.doWithZkClient(OperationsNode.java:78) ~[zk-0.10.0.jar:na]
at org.kaaproject.kaa.server.common.zk.ControlNodeTracker.doZkClientAction(ControlNodeTracker.java:294) [zk-0.10.0.jar:na]
at org.kaaproject.kaa.server.common.zk.ControlNodeTracker.doZkClientAction(ControlNodeTracker.java:280) [zk-0.10.0.jar:na]
at org.kaaproject.kaa.server.common.zk.operations.OperationsNode.updateNodeData(OperationsNode.java:75) [zk-0.10.0.jar:na]
at org.kaaproject.kaa.server.operations.service.loadbalance.DefaultLoadBalancingService.onStatusUpdate(DefaultLoadBalancingService.java:98) [kaa-node-0.10.0.jar:na]
at org.kaaproject.kaa.server.operations.service.loadbalance.DefaultLoadBalancingService$1$1.run(DefaultLoadBalancingService.java:72) [kaa-node-0.10.0.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_60]
Below is the frequency of this particular error(filename: no of occurrences of error)
kaa-node-2017-05-10.0.log:0
kaa-node-2017-05-10.1.log:0
kaa-node-2017-05-10.2.log:0
kaa-node-2017-05-10.3.log:0
kaa-node-2017-05-10.4.log:0
kaa-node-2017-05-10.5.log:0
kaa-node-2017-05-10.6.log:0
kaa-node-2017-05-10.7.log:0
kaa-node-2017-05-11.0.log:0
kaa-node-2017-05-11.1.log:0
kaa-node-2017-05-11.2.log:0
kaa-node-2017-05-11.3.log:0
kaa-node-2017-05-11.4.log:520
kaa-node-2017-05-11.5.log:0
kaa-node-2017-05-11.6.log:0
kaa-node-2017-05-11.7.log:0
kaa-node-2017-05-11.8.log:0
kaa-node-2017-05-12.0.log:0
kaa-node-2017-05-12.1.log:0
kaa-node-2017-05-12.2.log:0
kaa-node-2017-05-12.3.log:0
kaa-node-2017-05-12.4.log:0
kaa-node-2017-05-12.5.log:0
kaa-node-2017-05-12.6.log:0
kaa-node-2017-05-13.0.log:0
kaa-node-2017-05-13.1.log:0
kaa-node-2017-05-13.2.log:0
kaa-node-2017-05-13.3.log:0
kaa-node-2017-05-13.4.log:0
kaa-node-2017-05-13.5.log:0
kaa-node-2017-05-13.6.log:0
kaa-node-2017-05-13.7.log:0
kaa-node-2017-05-14.0.log:0
kaa-node-2017-05-14.1.log:0
kaa-node-2017-05-14.2.log:0
kaa-node-2017-05-14.3.log:0
kaa-node-2017-05-14.4.log:0
kaa-node-2017-05-14.5.log:0
kaa-node-2017-05-14.6.log:0
kaa-node-2017-05-14.7.log:0
kaa-node-2017-05-14.8.log:0
kaa-node-2017-05-14.9.log:0
kaa-node-2017-05-15.0.log:0
kaa-node-2017-05-15.1.log:0
kaa-node-2017-05-15.2.log:0
kaa-node-2017-05-15.3.log:0
kaa-node-2017-05-15.4.log:0
kaa-node-2017-05-15.5.log:0
kaa-node-2017-05-15.6.log:276
kaa-node-2017-05-15.7.log:875
kaa-node-2017-05-15.8.log:873
kaa-node-2017-05-15.9.log:539
kaa-node-2017-05-16.0.log:879
kaa-node-2017-05-16.1.log:878
kaa-node-2017-05-16.2.log:878
kaa-node-2017-05-16.3.log:878
kaa-node-2017-05-16.4.log:879
kaa-node-2017-05-16.5.log:880
kaa-node-2017-05-16.6.log:877
kaa-node-2017-05-16.7.log:878
kaa-node-2017-05-16.8.log:878
kaa-node-2017-05-16.9.log:735
kaa-node-2017-05-17.0.log:877
kaa-node-2017-05-17.1.log:878
kaa-node-2017-05-17.2.log:878
kaa-node-2017-05-17.3.log:878
kaa-node-2017-05-17.4.log:877
kaa-node-2017-05-17.5.log:876
kaa-node-2017-05-17.6.log:871
kaa-node-2017-05-17.7.log:868
kaa-node-2017-05-17.8.log:877
kaa-node-2017-05-17.9.log:760
kaa-node-2017-05-18.0.log:876
kaa-node-2017-05-18.1.log:876
kaa-node-2017-05-18.2.log:876
kaa-node-2017-05-18.3.log:876
kaa-node-2017-05-18.4.log:877
kaa-node-2017-05-18.5.log:880
kaa-node-2017-05-18.6.log:879
kaa-node-2017-05-18.7.log:878
kaa-node-2017-05-18.8.log:876
kaa-node-2017-05-18.9.log:746
kaa-node-2017-05-19.0.log:876
kaa-node-2017-05-19.1.log:877
kaa-node-2017-05-19.2.log:877
kaa-node-2017-05-19.3.log:879
kaa-node-2017-05-19.4.log:878
kaa-node-2017-05-19.5.log:879
kaa-node-2017-05-19.6.log:1037
kaa-node-2017-05-19.7.log:1285
kaa-node-2017-05-19.8.log:1051
kaa-node-2017-05-20.0.log:1887
kaa-node-2017-05-20.1.log:2400
kaa-node-2017-05-20.2.log:2396
kaa-node-2017-05-20.3.log:1957
kaa-node-2017-05-21.0.log:8640
kaa-node-2017-05-22.0.log:5326
kaa-node-2017-05-22.1.log:0
kaa-node-2017-05-22.2.log:0
kaa-node-2017-05-22.3.log:0
kaa-node-2017-05-22.4.log:0
kaa-node-2017-05-23.0.log:0
kaa-node-2017-05-23.1.log:0

GCM using smack library NoResponseException: No response received within reply timeout

I am new to gcm and I tried to connect to Cloud Connection Server(XMPP) of GCM using Smack API. It was alright at the start,
My code:
uid = "123456789";
apiKey = "A**************B";
XMPPTCPConnectionConfiguration.Builder config;
config.setSocketFactory(SSLSocketFactory.getDefault());
config = XMPPTCPConnectionConfiguration.builder();
config.setUsernameAndPassword(uid,apiKey);
config.setServiceName("gcm.googleapis.com");
config.setHost("gcm.googleapis.com");
config.setPort(5235);
config.setDebuggerEnabled(true);
mConnection = new XMPPTCPConnection(config.build());
mConnection.setPacketReplyTimeout(10000);
try {
mConnection.connect();
mConnection.login();
}
catch (SmackException | IOException | XMPPException e) {
System.out.println("Exception at SmackCcsClient.init()");
e.printStackTrace();
}
But I couldnt get past the initial handshaking process. I used some dummy random GCMIDs to test downstream messaging at first and it was showing up in the smack debug window but later on, the same code shows nothing after the following xml feed as Raw sent packets:
<stream:stream xmlns='jabber:client' to='gcm.googleapis.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
and i tried
mConnection.login(uid+"#gcm.googleapis.com",apiKey);//even though i assume its next step of the handshake.
Console prints the following errors:
org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 10000ms (~10s). Used filter: No filter used or filter was 'null'.
at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:106)
at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:85)
at org.jivesoftware.smack.SynchronizationPoint.checkForResponse(SynchronizationPoint.java:253)
at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWait(SynchronizationPoint.java:146)
at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWaitOrThrow(SynchronizationPoint.java:125)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:837)
at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:360)
at psdc.gcm.SmackCcsClient.init(SmackCcsClient.java:64)
at psdc.gcm.GCMServer.activate(GCMServer.java:44)
at psdc.servlets.Mapper.selectIds(Mapper.java:191)
at psdc.servlets.Mapper.doPost(Mapper.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Jun 25, 2015 5:36:18 PM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener
WARNING: Connection closed with error
java.io.EOFException: input contained no data
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2965)
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3003)
at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1409)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1394)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1092)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1151)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:937)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:952)
at java.lang.Thread.run(Unknown Source)
Please help me to solve this as i am really stuck with this and nowhere to go.Please tell me a way to check if my xml request reaches google or not.
Am using the SMACK library version 4.1.1
Using config.setSecurityMode(ConnectionConfiguration.SecurityMode.ifpossible); solved my problem. It defines the configuration of the connection to be used.It Turns on TLS if the server supports the same.
refer : http://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smack/ConnectionConfiguration.html
config = XMPPTCPConnectionConfiguration.builder();
config.setSecurityMode(ConnectionConfiguration.SecurityMode.ifpossible);
config.setSocketFactory(SSLSocketFactory.getDefault());
config.setUsernameAndPassword(uid,apiKey);
config.setServiceName("gcm.googleapis.com");
config.setHost("gcm.googleapis.com");
config.setPort(5235);
config.setDebuggerEnabled(true);
mConnection = new XMPPTCPConnection(config.build());
mConnection.setPacketReplyTimeout(10000);
try {
mConnection.connect();
Hope it helps someone.

How to get twitter screenname on mule

I want to send a tweet with mule but I get a NullPointerException on the #[payload.user.screenName], how can I get the screenName??and all the other ways neither worked
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:twitter="http://www.mulesoft.org/schema/mule/twitter" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/twitter http://www.mulesoft.org/schema/mule/twitter/current/mule-twitter.xsd">
<http:request-config name="HTTP_Request_Configuration" host="api.openweathermap.org" port="80" basePath="data/2.5/weather?q=Cadiz,es&APPID=mykey" doc:name="HTTP Request Configuration"/>
<twitter:config name="Twitter" accessKey="${twitter.accessKey}" accessSecret="${twitter.accessSecret}" consumerKey="${twitter.consumerKey}" consumerSecret="${twitter.consumerSecret}" doc:name="Twitter"/>
<flow name="pruebaFlow">
<poll doc:name="Poll">
<fixed-frequency-scheduler frequency="10000"/>
<http:request config-ref="HTTP_Request_Configuration" path="/" method="GET" doc:name="HTTP"/>
</poll>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<echo-component doc:name="Echo"/>
<twitter:show-user config-ref="Twitter" doc:name="Twitter"/>
<twitter:send-direct-message-by-screen-name config-ref="Twitter" message="#[header.INBOUND:message]" screenName="#[payload.user.screenName]" doc:name="Twitter"/>
</flow>
</mule>
And this is the stracktrace
Exception stack is:
1. null (java.lang.NullPointerException)
org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:363 (null)
2. [Error: null pointer: payload.user.screenName]
[Near : {... payload.user.screenName ....}]
^
[Line: 1, Column: 1] (org.mule.mvel2.PropertyAccessException)
org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:434 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/mvel2/PropertyAccessException.html)
3. Execution of the expression "payload.user.screenName" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.MVELExpressionLanguage:202 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
4. Failed to invoke sendDirectMessageByScreenName. Message payload is of type: UserJSONImpl (org.mule.api.MessagingException)
org.mule.devkit.processor.DevkitBasedMessageProcessor:128 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.NullPointerException
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:363)
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140)
at org.mule.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
and now I have a new error this
RROR 2015-03-31 22:36:55,067 [[prueba].HTTP_Listener_Configuration.worker.01] org.mule.retry.notifiers.ConnectNotifier: Failed to connect/reconnect: Work Descriptor. Root Exception was: 401 response received, but no WWW-Authenticate header was present. Type: class java.lang.IllegalStateException
ERROR 2015-03-31 22:36:55,075 [[prueba].HTTP_Listener_Configuration.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Error sending HTTP request. Message payload is of type: MuleHttpClient$1
Code : MULE_ERROR-29999
--------------------------------------------------------------------------------
Exception stack is:
1. 401 response received, but no WWW-Authenticate header was present (java.lang.IllegalStateException)
com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider$AsyncHttpClientEventFilter$AuthorizationHandler:1623 (null)
2. java.lang.IllegalStateException: 401 response received, but no WWW-Authenticate header was present (java.util.concurrent.ExecutionException)
org.glassfish.grizzly.impl.SafeFutureImpl$Sync:363 (null)
3. java.util.concurrent.ExecutionException: java.lang.IllegalStateException: 401 response received, but no WWW-Authenticate header was present (java.io.IOException)
org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient:282 (null)
4. Error sending HTTP request. Message payload is of type: MuleHttpClient$1 (org.mule.api.MessagingException)
org.mule.module.http.internal.request.DefaultHttpRequester:190 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.IllegalStateException: 401 response received, but no WWW-Authenticate header was present
at com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider$AsyncHttpClientEventFilter$AuthorizationHandler.handleStatus(GrizzlyAsyncHttpProvider.java:1623)
at com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider$AsyncHttpClientEventFilter.onHttpHeadersParsed(GrizzlyAsyncHttpProvider.java:1422)
at org.glassfish.grizzly.http.HttpCodecFilter.decodeHttpPacketFromBytes(HttpCodecFilter.java:664)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

Resources