Shiny: ERROR: [uv_write] broken pipe (shiny 1.3.0)

Created on 8 Apr 2019  ยท  31Comments  ยท  Source: rstudio/shiny

Since the upgrade to shiny 1.3.0 I am sometimes getting the following error msg:
ERROR: [uv_write] broken pipe

The app still loads and doesn't break but also it seems to be much less performant than with version 1.2.0.

Unfortunately I wasn't able to systematically reproduce this error with a small reprex. Also with my full app the error just appears sometimes, and sometimes multiple times in a row.

Listening on http://127.0.0.1:6462
ERROR: [uv_write] broken pipe
ERROR: [uv_write] broken pipe
Regression

Most helpful comment

@alandipert and I did some investigation of this issue, and we found that it happens when a httpuv app's onHeaders function schedules data to be written, after the socket has already closed.

To reproduce, run this app. If you wait 3 seconds, the browser will show "Hello headers!". If you close the browser window (or reload it) in less than 3 seconds, then the server will print out ERROR: [uv_write] bad file descriptor on Mac, and ERROR: [uv_write] broken pipe on Windows.

library(httpuv)
s <- startServer("0.0.0.0", 5000,
  list(
    onHeaders = function(req) {
      Sys.sleep(3)
      list(
        status = 200L,
        headers = list('Content-Type' = 'text/html'),
        body = "Hello headers!"
      )
    }
  )
)

The line of code that generates that message is at https://github.com/rstudio/httpuv/blob/605f668/src/httpresponse.cpp#L107

When this error happens, it is handled correctly, and everything gets cleaned up properly. So I think the problem is just that the error message is unnecessarily scary, and probably not needed at all.

All 31 comments

Just running it locally on your computer, it's slower? Is the source to your app publicly available, so we can try to repro?

Yes I just ran it locally for now, I didn't want to upload to our server as performance is already an issue.

Unfortunately it is not publicly available.

I tried to create some small apps to reproduce the error without success.
But I could attach my sessionInfo, if that would help?

Yes, can you please include session info? Better if you use the sessioninfo package, as in:

sessioninfo::session_info()


Session info

 setting  value                       
 version  R version 3.5.2 (2018-12-20)
 os       Windows >= 8 x64            
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  German_Germany.1252         
 ctype    German_Germany.1252         
 tz       Europe/Berlin               
 date     2019-04-08      


Packages

