Giter VIP home page Giter VIP logo

Comments (11)

jessicakfl avatar jessicakfl commented on June 13, 2024 1

I am looking at the problem right now, definitely reproducible, will create GitHub separate repo to show the call, my postman call to the same server do not have the error

from okhttp.

yschimke avatar yschimke commented on June 13, 2024

Also posted in #7794 (comment)

from okhttp.

yschimke avatar yschimke commented on June 13, 2024

If you can reproduce it against a private server, then you could post code for a repro, and privately message the actual host so we can investigate. Without that, this isn't actionable, and not clear it's not a problem with your client or server.

from okhttp.

jessicakfl avatar jessicakfl commented on June 13, 2024

have created a github repo and reproduced the error, https://github.com/jessicakfl/purplerain
stack trace here,

Installing profile for com.idigue.purplerain
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I request failed -> java.net.SocketTimeoutException: timeout
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okio.SocketAsyncTimeout.newTimeoutException(JvmOkio.kt:147)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okio.AsyncTimeout.access$newTimeoutException(AsyncTimeout.kt:158)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:337)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:427)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:320)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:179)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:111)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:95)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:84)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:65)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:205)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:537)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at java.lang.Thread.run(Thread.java:920)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I Caused by: java.net.SocketException: Socket closed
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at java.net.SocketInputStream.read(SocketInputStream.java:209)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at java.net.SocketInputStream.read(SocketInputStream.java:144)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okio.InputStreamSource.read(JvmOkio.kt:94)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:125)
2024-05-08 16:35:16.114 19514-19541 System.out com.idigue.purplerain I ... 20 more

the error not happen every time, the first time succeeded, log here,

2024-05-08 16:19:25.414 19204-19204 System.out com.idigue.purplerain I kotlin.Unit
2024-05-08 16:19:26.494 19204-19241 ProfileInstaller com.idigue.purplerain D Installing profile for com.idigue.purplerain
2024-05-08 16:19:28.217 19204-19234 System.out com.idigue.purplerain I insert user called ->

seems like a threading issue,

from okhttp.

jessicakfl avatar jessicakfl commented on June 13, 2024

the treading error when write called at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109), other than print out more debug log, please provide apis about the intercepter setup to bypass the error

from okhttp.

jessicakfl avatar jessicakfl commented on June 13, 2024

i'am using implementation("com.squareup.okhttp3:okhttp-android:5.0.0-alpha.11"), okio.RealBufferedSource in the package seems wrong version, at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:427)
2024-05-08 19:08:50.759 19817-21076 System.out com.idigue.seashell I at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:320)

can't find at all

from okhttp.

yschimke avatar yschimke commented on June 13, 2024

Thanks for the repro, I'll dig in on the weekend. I really appreciate the effort to make it

from okhttp.

jessicakfl avatar jessicakfl commented on June 13, 2024

I realized ok is complicated and have extensive test coverage, would help with better documentation, might still not easy to reproduce on your end, will find out..

from okhttp.

jessicakfl avatar jessicakfl commented on June 13, 2024

think I found the problems when looking at ok trace, still have questions though, 1, in implementation("com.squareup.okhttp3:okhttp-android:5.0.0-alpha.11"),okio.RealBufferedSource has wrong version in the package
2, ok throw timeout error and failed the write request when server take the request without response, have changed server side return response 200, then no more errors, not sure why failed the whole request and not consistent result in threadings, wonder if it's intentional for ok

from okhttp.

yschimke avatar yschimke commented on June 13, 2024

That's great.

It sounds like OkHttp is doing the right thing, but sounds like you expect OkHttp to handle servers that don't return a response and just close the socket.

Some feedback on the repro, you might want to consider higher level libraries that build on OkHttp like retrofit or Ktor. they should simplify some of your code compared to the OkHttp callbacks.

from okhttp.

jessicakfl avatar jessicakfl commented on June 13, 2024

That's great.

It sounds like OkHttp is doing the right thing, but sounds like you expect OkHttp to handle servers that don't return a response and just close the socket.

Some feedback on the repro, you might want to consider higher level libraries that build on OkHttp like retrofit or Ktor. they should simplify some of your code compared to the OkHttp callbacks.

it is write request, server throw no error, postman calls success though, watch dog from time to time timeout the same socket call not very stable product, wonder if you had a look at my repo, hope it's correct recommended ok api callbacks

from okhttp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.