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

FTPFileProvider file upload crash issue #51

Closed
kanghyonkyong623 opened this Issue Jun 13, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@kanghyonkyong623

kanghyonkyong623 commented Jun 13, 2017

I tried to upload image file that selected by UIImagePickerController using FTPFileProvider.
When I execute copyItem or writeContents function, the app is crashed and following exception has been occurred.

2017-06-13 09:20:44.046157 TestFTP[5437:705407] [Generic] Creating an image format with an unknown type is an error
2017-06-13 09:20:44.821028 TestFTP[5437:706871] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-06-13 09:20:44.864579 TestFTP[5437:706871] [] ____nwlog_simulate_crash_inner_block_invoke dlopen CrashReporterSupport failed
2017-06-13 09:20:44.867695 TestFTP[5437:706871] [] __nwlog_err_simulate_crash simulate crash failed "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
2017-06-13 09:20:44.868964 TestFTP[5437:706871] [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
[x86_64] libnetcore-856.30.16
0 libsystem_network.dylib 0x00000001070b4666 __nw_create_backtrace_string + 123
1 libnetwork.dylib 0x0000000107392006 nw_socket_add_input_handler + 3164
2 libnetwork.dylib 0x000000010736f555 nw_endpoint_flow_attach_protocols + 3768
3 libnetwork.dylib 0x000000010736e572 nw_endpoint_flow_setup_socket + 563
4 libnetwork.dylib 0x000000010736d298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
5 libnetwork.dylib 0x0000000107388ae1 nw_endpoint_handler_path_change + 1261
6 libnetwork.dylib 0x0000000107388510 nw_endpoint_handler_start + 570
7 libnetwork.dylib 0x00000001073a01f9 nw_endpoint_resolver_start_next_child + 2240
8 libdispatch.dylib 0x0000000106e31978 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x0000000106e5b0cd _dispatch_client_callout + 8
10 libdispatch.dylib 0x0000000106e38e17 _dispatch_queue_serial_drain + 236
11 libdispatch.dylib 0x0000000106e39b4b _dispatch_queue_invoke + 1073
12 libdispatch.dylib 0x0000000106e3c385 _dispatch_root_queue_drain + 720
13 libdispatch.dylib 0x0000000106e3c059 _dispatch_worker_thread3 + 123
14 libsystem_pthread.dylib 0x00000001072044de _pthread_wqthread + 1129
15 libsystem_pthread.dylib 0x0000000107202341 start_wqthread + 13
2017-06-13 09:20:46.766882 TestFTP[5437:706871] [] __nwlog_err_simulate_crash simulate crash already simulated "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
2017-06-13 09:20:46.767399 TestFTP[5437:706871] [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
[x86_64] libnetcore-856.30.16
0 libsystem_network.dylib 0x00000001070b4666 __nw_create_backtrace_string + 123
1 libnetwork.dylib 0x0000000107392006 nw_socket_add_input_handler + 3164
2 libnetwork.dylib 0x000000010736f555 nw_endpoint_flow_attach_protocols + 3768
3 libnetwork.dylib 0x000000010736e572 nw_endpoint_flow_setup_socket + 563
4 libnetwork.dylib 0x000000010736d298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
5 libnetwork.dylib 0x0000000107388ae1 nw_endpoint_handler_path_change + 1261
6 libnetwork.dylib 0x0000000107388510 nw_endpoint_handler_start + 570
7 libdispatch.dylib 0x0000000106e31978 _dispatch_call_block_and_release + 12
8 libdispatch.dylib 0x0000000106e5b0cd _dispatch_client_callout + 8
9 libdispatch.dylib 0x0000000106e38e17 _dispatch_queue_serial_drain + 236
10 libdispatch.dylib 0x0000000106e39b4b _dispatch_queue_invoke + 1073
11 libdispatch.dylib 0x0000000106e3c385 dispatch_root_queue_drain + 720
12 libdispatch.dylib 0x0000000106e3c059 dispatch_worker_thread3 + 123
13 libsystem_pthread.dylib 0x00000001072044de pthread_wqthread + 1129
14 libsystem_pthread.dylib 0x0000000107202341 start_wqthread + 13
2017-06-13 09:20:46.782 TestFTP[5437:706899] -[FileProvider.FileProviderStreamTask setTaskDescription:]: unrecognized selector sent to instance 0x60000034fd00
2017-06-13 09:20:46.824 TestFTP[5437:706899] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FileProvider.FileProviderStreamTask setTaskDescription:]: unrecognized selector sent to instance 0x60000034fd00'
*** First throw call stack:
(
0 CoreFoundation 0x0000000102528d4b exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000101f8a21e objc_exception_throw + 48
2 CoreFoundation 0x0000000102598f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00000001024ae005 forwarding + 1013
4 CoreFoundation 0x00000001024adb88 CF_forwarding_prep_0 + 120
5 FileProvider 0x00000001015e6aa3 TFFFC12FileProvider15FTPFileProvider8copyItemFT9localFileV10Foundation3URL2toSS9overwriteSb17completionHandlerGSqFGSqPs5Error__T___GSqPS_15OperationHandle__U_FGSqPS3___T_U0_FCS_22FileProviderStreamTaskT + 531
6 FileProvider 0x00000001015f63cc TPA__TFFFC12FileProvider15FTPFileProvider8copyItemFT9localFileV10Foundation3URL2toSS9overwriteSb17completionHandlerGSqFGSqPs5Error__T___GSqPS_15OperationHandle__U_FGSqPS3___T_U0_FCS_22FileProviderStreamTaskT + 380
7 FileProvider 0x00000001015e6be7 TTRXFo_oC12FileProvider22FileProviderStreamTask__XFo_iS0__iT
+ 23
8 FileProvider 0x00000001015f6491 TPA__TTRXFo_oC12FileProvider22FileProviderStreamTask__XFo_iS0__iT
.114 + 81
9 FileProvider 0x00000001016113df TFFFC12FileProvider15FTPFileProvider8ftpStoreFTCS_22FileProviderStreamTask8filePathSS8fromDataGSqV10Foundation4Data_8fromFileGSqVS2_3URL_6onTaskGSqFS1_T__17completionHandlerFGSqPs5Error__T__T_U_FTGSqS1__GSqPS5____T_U_FGSqPS5___T + 1407
10 FileProvider 0x000000010161a701 TPA__TFFFC12FileProvider15FTPFileProvider8ftpStoreFTCS_22FileProviderStreamTask8filePathSS8fromDataGSqV10Foundation4Data_8fromFileGSqVS2_3URL_6onTaskGSqFS1_T__17completionHandlerFGSqPs5Error__T__T_U_FTGSqS1__GSqPS5____T_U_FGSqPS5___T + 289
11 FileProvider 0x0000000101567f17 TTRXFo_oGSqPs5Error____XFo_iGSqPS____iT
+ 23
12 FileProvider 0x000000010161a7a1 TPA__TTRXFo_oGSqPs5Error____XFo_iGSqPS____iT
+ 81
13 FileProvider 0x00000001015fe0dd TFFC12FileProvider15FTPFileProvider7executeFT7commandSS2onCS_22FileProviderStreamTask9minLengthSi9afterSendGSqFGSqPs5Error__T__17completionHandlerFTGSqSS_GSqPS2____T__T_U_FGSqPS2___T + 477
14 FileProvider 0x00000001015fe378 TPA__TFFC12FileProvider15FTPFileProvider7executeFT7commandSS2onCS_22FileProviderStreamTask9minLengthSi9afterSendGSqFGSqPs5Error__T__17completionHandlerFTGSqSS_GSqPS2____T__T_U_FGSqPS2___T + 184
15 FileProvider 0x00000001015c79f8 TTRXFo_oGSqPs5Error____XFdCb_dGSqCSo7NSError
+ 104
16 CFNetwork 0x0000000104fb9e30 __64-[__NSCFURLLocalStreamTask writeData:timeout:completionHandler:]_block_invoke_2.311 + 20
17 Foundation 0x0000000101a8c9ad NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 7
18 Foundation 0x0000000101a8c68f -[NSBlockOperation main] + 101
19 Foundation 0x0000000101a8ad8c -[__NSOperationInternal _start:] + 672
20 Foundation 0x0000000101a86ccf __NSOQSchedule_f + 201
21 libdispatch.dylib 0x0000000106e5b0cd _dispatch_client_callout + 8
22 libdispatch.dylib 0x0000000106e38e17 _dispatch_queue_serial_drain + 236
23 libdispatch.dylib 0x0000000106e39b4b _dispatch_queue_invoke + 1073
24 libdispatch.dylib 0x0000000106e3c385 _dispatch_root_queue_drain + 720
25 libdispatch.dylib 0x0000000106e3c059 _dispatch_worker_thread3 + 123
26 libsystem_pthread.dylib 0x00000001072044de _pthread_wqthread + 1129
27 libsystem_pthread.dylib 0x0000000107202341 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Here is my code

    let imageURL = info[UIImagePickerControllerReferenceURL] as! NSURL
    let imageName = imageURL.lastPathComponent
    var  chosenImage = UIImage()
    chosenImage = info[UIImagePickerControllerOriginalImage] as! UIImage
    var imageData: Data = UIImagePNGRepresentation(chosenImage)!
    
    let ftpProvider = FTPFileProvider(baseURL: URL(string:"ftp://webtest.servicelines.it:21")!, credential: URLCredential(user: "gwapp", password:"4ds034x8$!xc$D1", persistence: .forSession))

    ftpProvider?.copyItem(localFile: imageURL as URL, to: "test.png", overwrite:true, completionHandler: {
        error in
        print("Error: \(error)")
    })

// ftpProvider?.writeContents(path: "test.txt", contents: nil, atomically: true, overwrite:true, completionHandler: {
// error in
// print("Error: (error)")
// })

@amosavian amosavian added the bug label Jun 16, 2017

amosavian added a commit that referenced this issue Jun 24, 2017

@amosavian

This comment has been minimized.

Show comment
Hide comment
@amosavian

amosavian Jun 27, 2017

Owner

Please check if the problem is solved in latest commit.

Note: If you use cocoapods, please use manual installation method to have latest commit

Owner

amosavian commented Jun 27, 2017

Please check if the problem is solved in latest commit.

Note: If you use cocoapods, please use manual installation method to have latest commit

@leonomar

This comment has been minimized.

Show comment
Hide comment
@leonomar

leonomar Jun 27, 2017

Hi, I have the same problem, using latest commit

leonomar commented Jun 27, 2017

Hi, I have the same problem, using latest commit

@amosavian

This comment has been minimized.

Show comment
Hide comment
@amosavian

amosavian Jun 27, 2017

Owner

I can't reproduce it. I can successfully upload files. @leonomar

Owner

amosavian commented Jun 27, 2017

I can't reproduce it. I can successfully upload files. @leonomar

@leonomar

This comment has been minimized.

Show comment
Hide comment
@leonomar

leonomar Jun 27, 2017

I could already do it, the problem was the data my mistake, works perfectly... thanks.. regards

leonomar commented Jun 27, 2017

I could already do it, the problem was the data my mistake, works perfectly... thanks.. regards

@amosavian

This comment has been minimized.

Show comment
Hide comment
@amosavian

amosavian Jun 27, 2017

Owner

I still want know how it. happened for you.

Owner

amosavian commented Jun 27, 2017

I still want know how it. happened for you.

@leonomar

This comment has been minimized.

Show comment
Hide comment
@leonomar

leonomar Jun 28, 2017

I could detect an error when write content with a long path to ftp, for example I was using the following path with the following file name, this throw me always error:

FtpProvider.writeContents (path: "DNBC/EMERGENCIAS/155204/17062765854.png", contents: data as! Data, atomically: true, overwrite: true, completionHandler: {error in ...... }

If I reduce the size of the path, write the file correctly....

leonomar commented Jun 28, 2017

I could detect an error when write content with a long path to ftp, for example I was using the following path with the following file name, this throw me always error:

FtpProvider.writeContents (path: "DNBC/EMERGENCIAS/155204/17062765854.png", contents: data as! Data, atomically: true, overwrite: true, completionHandler: {error in ...... }

If I reduce the size of the path, write the file correctly....

@amosavian

This comment has been minimized.

Show comment
Hide comment
@amosavian

amosavian Jun 28, 2017

Owner

@leonomar still can't reproduce with a long path 😞

Owner

amosavian commented Jun 28, 2017

@leonomar still can't reproduce with a long path 😞

@amosavian

This comment has been minimized.

Show comment
Hide comment
@amosavian

amosavian Dec 27, 2017

Owner

I believe this issue has been addressed in [this commit](d29826c. Please reopen if you still have issue.

Owner

amosavian commented Dec 27, 2017

I believe this issue has been addressed in [this commit](d29826c. Please reopen if you still have issue.

@amosavian amosavian closed this Dec 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment