[ https://issues.apache.org/jira/browse/CB-2787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13801579#comment-13801579 ]
Gregor Gabriel commented on CB-2787: ------------------------------------ Hello Cho, I tried Your solution and it worked fine for http downloads. But for https downloads again java exceptions occur: here is a snippet from the catlog: <code> 10-22 08:37:11.693: D/FileTransfer(13039): download https://mysite.com:443/content/2013/qmb01/qmb01q01-7/sounds/52791DA3-28FC-4381-A6FD-CF49240E5AEB.mp3 to file:///storage/emulated/0//content/2013/qmb01/qmb01q01-7/sounds/52791DA3-28FC-4381-A6FD-CF49240E5AEB.mp3 10-22 08:37:11.713: E/NativeCrypto(13039): AppData::create pipe(2) failed: Too many open files 10-22 08:37:11.738: E/NativeCrypto(13039): AppData::create pipe(2) failed: Too many open files 10-22 08:37:11.738: W/FileTransfer(13039): Error getting HTTP status code from connection. 10-22 08:37:11.738: W/FileTransfer(13039): javax.net.ssl.SSLException: Unable to create application data 10-22 08:37:11.738: W/FileTransfer(13039): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method) 10-22 08:37:11.738: W/FileTransfer(13039): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:398) 10-22 08:37:11.738: W/FileTransfer(13039): at libcore.net.http.HttpConnection.setupSecureSocket(HttpConnection.java:209) 10-22 08:37:11.738: W/FileTransfer(13039): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:478) 10-22 08:37:11.738: W/FileTransfer(13039): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:442) 10-22 08:37:11.738: W/FileTransfer(13039): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290) 10-22 08:37:11.738: W/FileTransfer(13039): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240) 10-22 08:37:11.738: W/FileTransfer(13039): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:81) 10-22 08:37:11.738: W/FileTransfer(13039): at libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:165) 10-22 08:37:11.738: W/FileTransfer(13039): at org.apache.cordova.FileTransfer$4.run(FileTransfer.java:791) 10-22 08:37:11.738: W/FileTransfer(13039): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 10-22 08:37:11.738: W/FileTransfer(13039): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 10-22 08:37:11.738: W/FileTransfer(13039): at java.lang.Thread.run(Thread.java:841) 10-22 08:37:11.743: E/FileTransfer(13039): {"target":"file:\/\/\/storage\/emulated\/0\/content\/\/2013\/qmb01\/qmb01q01-7\/sounds\/52791DA3-28FC-4381-A6FD-CF49240E5AEB.mp3","source":"https:\/\/elearning-mobile.de.tuv.com:443\/content\/2013\/qmb01\/qmb01q01-7\/sounds\/52791DA3-28FC-4381-A6FD-CF49240E5AEB.mp3","http_status":0,"code":3} 10-22 08:37:11.743: E/FileTransfer(13039): javax.net.ssl.SSLException: Unable to create application data 10-22 08:37:11.743: E/FileTransfer(13039): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method) 10-22 08:37:11.743: E/FileTransfer(13039): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:398) 10-22 08:37:11.743: E/FileTransfer(13039): at libcore.net.http.HttpConnection.setupSecureSocket(HttpConnection.java:209) 10-22 08:37:11.743: E/FileTransfer(13039): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:478) 10-22 08:37:11.743: E/FileTransfer(13039): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:442) 10-22 08:37:11.743: E/FileTransfer(13039): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290) 10-22 08:37:11.743: E/FileTransfer(13039): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240) 10-22 08:37:11.743: E/FileTransfer(13039): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:81) 10-22 08:37:11.743: E/FileTransfer(13039): at libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:165) 10-22 08:37:11.743: E/FileTransfer(13039): at org.apache.cordova.FileTransfer$4.run(FileTransfer.java:791) 10-22 08:37:11.743: E/FileTransfer(13039): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 10-22 08:37:11.743: E/FileTransfer(13039): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 10-22 08:37:11.743: E/FileTransfer(13039): at java.lang.Thread.run(Thread.java:841) </code> > PhoneGap FileTransfer.Download more than 300 files > -------------------------------------------------- > > Key: CB-2787 > URL: https://issues.apache.org/jira/browse/CB-2787 > Project: Apache Cordova > Issue Type: Bug > Components: Android > Affects Versions: 2.5.0 > Reporter: Cho > Assignee: Ian Clelland > > I had tried to download more than 300 files and then it hit error after that. > Seems like some IO Connection was not properly closed. I wrote a small code > to test it out. > Any idea? How to file a report or get a source of phonegap to check the real > cause? > {code} > var counter = 500; > function DownloadFile() { > if (counter == 0) { > DownloadComplete(); > return; > } > var ft = new FileTransfer(); > var downloadUrl = "<source>"; > var dlPath = "<target>" > ft.download(downloadUrl, dlPath, function(entry) { > counter--; > UpdateProgress(); > DownloadFile(); > }, function(error) { > DownloadFailed(); > }, true); > } > {code} > note: <target> and <source> is alright because it was it failed when the > counter goes until 300+. > {code} > 03-14 08:35:09.706: E/FileTransfer(24867): > {"target":"<target>","source":"<source>","http_status":200,"code":1} > 03-14 08:35:09.706: E/FileTransfer(24867): java.io.FileNotFoundException: > <source>: open failed: EMFILE (Too many open files) > 03-14 08:35:09.706: E/FileTransfer(24867): at > libcore.io.IoBridge.open(IoBridge.java:416) > 03-14 08:35:09.706: E/FileTransfer(24867): at > java.io.FileOutputStream.<init>(FileOutputStream.java:88) > 03-14 08:35:09.706: E/FileTransfer(24867): at > java.io.FileOutputStream.<init>(FileOutputStream.java:73) > 03-14 08:35:09.706: E/FileTransfer(24867): at > org.apache.cordova.FileTransfer$4.run(FileTransfer.java:685) > 03-14 08:35:09.706: E/FileTransfer(24867): at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) > 03-14 08:35:09.706: E/FileTransfer(24867): at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) > 03-14 08:35:09.706: E/FileTransfer(24867): at > java.lang.Thread.run(Thread.java:856) > 03-14 08:35:09.706: E/FileTransfer(24867): Caused by: > libcore.io.ErrnoException: open failed: EMFILE (Too many open files) > 03-14 08:35:09.706: E/FileTransfer(24867): at > libcore.io.Posix.open(Native Method) > 03-14 08:35:09.706: E/FileTransfer(24867): at > libcore.io.BlockGuardOs.open(BlockGuardOs.java:110) > 03-14 08:35:09.706: E/FileTransfer(24867): at > libcore.io.IoBridge.open(IoBridge.java:400) > 03-14 08:35:09.706: E/FileTransfer(24867): ... 6 more > {code} -- This message was sent by Atlassian JIRA (v6.1#6144)