B4J Question Strange Repeating Error

tufanv

Expert
Licensed User
Longtime User
Hello,

I have a non-ui app that use httpjob every second to get some financial data and upload to my own server.
I am always getting the error at the same time when the error happens.. It happens every 3-4 days at 00.11.00 (eleven past zero ) . At very same second everytime.

I enabled logs with nohup this time and this is the error i get:

B4X:
java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:189)
    at java.net.SocketInputStream.read(SocketInputStream.java:121)
    at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
    at sun.security.ssl.InputRecord.read(InputRecord.java:503)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355)
    at com.squareup.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:103)
    at com.squareup.okhttp.Connection.connect(Connection.java:143)
    at com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:185)
    at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128)
    at com.squareup.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:341)
    at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
    at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
    at com.squareup.okhttp.Call.getResponse(Call.java:273)
    at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
    at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
    at com.squareup.okhttp.Call.execute(Call.java:81)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(OkHttpClientWrapper.java:143)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.access$0(OkHttpClientWrapper.java:140)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$ExecuteHelper.run(OkHttpClientWrapper.java:188)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

I need to understand what is the reson for this error. Is it from my side by the non-ui app or my server's problem or the remote server which i get the data so i can find a solution. Also when this error happens my timer does not try the next attempt the app just pauses. It does not crash ..

Also is there a way ,At least to continue with the next try when this happens ?

TY
 

tufanv

Expert
Licensed User
Longtime User
You should expect requests to fail from time to time. Their server is probably offline at that point.


JobDone will be raised with Job.Success = False. You can continue to send requests.

Ok I will send another request in case of job fail and try that way this time. Thanks
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Don't sent it immediately. Use CallSubPlus to send it again after 10 seconds.
you are talking about just in the if job.success=false section right ? to wait 10 second and start updates again ?
because i need to get the data every second for realtime updates.
 
Upvote 0
Top