Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io.ktor.client.call.ReceivePipelineException: Fail to run receive pipeline in iOS #866

Closed
ImanX opened this issue Jan 13, 2019 · 13 comments
Closed
Assignees
Labels
ux User Experience issue
Milestone

Comments

@ImanX
Copy link

ImanX commented Jan 13, 2019

Ktor Version

1.1.1

cio

iOS, Multiplatform

Feedback

I have many issue with ktor, I changed behavior my code but I still don't result and response in iOS

my code on common:


    private val client = HttpClient()
    fun about(callback: (String) -> Unit) {
        GlobalScope.apply {
            launch(ApplicationDispatcher) {
                val result: String = client.get {
                    url("https://google.com")
                }

                callback(result)
            }
        }

    }

and my code on Android that It's work:


        APIPresentation().about {
            try {

                print(it)
            } catch (e: Exception) {
                e.printStackTrace();
            }

        }

and my Code on iOS that not response and print exception:

io.ktor.client.call.ReceivePipelineException: Fail to run receive pipeline

 let presenetation = APIPresentation();
        presenetation.about { (s) -> KotlinUnit in
            print(s);
            
            return KotlinUnit();
        }
       

Where is problem?

@e5l
Copy link
Member

e5l commented Jan 13, 2019

Hi @ImanX, thanks for the report. Could you provide the stacktrace and cause?

@ImanX
Copy link
Author

ImanX commented Jan 13, 2019

Hi @e5l , No because xcode only print log that.

@icarumbas
Copy link

icarumbas commented Jan 14, 2019

Hey @ImanX and what does it print?

@e5l e5l added the ux User Experience issue label Jan 15, 2019
@ImanX
Copy link
Author

ImanX commented Jan 16, 2019

@icarumbas in xcode log just print io.ktor.client.call.ReceivePipelineException: Fail to run receive pipeline

@icarumbas
Copy link

icarumbas commented Jan 23, 2019

I've got the same error with alike code, and i've noticed that it works with some other sites, for example
"https://stackoverflow.com". I'm not web developer, and i don't know what is difference between google and other sites, but this may help, i think.

@talon
Copy link

talon commented Jan 25, 2019

io.ktor.client.call.ReceivePipelineException: Fail to run receive pipeline
        at io.ktor.client.call.HttpClientCall.receive(HttpClientCall.kt:61)
        at io.ktor.client.call.HttpClientCall$receive$1.invokeSuspend(HttpClientCall.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
        at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(PipelineContext.kt:211)
        at io.ktor.util.pipeline.SuspendFunctionGun.access$resumeRootWith(PipelineContext.kt:63)
        at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(PipelineContext.kt:114)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:45)
        at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:285)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        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)
Caused by: kotlinx.coroutines.JobCancellationException: Job was cancelled

I get this after packaging a Ktor API with distZip, running the binary on a raspberry pi, and trying to fetch an endpoint that makes an http client request. Running locally works. Thought maybe the stack trace would help

(UPDATE: my issue was a timeout error cause it was so slowwww on the Pi)

@e5l
Copy link
Member

e5l commented Jan 25, 2019

For the url("https://google.com") I've got:
Cause: kotlin.IllegalArgumentException: Charset ISO-8859-1 is not supported

It looks like we should find the way to decode ISO-8859-1 in kx.io.

@e5l e5l added this to the 1.2.0 milestone Jan 25, 2019
@GiuseppeGiacoppo
Copy link

This problem is very similar to #787

@AbdulMueed143
Copy link

Hi, I was trying to follow this below give Kotlin example for Multiplatform:
https://medium.com/@aldychris/kotlin-multiplatform-for-ios-and-android-mobile-application-96a753e175f7

I have successfully run it but now I am getting error. Fail to run receive pipeline, after searching a lot and trying to find original exception it seems like it is illegalStateException:

@molikuner
Copy link

molikuner commented Feb 19, 2019

Hey, I got this problem at the JVM.

I use CIO as my engine on version 1.1.2 and my simple program is JVM based.
Essentially, my code looks like this:

fun main() {
    runBlocking {
        val client = HttpClient(CIO)
        val response = CommonAPI.client.get<String> {
            url {
                protocol = URLProtocol.HTTPS
                host = "playlisten.rbb-online.de"
                encodedPath = "/radioberlin/main/index.php"
            }
        }
        println("'$response'")
        client.close()
    }
}

I get the stack:

Exception in thread "main" io.ktor.client.call.ReceivePipelineException: Fail to run receive pipeline
	at io.ktor.client.call.HttpClientCall.receive(HttpClientCall.kt:61)
	at io.ktor.client.call.HttpClientCall$receive$1.invokeSuspend(HttpClientCall.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(PipelineContext.kt:211)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:186)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:63)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:137)
	at io.ktor.util.pipeline.SuspendFunctionGun.execute(PipelineContext.kt:157)
	at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:23)
	at io.ktor.client.call.HttpClientCall.receive(HttpClientCall.kt:55)
	at com.molikuner.spotify.MainKt$main$1.invokeSuspend(Main.kt:115)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(PipelineContext.kt:211)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:168)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:63)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(PipelineContext.kt:118)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:45)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(PipelineContext.kt:211)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:168)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:63)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(PipelineContext.kt:118)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:45)
	at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233)
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.kt:116)
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:76)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:53)
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:35)
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
	at com.molikuner.spotify.MainKt.main(Main.kt:21)
Caused by: kotlinx.io.charsets.MalformedInputException: Input length = 1
	at kotlinx.io.charsets.CharsetJVMKt.throwExceptionWrapped(CharsetJVM.kt:287)
	at kotlinx.io.charsets.CharsetJVMKt.decode(CharsetJVM.kt:166)
	at kotlinx.io.charsets.EncodingKt.decode(Encoding.kt:104)
	at kotlinx.io.core.StringsKt.readText(Strings.kt:339)
	at kotlinx.io.core.StringsKt.readText$default(Strings.kt:338)
	at io.ktor.client.response.HttpResponseKt.readText(HttpResponse.kt:77)
	at io.ktor.client.features.HttpPlainText.read$ktor_client_core(HttpPlainText.kt:23)
	at io.ktor.client.features.HttpPlainText$Feature$install$2.invokeSuspend(HttpPlainText.kt:48)
	at io.ktor.client.features.HttpPlainText$Feature$install$2.invoke(HttpPlainText.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:278)
	... 25 more

I know that the title indicates iOS, but it's pretty similar and the same code works for different websites as described above.

EDIT: changed version

@e5l
Copy link
Member

e5l commented Feb 20, 2019

Hi @molikuner, thanks for the report.
Could you file the separate issue for that case?

@cy6erGn0m cy6erGn0m modified the milestones: 1.2.0, 1.1.3 Feb 20, 2019
@cy6erGn0m
Copy link
Contributor

Fixed in 1.1.3.

@ashokkateshiya
Copy link

Hi, I was trying to follow this below give Kotlin example for Multiplatform:
https://medium.com/@aldychris/kotlin-multiplatform-for-ios-and-android-mobile-application-96a753e175f7

I have successfully run it but now I am getting error. Fail to run receive pipeline, after searching a lot and trying to find original exception it seems like it is illegalStateException:

Hi Are you able to receive response?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ux User Experience issue
Projects
None yet
Development

No branches or pull requests

9 participants