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

Just.get() crash when makeTask #124

Open
j-elmer123 opened this issue Dec 23, 2019 · 2 comments
Open

Just.get() crash when makeTask #124

j-elmer123 opened this issue Dec 23, 2019 · 2 comments

Comments

@j-elmer123
Copy link

j-elmer123 commented Dec 23, 2019

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

@cuongtv51
Copy link

cuongtv51 commented Feb 6, 2020

a) I think in method syncBookingsIfNeed closure onComplete should be @escaping
b) Closure onComplete of method syncBookingsIfNeed just call event no other http request have done, you should consider using DispatchGroup for this

@j-elmer123
Copy link
Author

a) I think in method syncBookingsIfNeed closure onComplete should be @escaping
b) Closure onComplete of method syncBookingsIfNeed just call event no other http request have done, you should consider using DispatchGroup for this

Hi @cuongtv51 sorry for the late reply, thank you for responding, I'll try to do as you say first, and I'll report if it is resolved or not. thank you.

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

No branches or pull requests

2 participants