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

App Crash when upload/write file to shared folder through iOS. #85

Open
narendra-ct opened this issue Jun 9, 2016 · 14 comments
Open

App Crash when upload/write file to shared folder through iOS. #85

narendra-ct opened this issue Jun 9, 2016 · 14 comments

Comments

@narendra-ct
Copy link

narendra-ct commented Jun 9, 2016

Hi,

Thanks for the great lib, I'm trying to upload files with my iOS application and i have done some research on how to use smb_fwrite and finally I'm able to use it. But most of the times its crashing at

                        **__length = smb_fwrite(_uploadSession, _fileID, _buffer, _read_length);_**

and the buffer size I'm giving as 65535
please help me on this, how can i handle this?

Thanks in advance .

Narendra.

@sylverb
Copy link
Contributor

sylverb commented Jun 9, 2016

Hi Narendra,
the maximum block size you can write in a SMB write command is 65535-64 (64 is the size of headers for this message).
Could you give crash logs ?

@narendra-ct
Copy link
Author

thanks for the response and error i got is ;

**(220,0x16e0a3000) malloc: * error for object 0x15711d600: incorrect checksum for freed object - object was probably modified after being freed.

Maximum times its giving this error and in some times at the initialstage itself crashing.

@narendra-ct
Copy link
Author

narendra-ct commented Jun 12, 2016

hello,
Just to confirm not only on above comment, its crashing on

netbios_session_packet_recv: : Connection reset by peer
netbios connection not reachable

netbios_session_packet_send: Unable to send (full?) packet: Broken pipe
netbios_session_packet_recv: : Broken pipe

while uploading file to shared folder giving these types of messages and app crashing .

Please have a look on it and plz help me on this how to handle.

Thanks,
Narendra V.

@sylverb
Copy link
Contributor

sylverb commented Jun 12, 2016

Hello,
please provide sample app/code to reproduce the issue

@narendra-ct
Copy link
Author

TOSMBClient-master 2.zip

Hello,
i have attached sample project and please check

// code to upload file/write file
[self.rootController uploadFileTosession:self.session atFilePath:_selectedPath withDestinationPath:nil];

please find this line to check the upload/write to file code.
Add any large file to resources and fetch path from resources (code already available in SMBSessionUpload.m)

Thanks,
Narendra.

@sylverb
Copy link
Contributor

sylverb commented Jun 15, 2016

Ok I've made some tests with your sample app and I managed to upload files (tried a 3.5MB file and a 1.07GB file) on my servers with no issue/crash !
I guess that the problem is a compatibility problem with the SMB server you are using then ! Could you tell which server you are connecting to ?
BTW, there are some personal login/passwords in your archive, I hope for you that this is not a password you are using online, else way change it ASAP where is it used ...

@narendra-ct
Copy link
Author

Im using my mac shared folder instead of server and i will try with NAS server and Im also able to upload 1.3 GB of data and if i try 2 GB or More than 2 GB app crashes.Cold you please try with 2GB file .
~ please let me know that the code is proper to upload file .
Thanks,

@narendra-ct
Copy link
Author

narendra-ct commented Jun 17, 2016

hello i observed one more thing here ..

Im able to upload the zip file from my shared folder and if try to unzip manually (in MAC) it works fine, if try to unzip the file using iOS Library (SSZipArchive or ZipArchive) it throws an error as BADZIP file.
The problem with only uploaded files and normal files (manually zipped from mac files) i can able to unzip through SSZipArchive.
While Upload its creating more file size than actual file size.
Please help on this what i can do.

Thanks,
Narendra V.

@sylverb
Copy link
Contributor

sylverb commented Jun 17, 2016

I've just tested uploading a 3.2GB file with no issue :-/

@natalia-osa
Copy link

natalia-osa commented Jul 25, 2016

I'd just like to note it's happening to me as well. I've opened similar issue here: TimOliver/TOSMBClient#26, but it seems to be a problem of libdsm, used inside TOSMBClient project.
As for me it happens during smb_fread. You can peek into the TOSMBSessionDownloadTask for more details about the implementation.

The crash happens when I disconnect from Samba device I'm downloading from.

My logs:

netbios_session_packet_recv: : Invalid argument
netbios_session_packet_recv: : Invalid argument
netbios_session_packet_send: Unable to send (full?) packet: Broken pipe
netbios_session_packet_send: Unable to send (full?) packet: Broken pipe
netbios_session_packet_send: Unable to send (full?) packet: Broken pipe
[etc ...]

We're using such device as SMB server: http://www.ravpower.com/rp-wd03-filehub-6000mah-power-bank-portable-wireless-router.html.

@jbkempf
Copy link
Contributor

jbkempf commented Jul 27, 2016

Any backtrace?

@natalia-osa
Copy link

@jbkempf I just found a bug in TOSMBClient, so sorry for the false alarm, the bug was not from here. In case you'd like to see what happened: TimOliver/TOSMBClient#27.

@bernayu
Copy link

bernayu commented Nov 4, 2016

Hi All,
any updates about malloc issue? I experienced the same error when using smb_fwrite.
Any help is appreciated thanks.

@DemianSteelstone
Copy link

Hi,
Try to reduce buffer size to 64000

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

6 participants