Bug 16454 - Problem with simultaneous download using download.file
Summary: Problem with simultaneous download using download.file
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Windows GUI / Window specific (show other bugs)
Version: R 3.2.1
Hardware: x86_64/x64/amd64 (64-bit) Windows 64-bit
: P5 major
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-06-26 01:04 UTC by smith.shrestha
Modified: 2017-05-25 08:06 UTC (History)
2 users (show)

See Also:


Attachments
Patch that fixes the issue (458 bytes, patch)
2017-05-25 05:22 UTC, Nathan Sosnovske
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description smith.shrestha 2015-06-26 01:04:35 UTC
I have recently posted a problem on StackOverflow (http://stackoverflow.com/questions/31039821/simultaneous-download-using-download-file?noredirect=1#comment50145973_31039821) regarding support for simultaneous downloads using download.file (starting from version 3.2.1.). 

A simple example like the following sends the message: "R for Windows GUI front-end has stopped working": 

url_list<-c("http://cran.r-project.org/doc/manuals/r-patched/R-exts.html","http://cran.r-project.org/doc/manuals/r-patched/NEWS.pdf")
dest_list<-c("test1.html","test2.pdf")
download.file(url_list,dest_list,method="libcurl")

One SO user tested the above code in Linux and found no problem. As the solution to the problem in Window, another user recommended using "quiet=TRUE", which did run successfully.  

download.file(url_list,dest_list,method="libcurl",quiet=TRUE)

I thought this as a bug and decided to file it here. 

Thanks. 



P.S. I am using Windows 8.0. I also ran capabilities("libcurl") and it gives the following output.

libcurl 
   TRUE
Comment 1 Nathan Sosnovske 2017-05-25 05:22:32 UTC
Created attachment 2256 [details]
Patch that fixes the issue

The issue was that a progress bar isn't set up if nurls is greater than 1

if (!quiet && nurls <= 1) {
    // It would in principle be possible to have
    // multiple progress bars on Windows.
    curl_easy_setopt(hnd[i], CURLOPT_NOPROGRESS, 0L);
    ndashes = 0;
    #ifdef Win32
    if (R_Interactive) {
           if (!pbar.wprog) {
               pbar.wprog = newwindow(_("Download progress"),


There was no check on closing the progress bar context and this resulted in a segfault as the close context function tries to dereference a null pointer.
Comment 2 Tomas Kalibera 2017-05-25 08:06:45 UTC
Thanks for the report and for the patch, confirmed and fixed in R-devel and R-patched.