microsoftgraph / msgraph-sdk-objc

Microsoft Graph SDK for Objective-C
MIT License
37 stars 21 forks source link

MSLargeFileUploadTask crashes when uploading a large file and the Internet connection disappears #46

Open anton-simakov opened 3 years ago

anton-simakov commented 3 years ago

MSLargeFileUploadTask crashes when uploading a large file and the Internet connection disappears.

Steps to reproduce:

  1. Start an upload of a large file using MSLargeFileUploadTask
  2. Disconnect from the internet

    Result

    The library crashes in

    - (void)uploadNextSegmentWithCompletion:(HTTPRequestCompletionHandler)completionHandler
    {
    [...]
    NSDictionary *dataDict = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; // (line 76)
    [...]
    }

    Reason

    data is nil.

ACFancy commented 2 years ago

@darrelmiller @andrueastman Could you solve this bug?

Vidtion commented 2 years ago

same here, data parameter is nil

strongbox-mark commented 2 years ago

+1 - Seeing the same issue in production, though I wasn't sure if it was a server error or an actual disconnection, either way data is nill as mention above at:

https://github.com/microsoftgraph/msgraph-sdk-objc/blob/ba5dbaa862bd8e69dde80c19b99ffaf2dec2b73d/MSGraphClientSDK/MSGraphClientSDK/GraphTasks/MSLargeFileUploadTask.m#L76

Stack trace looks like so:

"0 CoreFoundation 0x000000018050e29c DA3C2E10-0C3D-3FBC-9C3E-E950EBA7020F + 627356",
"1 libobjc.A.dylib 0x0000000199242744 objc_exception_throw + 60",
"2 Foundation 0x0000000181cc1674 5292A0BD-260C-3983-A5BE-838997D362F7 + 345716",
"3 MSGraphClientSDK 0x0000000105a671dc __57-[MSLargeFileUploadTask uploadNextSegmentWithCompletion:]_block_invoke + 128",
"4 MSGraphClientSDK 0x0000000105a67ea0 __70-[MSRedirectHandler execute:redirectsAttempted:withCompletionHandler:]_block_invoke + 480",
"5 MSGraphClientSDK 0x0000000105a68d64 __65-[MSRetryHandler execute:retriesAttempted:withCompletionHandler:]_block_invoke + 1052",
"6 MSGraphClientSDK 0x0000000105a6ac38 -[MSURLSessionTaskDelegate task:didCompleteWithError:] + 264",
"7 MSGraphClientSDK 0x0000000105a69dcc -[MSURLSessionManager URLSession:task:didCompleteWithError:] + 92",
"8 CFNetwork 0x0000000180cb4530 CFURLRequestCopyHTTPRequestMethod + 2400",
"9 libdispatch.dylib 0x0000000180173e6c 2D55AD2F-6AFF-303D-8E82-088ADA4695B2 + 7788",
"10 libdispatch.dylib 0x0000000180175a30 2D55AD2F-6AFF-303D-8E82-088ADA4695B2 + 14896",
"11 libdispatch.dylib 0x000000018017d124 2D55AD2F-6AFF-303D-8E82-088ADA4695B2 + 45348",
"12 libdispatch.dylib 0x000000018017dcb4 2D55AD2F-6AFF-303D-8E82-088ADA4695B2 + 48308",
"13 libdispatch.dylib 0x0000000180188500 2D55AD2F-6AFF-303D-8E82-088ADA4695B2 + 91392",
"14 libsystem_pthread.dylib 0x00000001f0c390bc _pthread_wqthread + 288",
"15 libsystem_pthread.dylib 0x00000001f0c38e5c start_wqthread + 8"
],
"reason" : "data parameter is nil",
"name" : "NSInvalidArgumentException"
}