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

Completion Handler #88

Open
Sub-Zero-1 opened this issue Jul 31, 2018 · 3 comments
Open

Completion Handler #88

Sub-Zero-1 opened this issue Jul 31, 2018 · 3 comments

Comments

@Sub-Zero-1
Copy link

Sub-Zero-1 commented Jul 31, 2018

Which version of the SDK/iOS was used?

0.2.6

What problem was encountered?

I am uploading pictures to my Azure Blob Storage. I encounter wrong transfer on slow speed mobile internet connections and corrupted(not present) images on my server. The completion handler of the below function should return a fault on a unsuccessful transfer of my images, but it always gives me the answer that everything was fine!!
I am using this for payment and my customers upload their images. On success I open a payment window and my customers pay for my service. Now, I get payments, but sometimes the images are not on the server, cause of the transfer problems! I had to remove the App from App Store!!!

I can see following on slow speed mobile internet connections (EDGE) only (this never happens with high speed or WiFi connections!):

Upload progress in %: 10
DataUsageInfo(wifiReceived: 11090392, wifiSent: 1459193, wirelessWanDataReceived: 877855, wirelessWanDataSent: 1585215)
Upload progress in %: 10
2018-07-28 12:46:25.021824+0200 xxxxxxx[273:15018] [] tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
2018-07-28 12:46:25.023432+0200 xxxxxxx[273:15018] [] tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
DataUsageInfo(wifiReceived: 11090392, wifiSent: 1459193, wirelessWanDataReceived: 877855, wirelessWanDataSent: 1585215)
Upload progress in %: 10
DataUsageInfo(wifiReceived: 11090392, wifiSent: 1459193, wirelessWanDataReceived: 877855, wirelessWanDataSent: 1585215)
Upload progress in %: 10\

So there is a TCP error, but the transfer of the blob is not stopped nor a fault is catched/shown by the completion handler and that leads to not existing files/images on my cloud Blob Storage account!

The completion handler does not show a error message, when the transfer of image was unsuccessful.

//Upload to Azure Blob Storage with help of SAS
func uploadBlobSAS(container: String, sas: String, blockname: String, fromfile: String ){

// If using a SAS token, fill it in here.  If using Shared Key access, comment out the following line.
let containerURL = "https://xxxxxxx.blob.core.windows.net/\(container)\(sas)"  //here we have to append sas string: + sas
    print("containerURL with SAS: \(containerURL) ")
var container : AZSCloudBlobContainer
var error: NSError?
    
container = AZSCloudBlobContainer(url: NSURL(string: containerURL)! as URL, error: &error)
if ((error) != nil) {
print("Error in creating blob container object.  Error code = %ld, error domain = %@, error userinfo = %@", error!.code, error!.domain, error!.userInfo);
}
else {

    let blob = container.blockBlobReference(fromName: blockname)
    blob.uploadFromFile(withPath: fromfile, completionHandler: {(NSError) -> Void in
        
        if (error != nil){
            //!!!!!!! NEVER GETS HERE EVEN IF THE TRANSACTION WAS UNSUCCESSFULL !!!!!!!!!!!
            
        }
        else {
            NSLog("Ok, uploaded !")
            //3. Leave dispatch group
            self.taskGroup.leave()
        }  
    })
    }

}

Have you found a mitigation/solution?

Not a real solution, but a workaround to this bug. I now check every file if it is present on the server after the completion handler shows me that everything was fine...if the files are not there I show now a error message.

@zezha-msft
Copy link
Contributor

Hi @Sub-Zero-1, thanks for reaching out, and I apologize for the inconvenience.

I've logged this issue for investigation.

@Sub-Zero-1
Copy link
Author

Hi, I now saw that there is a pull request for "managing lost connection error". Maybe this resolvse the issue!? I can't check here now, cause my mobile connection never reaches Edge connection speed anymore, so the error does not occur on my device anymore. Ill search for a way to slow down connection speed manually on my iPhone by App or so.

@baptadn
Copy link

baptadn commented Oct 19, 2020

Hi there!
Any update about this issue?

Thanks :)

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

3 participants