dropbox/dropbox-sdk-obj-c

Batch file upload is blocking the main thread for 1 second several times

roostr opened this issue · 30 comments

When calling the batch upload convenience API (DBCustomRoutes.m#L31), the main thread will freeze while it waits for the uploads to finish.

This is happening because of two sleep(1) calls that are enqueued on the main thread:

I have a proposed fix, which creates a new NSOperationQueue that's dedicated to monitoring the completion status: #241

Thanks for the report and the PR! I'll ask the team to review this.

Our QE team just wrote up a couple bugs that were directly tied to those sleep(1)'s. Please bump the priority if possible.

Additionally:

  • (void)queryJobStatus:(DBBatchUploadData *)uploadData asyncJobId:(NSString *)asyncJobId retryCount:(int)retryCount

Seems to be a somewhat confused method in general because of this line:

        if (retryCount <= timeoutInSec) {

Thanks,
Dylan

@dylanashe Thanks for the feedback!

Can you open a separate issue for the queryJobStatus problem you found so we can track them separately? Thanks in advance!

Hi All,

I am experiencing many delays during Dropbox SDK upload functionality, and I just verified using the Xcode debugger that the issue is related to the sleep(1) method appearing twice in DBCustomRoutes.m

My iOS app is using Dropbox SDK to sync user's data, and during the sync process the UI is hanged several times in a row and leaves users frustrated... So resolving this issue is critical on my end.

I can see that this issue is opened since Feb 26, which is almost three months ago... I hope you can boost priority for resolving this issue, and would appreciate your feedback about estimated time for a fix.

Thanks in advance,
Yoash

@yoasha Thanks for the note! I don't have an update on this yet I'm afraid. This is still open with engineering. I'll ask them to raise the priority.

For what it's worth, I've deployed the solution proposed in #241 to production about 3 months ago. It's been running on tens of thousands of devices with no reports of issues from users. @yoasha, you might want to grab that until it's fixed in the official releases.

@yoasha Thanks for the note! I don't have an update on this yet I'm afraid. This is still open with engineering. I'll ask them to raise the priority.

Thank you for the quick response. I really hope you'll manage to raise the priority of this issue, as currently there are thousands of iOS devices running my app which are affected by this issue.

For what it's worth, I've deployed the solution proposed in #241 to production about 3 months ago. It's been running on tens of thousands of devices with no reports of issues from users. @yoasha, you might want to grab that until it's fixed in the official releases.

@roostr Thanks a lot for letting me know about your solution. I will surely take a closer look.

So when do you plan to merge this. This is really annoying and I am also waiting for this fix!

@pascalfribi This is open with the team, but I can't offer a timeline unfortunately.

Hi, just following up... Any news on this topic?

@yoasha No, unfortunately I don't have an update here.

@greg-db Thank you for your quick response. I surely understand that this issue is not in the same severity level of crash-issues and breaking-functionality-issues. It's also an issue that is very difficult to track down, as it took me several months to realize that the delays I constantly encounter in the app that I develop are related to this specific issue... Therefore, I wouldn't be surprised if there are huge number of users experiencing this issue while not being able to map it to the DropboxSDK (they probably blame their app or the iOS for delay and performance issues). My apps have tens of thousands of users (I'm not exaggerating) that are affected by this issue. They still can use my app, DropboxSDK is still uploading the files, but user experience is severely affected. I believe that this issue is affecting countless of other apps and users.
If the sleep(1) was only affecting the background thread then there was no issue. However, the sleep(1) is delaying the main thread. In many use cases, it's called multiple times, thus delaying app's UI for several seconds. This looks as a serious bug.

Would you kindly discuss this issue with the R&D team while clarifying the impact of this issue? Any estimated timeframe for a fix will be highly appreciated.

Agree with yoasha. This is extremely annoying and I only found out about this, with this PR. So please push R&D to get it merged.

Thanks for the feedback all! I'll emphasize this with the team.

Hi, any news on this topic? Any specific reason why the R&D wouldn't merge the PR which is already in place?

Hi folks!

I spoke with engineering and this fix is on the roadmap for the next SDK update (at the latest). Our apologies for the delay, but rest assured this issue (and corresponding PR) are on our radar.

Perfect. Much appreciated!

2 months later and still nothing.....

Thanks for the note! I'll remind the team about this.

another 2 months and counting....

Here's a detailed discussion on this and why I proposed we don't use the MainThread to begin with: #133

Also this: #221. I proposed a simpler fix here.

@guidedways Thanks for the feedback and links!

@guidedways I just started with Dropbox and got assigned this just now. I will look into this today. cc @pascalfribi @yoasha @roostr

@guidedways @pascalfribi @yoasha @roostr Turns out the fix was very simple thanks to @roostr! I just merged his PR and will be issuing a release sometime today after I fix a serialization issue we just found. Will keep y'all updated on this thread

Way to go! Thank you for this update!!

Thank you @hector-dropbox! And congrats on the new position w/ Dropbox!

Thanks for finally fixing this. It was an easy fix that just needed to be done. Glad you are at Dropbox and taking care of this.

No problem, friends. I'm glad to be of assistance! <3