CrossGeeks / FileUploaderPlugin

Simple cross platform plugin to upload files.
MIT License
68 stars 27 forks source link

Possible memory leak in this FileUploaderPlugin #2

Closed JohnHasler closed 7 years ago

JohnHasler commented 7 years ago

We have added the FileUploaderPlugin into our Xamarin.Forms project and are experiencing what looks like a possible memory leak when we are uploading several large video files at the same time.

Do you know of any issues with the plugin that might account for this?

rdelrosario commented 7 years ago

Hi

What are the size of your videos?

Is this on Android or iOS?

rdelrosario commented 7 years ago

What exception are you getting? Could you put the stacktrace here?

JohnHasler commented 7 years ago

Thanks for your response. This is on Android. It looks like it relates to the hard coded 5 minute timeout in the plugin which was causing an issue when uploading to an SSL endpoint. This is the exception that we are getting.

javax.net.ssl.SSLException: Write error: ssl=0x7f70604080: I/O error during system call, Broken pipe

rdelrosario commented 7 years ago

Ok will make a change for this at some point next week. Will capture this exception as an error but also will allow to specify the timeout when uploading.

rdelrosario commented 7 years ago

Just published a new alpha version: https://www.nuget.org/packages/Plugin.FileUploader/1.3.4-alpha that handles this error instead of crashing you will get the exception string on the FileUploadError event handler.

Also added 3 Android specific static properties:

        public static TimeUnit UploadTimeoutUnit { get; set; } = TimeUnit.Minutes;
        public static long SocketUploadTimeout { get; set; } = 5;
        public static long ConnectUploadTimeout { get; set; } = 5;

Above you can see the default values. But you can change the value for the timeouts and unit by setting it from your Android project(Could be on MainActivity) like this:

        FileUploadManager.UploadTimeoutUnit = TimeUnit.Minutes;
        FileUploadManager.SocketUploadTimeout = 10;
        FileUploadManager.ConnectUploadTimeout  = 5;
JohnHasler commented 7 years ago

Brilliant, thanks for that