question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Kotlin/Native iOS test freezes on get request with error: NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9807)

See original GitHub issue

Hey!

I’m using ktor in my multiplatform application. I have problem with testing ktor client get request to any page. It totally freezes. Other tests work. (Same test on Android works well)

My test looks like this:

@Test
fun downloadPageContent() {
    runBlocking(Dispatchers.Unconfined) {
        HttpClient().use {
            it.get<String>("https://stackowerflow.com")
        }
    }
}

My run ios test gradle script:

task iosTest {
    description = "Runs tests for target 'ios' on an iOS simulator"

    def device = project.findProperty("iosDevice")?.toString() ?: "iPhone 8"
    dependsOn 'linkTestDebugExecutableIos'
    group = JavaBasePlugin.VERIFICATION_GROUP

    doLast {
        def binary = kotlin.targets.ios.compilations.test.getBinary('EXECUTABLE', 'DEBUG')
        exec {
            commandLine 'xcrun', 'simctl', 'spawn', device, binary.absolutePath
        }
    }
}

Versions:

ktor_version = '1.1.1'
coroutines_version = '1.1.0'
kotlin_version = '1.3.11'

PS: If i change url to random characters error no longer prints, but it still freezes.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
icarumbascommented, Jan 25, 2019

@e5l I can’t just use launch in tests. They will just pass then.

I’ve also got that:

  1. this error also appears in simple runBlocking without passing any Dispatcher.
  2. it works the same from iosMain module, so there is nothing to do with iosTest.
  3. in iosMain module it works via calling GlobalScope.launch(MainDispatcher) { client.get(..) } I will try do the same with runBlocking when figure out this: https://github.com/Kotlin/kotlinx.coroutines/issues/952
0reactions
Stexxecommented, Jul 29, 2021

Fixed by KTOR-2683.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kotlin/Native iOS test freezes on get request with error
Kotlin/Native iOS test freezes on get request with error: NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9807).
Read more >
Kotlin/Native iOS test freezes on get request with error
Kotlin/Native iOS test freezes on get request with error: NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9807)
Read more >
Native: Empty runBlocking(MainDispatcher) {} freezes main ...
Kotlin/Native iOS test freezes on get request with error: NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9807) ...
Read more >
NSURLSession HTTP load failed (kCFStreamErrorDomainSSL
On this thread: NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813) iOS I have found out I should add this code in ...
Read more >
kCFStreamErrorDomainSSL Error -9802 - Apple Developer
I can't seem to find what this error means. ... NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found