Lots of WATING tread "OkHttp Connection" created automatically. I do lots of call to getOrderHistory and there is no way to avoid this large number of calls to getOrderHistory method of kiteconnect.
I wonder who creates these threads and why they are in WAIT state. My application runs but it gives outOfMemory error due to excess of WAITING threads. Question: (a)Who creates these many threads? (I am not creating these). I bet it is created by any of the kiteconnect method Is there anyway to kill /avoid creation of these many threads.
ERROR: Exception in thread “Sell” java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:717) at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:957) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1378) at okhttp3.ConnectionPool.put(ConnectionPool.java:153) at okhttp3.OkHttpClient$1.put(OkHttpClient.java:166) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:265) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) at okhttp3.RealCall.execute(RealCall.java:77) at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.getRequest(KiteRequestHandler.java:51) at com.zerodhatech.kiteconnect.KiteConnect.getOrderHistory(KiteConnect.java:386) at BuyStocks.Sell(BuyStocks.java:945) at ThreadController.run(ThreadController.java:151) at java.lang.Thread.run(Thread.java:748)
Hi @jkoracle23, We have made the changes and published a new binary in the dist directory of the javakiteconnect library. You can use the same and let us know if you are still facing the issue.
https://gist.github.com/HubertWo/ad16547fecaca76e14a0016a74f19c33
https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html
Please incorporate the changes in kite api as suggested in the links above.
thanks!
We have made the changes and published a new binary in the dist directory of the javakiteconnect library. You can use the same and let us know if you are still facing the issue.
Which branch we should use in github. master or kite3?
Please close this ticket.