```
package * version date lib source
assertthat 0.2.0 2017-04-11 [1] CRAN (R 3.5.1)
bit 1.1-14 2018-05-29 [1] CRAN (R 3.5.0)
bit64 0.9-7 2017-05-08 [1] CRAN (R 3.5.0)
blob 1.1.1 2018-03-25 [1] CRAN (R 3.5.1)
cli 1.0.1 2018-09-25 [1] CRAN (R 3.5.1)
colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.5.3)
config * 0.3 2018-03-27 [1] CRAN (R 3.5.2)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.1)
crosstalk 1.0.0 2016-12-21 [1] CRAN (R 3.5.1)
data.table * 1.12.0 2019-01-13 [1] CRAN (R 3.5.2)
DBI * 1.0.0 2018-05-02 [1] CRAN (R 3.5.1)
dbplyr 1.3.0 2019-01-09 [1] CRAN (R 3.5.2)
digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.2)
dplyr 0.8.0.1 2019-02-15 [1] CRAN (R 3.5.2)
DT * 0.5 2018-11-05 [1] CRAN (R 3.5.2)
ggplot2 * 3.1.0 2018-10-25 [1] CRAN (R 3.5.2)
glue 1.3.0 2018-07-17 [1] CRAN (R 3.5.1)
gtable 0.2.0 2016-02-26 [1] CRAN (R 3.5.1)
hms 0.4.2 2018-03-10 [1] CRAN (R 3.5.1)
htmltools 0.3.6 2017-04-28 [1] CRAN (R 3.5.1)
htmlwidgets 1.3 2018-09-30 [1] CRAN (R 3.5.1)
httpuv 1.5.1 2019-04-05 [1] CRAN (R 3.5.3)
httr 1.4.0 2018-12-11 [1] CRAN (R 3.5.2)
jsonlite 1.6 2018-12-07 [1] CRAN (R 3.5.2)
later 0.8.0 2019-02-11 [1] CRAN (R 3.5.2)
lazyeval 0.2.1 2017-10-29 [1] CRAN (R 3.5.1)
lubridate * 1.7.4 2018-04-11 [1] CRAN (R 3.5.1)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.1)
mime 0.6 2018-10-05 [1] CRAN (R 3.5.2)
munsell 0.5.0 2018-06-12 [1] CRAN (R 3.5.1)
pillar 1.3.1 2018-12-15 [1] CRAN (R 3.5.2)
pkgconfig 2.0.2 2018-08-16 [1] CRAN (R 3.5.1)
plotly * 4.8.0.9000 2019-03-19 [1] local
plyr 1.8.4 2016-06-08 [1] CRAN (R 3.5.1)
pool * 0.1.4.2 2019-01-07 [1] CRAN (R 3.5.2)
promises 1.0.1 2018-04-13 [1] CRAN (R 3.5.1)
purrr 0.3.0 2019-01-27 [1] CRAN (R 3.5.2)
R6 2.4.0 2019-02-14 [1] CRAN (R 3.5.2)
Rcpp 1.0.1 2019-03-17 [1] CRAN (R 3.5.3)
rhandsontable * 0.3.7 2019-04-05 [1] local
rjson * 0.2.20 2018-06-08 [1] CRAN (R 3.5.0)
rlang 0.3.4 2019-04-07 [1] CRAN (R 3.5.3)
RPostgres * 1.1.1.9002 2019-03-12 [1] local
rstudioapi 0.9.0 2019-01-09 [1] CRAN (R 3.5.2)
scales 1.0.0 2018-08-09 [1] CRAN (R 3.5.1)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.3)
shiny * 1.3.0 2019-04-07 [1] CRAN (R 3.5.3)
shinycssloaders * 0.2.0 2019-01-31 [1] Github (andrewsali/shinycssloaders@8779ff0)
shinyjqui * 0.3.2.9000 2019-03-22 [1] Github (yang-tang/shinyjqui@2313aed)
shinyjs * 1.0 2018-01-08 [1] CRAN (R 3.5.1)
shinyTree * 0.2.6 2019-04-08 [1] Github (trafficonese/shinyTreeSG@e48e61a)
shinyWidgets * 0.4.8 2019-03-18 [1] CRAN (R 3.5.3)
stringi 1.3.1 2019-02-13 [1] CRAN (R 3.5.2)
stringr 1.4.0 2019-02-10 [1] CRAN (R 3.5.2)
tibble 2.0.1 2019-01-12 [1] CRAN (R 3.5.2)
tidyr 0.8.2 2018-10-28 [1] CRAN (R 3.5.2)
tidyselect 0.2.5 2018-10-11 [1] CRAN (R 3.5.2)
vdefuncs1 * 0.1.0 2019-04-08 [1] local
viridisLite 0.3.0 2018-02-01 [1] CRAN (R 3.5.1)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.1)
xtable 1.8-3 2018-08-29 [1] CRAN (R 3.5.1)
yaml 2.2.0 2018-07-25 [1] CRAN (R 3.5.1)

```

What version of RStudio? Are you using the RStudio browser window, or an external browser, and if the latter, which browser and version?

Thanks!

RStudio Version 1.1.463

I am using Firefox Quantum 66.0.2 (64-Bit)

Can you see if it's also slow in Chrome? (Not saying that's an acceptable workaround ๐Ÿ˜…, just looking for clues)

Yes it is similarly slow in Chrome.

"Interestingly" it is not even working in IE or Edge, as it says Plotly is undefined.

I am using htmlTemplate("filename", document_ = TRUE) to create my ui.

@trafficonese Can you try removing all your packages and then reinstalling them? I hope that's not too much work.

@trafficonese Would you be open to doing a screenshare session with some members of our team? We'd _really_ like to get to the bottom of this! If so, you can email me at [email protected].

@nteetor Are you seeing something similar? (uv_write errors introduced with Shiny 1.3.0 or httpuv 1.5.1, and/or slowness?)

I was seeing a uv file descriptor error message, but have now reinstalled shiny 1.3.0 along with httpuv 1.5.1 and am no longer seeing the message.

I am seeing my error again. I apologize it's not exactly the same, but does seem to be libuv related.

ERROR: [uv_write] bad file descriptor

Just adding my $0.02. It might help. I also had the "ERROR: [uv_write] broken pipe" as well.
I had a error message in the Web console similar to that one:
https://developer.mozilla.org/en-US/docs/Tools/Debugger/Source_map_errors

