Blackberry Local connection timed out after ~ 120000 - blackberry

I have the following code which was working fine:
HttpConnection request =
(HttpConnection) Connector.open("https://www.google.com");
// It locks at the following line until an exception is thrown
int responseCode = request.getResponseCode();
All of the sudden it began to block at the getResponseCode() line until an exception is thrown with the following message:
Local connection timed out after ~ 120000
All is happening in the simulator, and I have MDS enabled.

Related

Websocket network process crashes in mobile Safari (iOS 15.1) due to blob creation, can I do something about it?

I'm using socket.io (version 4.4.0) with mobile Safari (on iOS 15.1) and receive images as ArrayBuffers periodically (~15-30 times per second) via websocket. I want to convert these buffers to something that can be rendered on a Canvas so the first step (I think) is converting to a Blob, like below:
const socket = io(process.env.SERVER ?? "", { transports: ["websocket"] });
socket.on("connect", () => {
socket.emit("subscribe", { topic: "rgb_image" });
});
socket.on("rgb_image", (msg, ack) => {
const blob = new Blob([msg.data], { type: "image/jpeg" });
});
The problem is that after a number of iterations (~20000 but sometimes less and sometimes more) the Safari websocket crashes (I imagine it is due to memory use slowly building up but I'm not sure):
[Error] WebSocket connection to 'ws://10.0.1.2:1234/' failed: WebSocket network error: Network process crashed.
[Error] undefined
(anonymous function) (index.28bba042.js:324) [<-- this is from Parcel's HMR, which uses web-sockets]
[Error] WebSocket connection to 'ws://10.0.1.17/socket.io/?EIO=4&transport=websocket' failed: WebSocket network error: Network process crashed.
[Log] engine error – Error: websocket error (index.28bba042.js, line 15419)
Error: websocket error [<-- I'm logging engine.io "error" event]
[Log] engine close – "transport error" (index.28bba042.js, line 15416) [<-- I'm logging engine.io "close" event]
[Error] Disconnected! – "transport error" [<-- I'm logging socket.io "disconnect" event]
Now, this did not happen on iOS 14 so I'm wondering if there's anything obvious I might use to work around this problem?

spring amqp rabbit max consumer connection retries

I am trying to establish the max number of retries from my app to rabbit broker.
I have the retry interceptor,
#Bean
public RetryOperationsInterceptor retryOperationsInterceptor() {
return RetryInterceptorBuilder.stateless()
.maxAttempts(CommonConstants.MAX_AMQP_RETRIES)
.backOffOptions(500, 2.0, 3000)
.build();
}
and this is used inside listener container,
container.setAdviceChain(new Advice[]{retryOperationsInterceptor()});
However, after a couple of retries, the consumer attempts connection all over again in an endless loop,
2017-02-21 15:03:12.229 WARN 9292 --- [nsumerThread_92] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
2017-02-21 15:03:12.229 INFO 9292 --- [nsumerThread_92] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2017-02-21 15:03:13.245 WARN 9292 --- [nsumerThread_93] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
2017-02-21 15:03:13.245 INFO 9292 --- [nsumerThread_93] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2017-02-21 15:03:13.261 ERROR 9292 --- [nsumerThread_83] o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).
I want the app to fail and error out because of lack of connectivity to the broker after a MAX_RETRY # limit.
thanks for the help
EDIT
As suggested by #artem-bilan, I ended up using a Component
public class BrokerFailureEventListener implements ApplicationListener<ListenerContainerConsumerFailedEvent>
In this class the onApplicationEvent I counted the number of failures and then take appropriate action.
In case of producer-side, it's a little different scenario. As explained by #artem-bilan, the application would need to take care of any issues. I explored using netflix-hystrix and added a fallback method for the production method and will go with that route. thanks much again.
Well, you misunderstood a bit container.setAdviceChain(new Advice[]{retryOperationsInterceptor()});. It is for the business errors during messages processing:
Business exception handling, as opposed to protocol errors and dropped connections, might need more thought and some custom configuration, especially if transactions and/or container acks are in use. Prior to 2.8.x, RabbitMQ had no definition of dead letter behaviour, so by default a message that is rejected or rolled back because of a business exception can be redelivered ad infinitum. To put a limit in the client on the number of re-deliveries, one choice is a StatefulRetryOperationsInterceptor in the advice chain of the listener. The interceptor can have a recovery callback that implements a custom dead letter action: whatever is appropriate for your particular environment.
In contradiction to the:
In fact it loops endlessly trying to restart the consumer, and only if the consumer is very badly behaved indeed will it give up. One side effect is that if the broker is down when the container starts, it will just keep trying until a connection can be established.
What you need is ListenerContainerConsumerFailedEvent, which is emitted as:
private void logConsumerException(Throwable t) {
if (logger.isDebugEnabled()
|| !(t instanceof AmqpConnectException || t instanceof ConsumerCancelledException)) {
logger.warn(
"Consumer raised exception, processing can restart if the connection factory supports it",
t);
}
else {
logger.warn("Consumer raised exception, processing can restart if the connection factory supports it. "
+ "Exception summary: " + t);
}
publishConsumerFailedEvent("Consumer raised exception, attempting restart", false, t);
}
So, you can listen for those events and stop your application when some condition is reached.

Why does my websocket server always report [websocket: control frame length > 125]?

My iOS application uses SocketRocket to establish a connection with my websocket server. But after establishing a connection and sending the first message, the server (using gorilla/websocket) tries to parse the frame, but failed:
message_type, r, err := ws.NextReader()
if err != nil {
goto end
}
An error is reported when calling NextReader():
Websocket Read Failed: [websocket: control frame length > 125]
The strange thing is, I use SocketRocket's send() method to send data, so there should never be any control frames (ping/pong).
Has anyone seen this problem before? Help!

Cowboy websocket termination error

I am implementing cowboy websocket. Everything is working fine except when user closes the browser it fires websocket_termination and at server end it generates following error:-
Error in process <0.298.0> on node 'ews_2#servername.com' with exit value: {function_clause,
[{cowboy_req,ensure_response,[{[]},204],[{file,"src/cowboy_req.erl"},{line,1112}]},
{cowboy_protocol,next_request,3,[{file,"src/cowboy_protocol.erl"},{line,545}]}]}
Code in websocket_termination is :-
websocket_terminate(Reason, Req, State) ->
io:format("~nWebsocket connection termination~n"),
ok.
Resolved: Problem was Req was not getting passed and got manipulated between the callbacks... Cowboy needs a proper Req parameter to be passed at the time of connection termination.

Sending message from Application-Server to target application on Android device

How to know exactly what URL does the 3rd-party application-server try to access while sending message to a client-device via the GCM-server?
In "SendAllMessagesServlet.java"
(which can be found # android-sdks\extras\google\gcm\samples\gcm-demo-server\src\com\google\android\gcm\demo\server\SendAllMessagesServlet.java)
.....
// Error 500 ( Connection timed out) at the following line
Result result = sender.send(message, registrationId, 5);
.....
3rd-party app-server - Tomcat v7.0
The URL is in the Constants.java file as GCM_SEND_ENDPOINT
in the android\gcm\gcm-server libray
public static final String GCM_SEND_ENDPOINT =
"https://android.googleapis.com/gcm/send";
The error 500 is due to proxy settings.
Thank You

Resources