Crashed: com.apple.root.default-qos EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000007

I am facing this error on my SDK project. Could not identify what's the actual issue. I've added the Firebase crash logs below.

Crashed: com.apple.root.default-qos 0 libdispatch.dylib 0x1a778 dispatch_channel_cancel + 12 1 libdispatch.dylib 0x1a778 dispatch_source_cancel + 12 2 libsystem_dnssd.dylib 0x2084 DNSServiceProcessResult + 860 3 Common 0x2df04 __swift_memcpy5_4 + 25916 4 Common 0x10b00 block_destroy_helper.10 + 188 5 libdispatch.dylib 0x26a8 _dispatch_call_block_and_release + 32 6 libdispatch.dylib 0x4300 _dispatch_client_callout + 20 7 libdispatch.dylib 0x744c _dispatch_queue_override_invoke + 928 8 libdispatch.dylib 0x15be4 _dispatch_root_queue_drain + 392 9 libdispatch.dylib 0x163ec _dispatch_worker_thread2 + 156 10 libsystem_pthread.dylib 0x1928 _pthread_wqthread + 228 11 libsystem_pthread.dylib 0x1a04 start_wqthread + 8

Replies

It’s hard to offer advice without seeing a full Apple crash report. If you have one of those, please post it here, using the steps from Posting a Crash Report.

ps If you don’t have an Apple crash report, it’s OK to post one from a third-party crash reporter. However, there are limits to what I can do with those. Third-party crash reporters have fundamental limits. See Implementing Your Own Crash Reporter for more on that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi @eskimo, I have attached the Log file here.

Also, this is the code that potentially causes the crash.

 func resolve(query: String, then resultHandler: @escaping ResultHandler<URL>) -> Request {
        let request = DNSRequest()
        var context = Context(query: query, request: request, resultHandler: resultHandler)

        let semaphore = DispatchSemaphore(value: 0)
        DispatchQueue.global().async {
            var sdRef: DNSServiceRef?
            let contextRef = withUnsafePointer(to: &context) {
                UnsafeMutableRawPointer(mutating: $0)
            }
            DNSServiceQueryRecord(&sdRef, 0, 0, query, UInt16(kDNSServiceType_SRV), UInt16(kDNSServiceClass_IN), DNSServiceSRVLookup.dnsServiceQueryRecordReply, contextRef)

            let timeout = DispatchWorkItem { [weak request] in
                if let request = request, let timeout = request.timeoutWorkItem, !timeout.isCancelled {
                    request.timedOut(.failure(EndpointResolverError.timedOut))
                }
            }
            request.sdRef = sdRef
            request.resultHandler = resultHandler
            request.timeoutWorkItem = timeout
            DispatchQueue.main.asyncAfter(deadline: .now() + DNSServiceSRVLookup.timeout, execute: timeout)
            semaphore.signal()
            DNSServiceProcessResult(sdRef)
        }
        semaphore.wait()

        return request
    }