Adding the .js file from the the error message in the mentioned location seems to have solve the issue.

(A lot of things broke for me when moving from 1.2.0 to 1.3.0 but I managed to fix most issues by moving some javascript around)

@2005m what else broke for you? And can you tell us the exact source map error?

Not exactly sure what is the source of the map error...

I remember an another error where a html page was not rendering correctly anymore.
I was calling it like this:
htmlTemplate('www/html/loginPage.html')

my javascripts were in the folder www/js, and I had to move them under www/html in order for them to be "found" by the App and html.

@nteetor Can you provide the output of sessioninfo::session_info()?

@2005m If you can send us a reproducible example (whether minimal or very un-minimal!) it would be incredibly helpful!

Sure thing



โ”€ Session info โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 os       macOS High Sierra 10.13.6   
 system   x86_64, darwin15.6.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2019-04-09                  



โ”€ Packages โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

 !  package      * version date       lib source                                  
    assertthat     0.2.1   2019-03-21 [1] CRAN (R 3.5.1)                          
    backports      1.1.3   2018-12-14 [1] CRAN (R 3.5.0)                          
    broom          0.5.1   2018-12-05 [1] CRAN (R 3.5.0)                          
    callr          3.1.1   2018-12-21 [1] CRAN (R 3.5.0)                          
    cli            1.1.0   2019-03-19 [1] CRAN (R 3.5.1)                          
    crayon         1.3.4   2017-09-16 [1] CRAN (R 3.5.0)                          
    crosstalk      1.0.0   2016-12-21 [1] CRAN (R 3.5.0)                          
    curl           3.3     2019-01-10 [1] CRAN (R 3.5.2)                          
    data.table     1.12.0  2019-01-13 [1] CRAN (R 3.5.2)                          
    desc           1.2.0   2018-05-01 [1] CRAN (R 3.5.0)                          
    devtools       2.0.1   2018-10-26 [1] CRAN (R 3.5.1)                          
    digest         0.6.18  2018-10-10 [1] CRAN (R 3.5.0)                          
    dplyr          0.8.0.1 2019-02-15 [1] CRAN (R 3.5.2)                          
    DT             0.5     2018-11-05 [1] CRAN (R 3.5.0)                          
    fansi          0.4.0   2018-10-05 [1] CRAN (R 3.5.0)                          
    fs             1.2.6   2018-08-23 [1] CRAN (R 3.5.0)                          
    generics       0.0.2   2018-11-29 [1] CRAN (R 3.5.0)                          
    glue           1.3.1   2019-03-12 [1] CRAN (R 3.5.1)                          
 VP heat         * 3.1.1   2019-03-26 [?] local                                   
    heatdata       0.0.1   2019-04-05 [1] Github (-redacted by me-)    
    heatmeasures   0.0.1   2019-04-05 [1] Github (-redacted by me-)
    highcharter    0.7.0   2019-01-15 [1] CRAN (R 3.5.2)                          
    htmltools      0.3.6   2017-04-28 [1] CRAN (R 3.5.0)                          
    htmlwidgets    1.3     2018-09-30 [1] CRAN (R 3.5.0)                          
    httpuv         1.5.1   2019-04-05 [1] CRAN (R 3.5.2)                          
    igraph         1.2.4   2019-02-13 [1] CRAN (R 3.5.2)                          
    jsonlite       1.6     2018-12-07 [1] CRAN (R 3.5.0)                          
    later          0.8.0   2019-02-11 [1] CRAN (R 3.5.2)                          
    lattice        0.20-38 2018-11-04 [1] CRAN (R 3.5.0)                          
    lubridate      1.7.4   2018-04-11 [1] CRAN (R 3.5.0)                          
    magrittr       1.5     2014-11-22 [1] CRAN (R 3.5.0)                          
    memoise        1.1.0   2017-04-21 [1] CRAN (R 3.5.0)                          
    mime           0.6     2018-10-05 [1] CRAN (R 3.5.0)                          
    nlme           3.1-137 2018-04-07 [1] CRAN (R 3.5.1)                          
    packrat        0.5.0   2018-11-14 [1] CRAN (R 3.5.0)                          
    pillar         1.3.1   2018-12-15 [1] CRAN (R 3.5.0)                          
    pkgbuild       1.0.2   2018-10-16 [1] CRAN (R 3.5.0)                          
    pkgconfig      2.0.2   2018-08-16 [1] CRAN (R 3.5.0)                          
    pkgload        1.0.2   2018-10-29 [1] CRAN (R 3.5.0)                          
    prettyunits    1.0.2   2015-07-13 [1] CRAN (R 3.5.0)                          
    processx       3.2.1   2018-12-05 [1] CRAN (R 3.5.0)                          
    promises       1.0.1   2018-04-13 [1] CRAN (R 3.5.0)                          
    ps             1.3.0   2018-12-21 [1] CRAN (R 3.5.0)                          
    purrr          0.3.2   2019-03-15 [1] CRAN (R 3.5.2)                          
    quantmod       0.4-13  2018-04-13 [1] CRAN (R 3.5.0)                          
    R6             2.4.0   2019-02-14 [1] CRAN (R 3.5.2)                          
    Rcpp           1.0.1   2019-03-17 [1] CRAN (R 3.5.2)                          
    remotes        2.0.2   2018-10-30 [1] CRAN (R 3.5.0)                          
    rlang          0.3.3   2019-03-29 [1] CRAN (R 3.5.1)                          
    rlist          0.4.6.1 2016-04-04 [1] CRAN (R 3.5.0)                          
    rprojroot      1.3-2   2018-01-03 [1] CRAN (R 3.5.0)                          
    rstudioapi     0.9.0   2019-01-09 [1] CRAN (R 3.5.2)                          
    sessioninfo    1.1.1   2018-11-05 [1] CRAN (R 3.5.0)                          
    shiny        * 1.3.0   2019-04-07 [1] CRAN (R 3.5.2)                          
    stringi        1.3.1   2019-02-13 [1] CRAN (R 3.5.2)                          
    stringr        1.4.0   2019-02-10 [1] CRAN (R 3.5.2)                          
    testthat       2.0.1   2018-10-13 [1] CRAN (R 3.5.0)                          
    tibble         2.1.1   2019-03-16 [1] CRAN (R 3.5.2)                          
    tidyr          0.8.2   2018-10-28 [1] CRAN (R 3.5.0)                          
    tidyselect     0.2.5   2018-10-11 [1] CRAN (R 3.5.0)                          
    TTR            0.23-4  2018-09-20 [1] CRAN (R 3.5.0)                          
    usethis        1.4.0   2018-08-14 [1] CRAN (R 3.5.0)                          
    utf8           1.1.4   2018-05-24 [1] CRAN (R 3.5.0)                          
    viridisLite    0.3.0   2018-02-01 [1] CRAN (R 3.5.0)                          
    whisker        0.3-2   2013-04-28 [1] CRAN (R 3.5.0)                          
    withr          2.1.2   2018-03-15 [1] CRAN (R 3.5.0)                          
    xtable         1.8-3   2018-08-29 [1] CRAN (R 3.5.0)                          
    xts            0.11-2  2018-11-05 [1] CRAN (R 3.5.0)                          
    yaml           2.2.0   2018-07-25 [1] CRAN (R 3.5.0)                          
    yonder         0.0.5   2019-04-05 [1] local                                   
    zoo            1.8-4   2018-09-19 [1] CRAN (R 3.5.0)   

