Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

Just.get() crash when makeTask #124

@j-elmer123

Description

@j-elmer123

syncBookingCrash

just_get_crash

make_task_crash

Crashed: com.apple.main-thread
0  libswiftCore.dylib             0x1977b1138 swift_isUniquelyReferenced_nonNull_native + 28
1  Just                           0x105372530 specialized Dictionary._Variant.setValue(_:forKey:) + 44 (<compiler-generated>:44)
2  Just                           0x10536d83c HTTP.makeTask(_:configuration:) + 420 (<compiler-generated>:420)
3  Just                           0x105370c9c HTTP.request(_:url:params:data:json:headers:files:auth:cookies:redirects:timeout:urlQuery:requestBody:asyncProgressHandler:asyncCompletionHandler:) + 1009 (Just.swift:1009)
4  Just                           0x1053715d0 protocol witness for JustAdaptor.request(_:url:params:data:json:headers:files:auth:cookies:redirects:timeout:urlQuery:requestBody:asyncProgressHandler:asyncCompletionHandler:) in conformance HTTP + 96 (<compiler-generated>:96)
5  Just                           0x10536c71c JustOf.delete(_:params:data:json:headers:files:auth:cookies:allowRedirects:timeout:urlQuery:requestBody:asyncProgressHandler:asyncCompletionHandler:) + 364
6  Just                           0x10536c39c JustOf.get(_:params:data:json:headers:files:auth:cookies:allowRedirects:timeout:urlQuery:requestBody:asyncProgressHandler:asyncCompletionHandler:) + 92
7  Houzcall                       0x104490fc4 showRateBookingControllerIfNeeded(_:) + 387 (Utils.swift:387)
8  Houzcall                       0x1044c0134 partial apply for closure #1 in closure #1 in closure #1 in BookingDetailsViewController.syncBookings(_:) + 130 (BookingDetailsViewController.swift:130)
9  Houzcall                       0x1045289c4 thunk for @escaping @callee_guaranteed () -> () + 4376988100 (<compiler-generated>:4376988100)
10 libdispatch.dylib              0x18a075610 _dispatch_call_block_and_release + 24
11 libdispatch.dylib              0x18a076184 _dispatch_client_callout + 16
12 libdispatch.dylib              0x18a05935c _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 996
13 CoreFoundation                 0x18a3263c4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
14 CoreFoundation                 0x18a3213b8 __CFRunLoopRun + 2004
15 CoreFoundation                 0x18a3208bc CFRunLoopRunSpecific + 464
16 GraphicsServices               0x19418c328 GSEventRunModal + 104
17 UIKitCore                      0x18e3b66d4 UIApplicationMain + 1936
18 Houzcall                       0x104424764 main + 21 (AppDelegate.swift:21)
19 libdyld.dylib                  0x18a1ab460 start + 4

Hi @dduan currently I found a problem when trying to do Just.get().
from what I see, there is a possibility when doing Just.get() the request is nil when trying to makeTask

// Just.swift
...
public func synthesizeRequest(...) -> URLRequest?
...
func makeTask(_ request: URLRequest, configuration: TaskConfiguration)
    -> URLSessionDataTask?
...
guard let request = synthesizeRequest()
...
// variabel `request` below can be `nil`
if let task = makeTask(request, configuration: config) {
    task.resume()
}

isn't synthesizeRequest() supposed return URLRequest without nil?

This only happens in production build and I can't reproduce the crash.
Xcode 11.1
Swift 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions