Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bug retrofit.RetrofitError: java.io.EOFException for Android

I search a lot, I found some solutions like this:

System.setProperty("http.keepAlive", "false");
arg0.addHeader("Connection", "close");
arg0.addHeader("Accept-Language", "en-US,en;q=0.8");

I try them but didn't work for me. How can I correct this bug? Here is my log:

D/Retrofit(28969): ---> 
    HTTP POST http://release.api.jeunesse.build.indus.ftven.net/app.php/api/users
D/Retrofit(28969): Connection: close
D/Retrofit(28969): Content-Type: application/json
D/Retrofit(28969): Content-Length: 169
D/Retrofit(28969): {"birthday":"2010-06-05T12:16:42+0200", \
  "devices":[{"device":"ae045e7bead6f933487a237f8b5f298d","primary":true}],\
  "email":"[email protected]","login":"test9","password":"9876"}
D/Retrofit(28969): ---> END HTTP (169-byte body)
D/Retrofit(28969): ---- 
    ERROR http://release.api.jeunesse.build.indus.ftven.net/app.php/api/users
D/Retrofit(28969): java.io.EOFException
D/Retrofit(28969):     at libcore.io.Streams.readAsciiLine(Streams.java:203)
D/Retrofit(28969):     at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579)
D/Retrofit(28969):     at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827)
D/Retrofit(28969):     at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
D/Retrofit(28969):     at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497)
D/Retrofit(28969):     at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
D/Retrofit(28969):     at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
D/Retrofit(28969):     at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
D/Retrofit(28969):     at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
D/Retrofit(28969):     at $Proxy3.createUser(Native Method)
D/Retrofit(28969):     at fr.francetv.ludo.backend.services.businessdelegate
    .RetrieveFluxDonneesBDL.postInscription(RetrieveFluxDonneesBDL.java:323)
D/Retrofit(28969):     at fr.francetv.ludo.backend.services.metier.user
    .AdministrerUser.inscriptionUser(AdministrerUser.java:202)
D/Retrofit(28969):     at fr.francetv.ludo.backend.services.metier
    .AdministrerHelper.inscriptionUser(AdministrerHelper.java:158)
D/Retrofit(28969):     at fr.francetv.ludo.ui.inscription
    .InscriptionLoginFragment$3.background(InscriptionLoginFragment.java:136)
D/Retrofit(28969):     at fr.francetv.ludo.ui.inscription
    .InscriptionLoginFragment$3.background(InscriptionLoginFragment.java:1)
D/Retrofit(28969):     at fr.francetv.ludo.backend.services.AsyncHelper.doInBackground(AsyncHelper.java:28)
D/Retrofit(28969):     at fr.francetv.ludo.backend.services.AsyncHelper.doInBackground(AsyncHelper.java:1)
D/Retrofit(28969):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
D/Retrofit(28969):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
D/Retrofit(28969):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
D/Retrofit(28969):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
D/Retrofit(28969):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
D/Retrofit(28969):     at java.lang.Thread.run(Thread.java:841)
D/Retrofit(28969): ---- END ERROR

Thanks for your responses

like image 916
tamtoum1987 Avatar asked Jul 17 '14 14:07

tamtoum1987


1 Answers

This is a known issue:

https://github.com/square/retrofit/issues/397

Did you try using OkHttp?

like image 59
mromer Avatar answered Sep 21 '22 05:09

mromer