For future reference: the performance issue that @trafficonese encountered is due to #2375. It's possible that the [uv_write] errors are happening because of the performance issue, but we don't know for sure at this point.

Unfortunately, the [uv_write] error still appear sometimes with #2376 installed.

Hi @trafficonese, can you also try with devtools::install_github("rstudio/[email protected]")?

I installed already RStudio Version 1.3.109 from here, but I see there's already a newer version. Should I also try with 1.3.112?

Hopefully the RStudio version wont matter -- in fact, it might be better to use the stable release

https://www.rstudio.com/products/rstudio/download/

If you can still reproduce with these versions of shiny and httpuv, then we still have more sleuthing to do

devtools::install_github("rstudio/httpuv")
devtools::install_github("rstudio/[email protected]")

Oh sry, I was misreading the package. I just installed the 2 new versions, but unfortunately the error still appeared.

> packageVersion("httpuv")
[1] โ€˜1.5.1.9000โ€™
> packageVersion("shiny")
[1] โ€˜1.3.1โ€™

Listening on http://127.0.0.1:5115
ERROR: [uv_write] broken pipe
ERROR: [uv_write] broken pipe
ERROR: [uv_write] broken pipe

@trafficonese Could you please post your sessioninfo::session_info() output?

Sure.


- Session info

  setting  value                       
  version  R version 3.5.2 (2018-12-20)
  os       Windows 10 x64              
  system   x86_64, mingw32             
  ui       RStudio                     
  language (EN)                        
  collate  German_Germany.1252         
  ctype    German_Germany.1252         
  tz       Europe/Berlin               
  date     2019-04-11 


