-
Notifications
You must be signed in to change notification settings - Fork 65
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
App crashes when upload a file which size is bigger than 5M #41
Comments
Um. Are there any error messages that appear when it crashes? |
I'm having the same issue. Haven't had the chance to fully figure it out, but it seems that it might be an issue within libdsm. Everything passed into smb_fwrite seems kosher. I confirmed that the buffer is valid and that the buffer size was properly specified. I'm going to try to take a deeper look at it next week, but if anyone else finds anything in the meantime, I'd like to hear about it here :) |
Hmm, if everything on our end seems kosher, it might be a |
Possibly, but I wouldn't assume that just yet. Ultimately, it's libdsm being unable to access the data buffer. Currently, I suspect that it's either being free()'ed/released too early (whether it's in TOSMBClient or libdsm) or it's some kind of access issue (threading?). I'm not too familiar with Objective-C, but I have plenty of experience with C and LLVM, so I'll dig in later this week. In my case, I get that error whenever the data being written out is greater than the write buffer size (64k - header size). It happens way below 5MB for me. I tried playing around with the smb_fopen flags, but to no avail. I also tried reducing the buffer size to see if the header size might have been changed somehow, but that didn't work either. It does create create the file though, it just ends up being 0 bytes. Oh, and also, I found a small bug a week ago, but haven't had the chance to submit a PR yet (don't do this very often, sorry). I can do one later this week, but it's literally a one-liner if you want to make the quick change yourself. It's in TOSMBSessionUploadTask.m @ line 222. Right after the free(buffer) call, I added smb_fclose(self.smbSession, fileID). Otherwise it holds the file lock and the file can't be deleted until libdsm releases the lock. Found it while debugging this issue, ended up with a bunch of 0-byte files that I couldn't delete lol. |
Any news on this issue? I'm having trouble uploading files >150KB. Other people claim that they were able to upload >1GB using libdsm (post from video labs) |
I'm actually investigating it further later today & tomorrow. I'm not yet 100% convinced that it's a libdsm issue. I still suspect that it has to do with the Objective-C malloc'ed memory buffer. Alternatively, it could be a protocol-specific issue as well. I actually spent some time a few days ago reading up on the SMB spec and will now be going through the libdsm code a bit more along with the code in this repo. If I find something, I'll post here in the coming few days. |
Same issue here!!! |
Hey this is very interesting - got the same problem... download is no problem at any size but upload is limited to small files. @xorander00 did you already figured out if the problem is within libdsm? Sadly i`m not experienced enough in C. |
I'm sure that libdsm works fine. I have no problems with it in my fork. |
I tried to upload bigger files with your forked version - no success, same exception thrown. Could you specify what you mean with chunk size? The buffer size? |
Yep, I mean buffer size. |
You are right. I have been using the master branch for a test. In the developer branch the upload is passing without exception. Is it right that all you had to do is writing the file to your device first before uploading to avoid the malloc problem? |
I have changed write with data to stream writing to avoid problems with the lack of memory and reduce buffer size to 64000 bytes. Don't know why, but it crashes with larger size. |
@sweetfish I'm not sure why this happening, i faced same issue while using this lib, for the solution i tried by changing buffer size #define BUFFER_UPLOAD_SIZE 60000 and refer following code you may get some idea.
Thanks, |
@narendra-ct Thanks, |
Oh awesome! Nicely done! Can you please file a PR with those updates? :) |
Ok, let me do more test. |
No description provided.
The text was updated successfully, but these errors were encountered: