B4J Question my nonuiserver got a deadlock situation

PassionDEV

Active Member
Licensed User
in my nonui app i use httpjob sub and call it multilabel Times

i got this exeption after a long Run

B4X:
java.net.SocketTimeoutException: timeout
    at okio.Okio$4.newTimeoutException(Okio.java:227)
    at okio.AsyncTimeout.exit(AsyncTimeout.java:284)
    at okio.AsyncTimeout$2.read(AsyncTimeout.java:240)
    at okio.RealBufferedSource.indexOf(RealBufferedSource.java:325)
    at okio.RealBufferedSource.indexOf(RealBufferedSource.java:314)
    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210)
    at okhttp3.internal.http1.Http1Codec.readResponse(Http1Codec.java:191)
    at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:132)
    at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:54)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
    at okhttp3.RealCall.execute(RealCall.java:63)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(OkHttpClientWrapper.java:156)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.access$0(OkHttpClientWrapper.java:153)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$ExecuteHelper.run(OkHttpClientWrapper.java:201)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.SocketException: Socket closed
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:183)
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
    at okio.Okio$2.read(Okio.java:138)
    at okio.AsyncTimeout$2.read(AsyncTimeout.java:236)
    ... 28 more
ResponseError. Reason: java.net.SocketTimeoutException: timeout, Response:
main._appstart (java line: 57)
java.lang.RuntimeException: java.io.FileNotFoundException: /tmp/95 (No such file or directory)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:496)
    at anywheresoftware.b4a.keywords.Common.access$0(Common.java:467)
    at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:541)
    at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30)
    at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
    at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:153)
    at Tcp.Server.main._appstart(main.java:57)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at Tcp.Server.main.main(main.java:28)
Caused by: java.io.FileNotFoundException: /tmp/95 (No such file or directory)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:218)
    at Tcp.Server.httpjob._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv0(httpjob.java:197)
    at Tcp.Server.tcclient._jobdone(tcclient.java:1625)
    at Tcp.Server.tcclient.callSub(tcclient.java:2483)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:471)
    ... 13 more

Thats how my jobdone sub looks a like

B4X:
Sub JobDone(Job As HttpJob)


       

   
Dim tskname As String
Dim Reginfo As String

tskname = Job.JobName
   
If tskname = "GetRedata" Then

Reginfo = Job.GetString2("UTF8")

If Reginfo <> "ERR" Then
   
sendregdataToclient(Reginfo)  

   
Else
   
SendData("ERR")
Return

End If


Else If tskname = "CheckregUSER" Then
   
   
Reginfo = Job.GetString2("UTF8")

If Reginfo <> "ERR" Then
   
SendData("ERR")  
Else
   
LoadAccessAndLogin

End If
   
   


Else If tskname = "CheckregGu" Then
   
Reginfo = Job.GetString2("UTF8")

If Reginfo <> "ERR" Then
   
SendData("ERR")
   
End If



End If
   
Job.Release


   
End Sub
and thats how i call the query

B4X:
public Sub dohttquery(aqueryname As String , aurl As String)
    
    
Dim j As HttpJob
Dim urlok As String


urlok = aurl
j.Initialize(aqueryname, Me)
j.Download(urlok)
j.GetRequest.SetHeader("User-Agent", auseragent)

    
End Sub
 

Erel

Administrator
Staff member
Licensed User
Of course not.

The question itself is wrong. A network request can take several seconds. The non-existent difference between two ways to handle events will be in the scale of milliseconds or nanoseconds (again, there is no difference). Don't waste your time considering such things.

Worth watching the performance video tutorial: https://www.b4x.com/etp.html
 
Top