- Packages

 package         * version    date       lib source                                     
 assertthat        0.2.0      2017-04-11 [1] CRAN (R 3.5.1)                             
 bit               1.1-14     2018-05-29 [1] CRAN (R 3.5.0)                             
 bit64             0.9-7      2017-05-08 [1] CRAN (R 3.5.0)                             
 blob              1.1.1      2018-03-25 [1] CRAN (R 3.5.1)                             
 cli               1.0.1      2018-09-25 [1] CRAN (R 3.5.1)                             
 colorspace        1.4-1      2019-03-18 [1] CRAN (R 3.5.3)                             
 config          * 0.3        2018-03-27 [1] CRAN (R 3.5.2)                             
 crayon            1.3.4      2017-09-16 [1] CRAN (R 3.5.1)                             
 crosstalk         1.0.0      2016-12-21 [1] CRAN (R 3.5.1)                             
 data.table      * 1.12.0     2019-01-13 [1] CRAN (R 3.5.2)                             
 DBI             * 1.0.0      2018-05-02 [1] CRAN (R 3.5.1)                             
 dbplyr            1.3.0      2019-01-09 [1] CRAN (R 3.5.2)                             
 digest            0.6.18     2018-10-10 [1] CRAN (R 3.5.2)                             
 dplyr             0.8.0.1    2019-02-15 [1] CRAN (R 3.5.2)                             
 DT              * 0.5        2018-11-05 [1] CRAN (R 3.5.2)                             
 ggplot2         * 3.1.0      2018-10-25 [1] CRAN (R 3.5.2)                             
 glue              1.3.0      2018-07-17 [1] CRAN (R 3.5.1)                             
 gtable            0.2.0      2016-02-26 [1] CRAN (R 3.5.1)                             
 hms               0.4.2      2018-03-10 [1] CRAN (R 3.5.1)                             
 htmltools         0.3.6      2017-04-28 [1] CRAN (R 3.5.1)                             
 htmlwidgets       1.3        2018-09-30 [1] CRAN (R 3.5.1)                             
 httpuv            1.5.1.9000 2019-04-11 [1] Github (rstudio/httpuv@da0a7ef)            
 httr              1.4.0      2018-12-11 [1] CRAN (R 3.5.2)                             
 jsonlite          1.6        2018-12-07 [1] CRAN (R 3.5.2)                             
 later             0.8.0      2019-02-11 [1] CRAN (R 3.5.2)                             
 lazyeval          0.2.1      2017-10-29 [1] CRAN (R 3.5.1)                             
 lubridate       * 1.7.4      2018-04-11 [1] CRAN (R 3.5.1)                             
 magrittr          1.5        2014-11-22 [1] CRAN (R 3.5.1)                             
 mime              0.6        2018-10-05 [1] CRAN (R 3.5.2)                             
 munsell           0.5.0      2018-06-12 [1] CRAN (R 3.5.1)                             
 pillar            1.3.1      2018-12-15 [1] CRAN (R 3.5.2)                             
 pkgconfig         2.0.2      2018-08-16 [1] CRAN (R 3.5.1)                             
 plotly          * 4.8.0.9000 2019-04-11 [1] Github (trafficonese/plotly_mini@7ea70b9)  
 plyr              1.8.4      2016-06-08 [1] CRAN (R 3.5.1)                             
 pool            * 0.1.4.2    2019-01-07 [1] CRAN (R 3.5.2)                             
 promises          1.0.1      2018-04-13 [1] CRAN (R 3.5.1)                             
 purrr             0.3.0      2019-01-27 [1] CRAN (R 3.5.2)                             
 R6                2.4.0      2019-02-14 [1] CRAN (R 3.5.2)                             
 Rcpp              1.0.1      2019-03-17 [1] CRAN (R 3.5.3)                             
 rhandsontable   * 0.3.7      2019-04-10 [1] Github (trafficonese/rhandsontable@df97cdc)
 rjson             0.2.20     2018-06-08 [1] CRAN (R 3.5.0)                             
 rlang             0.3.4      2019-04-07 [1] CRAN (R 3.5.3)                             
 RPostgres       * 1.1.1.9002 2019-04-11 [1] Github (r-dbi/RPostgres@11c33f1)           
 rstudioapi        0.9.0      2019-01-09 [1] CRAN (R 3.5.2)                             
 scales            1.0.0      2018-08-09 [1] CRAN (R 3.5.1)                             
 sessioninfo       1.1.1      2018-11-05 [1] CRAN (R 3.5.3)                             
 shiny           * 1.3.1      2019-04-11 [1] Github (rstudio/shiny@de4c756)             
 shinycssloaders * 0.2.0      2019-01-31 [1] Github (andrewsali/shinycssloaders@8779ff0)
 shinyjqui       * 0.3.2.9000 2019-03-22 [1] Github (yang-tang/shinyjqui@2313aed)       
 shinyjs         * 1.0        2018-01-08 [1] CRAN (R 3.5.1)                             
 shinyTree       * 0.2.6      2019-04-10 [1] local                                      
 shinyWidgets    * 0.4.8      2019-03-18 [1] CRAN (R 3.5.3)                             
 stringi           1.3.1      2019-02-13 [1] CRAN (R 3.5.2)                             
 stringr           1.4.0      2019-02-10 [1] CRAN (R 3.5.2)                             
 tibble            2.0.1      2019-01-12 [1] CRAN (R 3.5.2)                             
 tidyr             0.8.2      2018-10-28 [1] CRAN (R 3.5.2)                             
 tidyselect        0.2.5      2018-10-11 [1] CRAN (R 3.5.2)                             
 vdefuncs1       * 0.1.0      2019-04-09 [1] local                                      
 viridisLite       0.3.0      2018-02-01 [1] CRAN (R 3.5.1)                             
 withr             2.1.2      2018-03-15 [1] CRAN (R 3.5.1)                             
 xtable            1.8-3      2018-08-29 [1] CRAN (R 3.5.1)                             
 yaml              2.2.0      2018-07-25 [1] CRAN (R 3.5.1)         

I managed to build a small Gist example, where the error appears.
You probably have to start it several times, untill that error appears though.

It should come right after the startup, so no interaction with the app is needed.

The sessioninfo is also included there.

shiny::runGist("https://gist.github.com/trafficonese/13d615e821c34cdcbcc553531c4707c9")

Just for Reference: I also have this Problem. It is a pretty large app, where the future is used to load data from a googlesheet.

Listening on http://127.0.0.1:5064
ERROR: [uv_write] broken pipe

Shiny 1.3.2
httpuv 1.5.1

R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] mcdsupportshiny_0.1.0.9999 shiny_1.3.2 data.table_1.12.2

loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 crayon_1.3.4 digest_0.6.18 later_0.8.0 mime_0.6 R6_2.4.0 xtable_1.8-4
[8] magrittr_1.5 rstudioapi_0.10 promises_1.0.1 DT_0.6 tools_3.3.3 htmlwidgets_1.3 crosstalk_1.0.0
[15] httpuv_1.5.1 yaml_2.2.0 htmltools_0.3.6

@alandipert and I did some investigation of this issue, and we found that it happens when a httpuv app's onHeaders function schedules data to be written, after the socket has already closed.

To reproduce, run this app. If you wait 3 seconds, the browser will show "Hello headers!". If you close the browser window (or reload it) in less than 3 seconds, then the server will print out ERROR: [uv_write] bad file descriptor on Mac, and ERROR: [uv_write] broken pipe on Windows.

library(httpuv)
s <- startServer("0.0.0.0", 5000,
  list(
    onHeaders = function(req) {
      Sys.sleep(3)
      list(
        status = 200L,
        headers = list('Content-Type' = 'text/html'),
        body = "Hello headers!"
      )
    }
  )
)

The line of code that generates that message is at https://github.com/rstudio/httpuv/blob/605f668/src/httpresponse.cpp#L107

When this error happens, it is handled correctly, and everything gets cleaned up properly. So I think the problem is just that the error message is unnecessarily scary, and probably not needed at all.

Closing because we have a PR at rstudio/httpuv#223 (and it is in a different repository).

Was this page helpful?
0 / 5 - 0 ratings