# Shiny app error

**URL:** <https://discourse.openondemand.org/t/shiny-app-error/1601>\
**Category:** Get Help\
**Created:** [July 27, 2021, 2:27pm UTC](https://discourse.openondemand.org/t/shiny-app-error/1601 "2021-07-27T14:27:29Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![fenz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/fenz/32/496_2.png) [@fenz](https://discourse.openondemand.org/u/fenz)\
**Post date:** [July 27, 2021, 2:27pm UTC](https://discourse.openondemand.org/t/shiny-app-error/1601/1 "2021-07-27T14:27:29Z")

</div>

I’m not a Shiny expert, I tried to deploy the app from the OOD documentation but it seems not to like the socket file as port. So this:

```auto
R-4.0.3-foss> options(shiny.launch.browser = FALSE)
R-4.0.3-foss> shiny::runApp("~/R/shiny/app")
Loading required package: shiny

Listening on http://127.0.0.1:4745

```

works assigning a random port.

While this:

```auto
R-4.0.3-foss> sock <- "/tmp/tmp.vYP61Jmq4y/app.sock"
R-4.0.3-foss> attr(sock, "mask") <- strtoi("0077", 8)
R-4.0.3-foss> options(shiny.port = sock)
R-4.0.3-foss> options(shiny.launch.browser = FALSE)
R-4.0.3-foss> shiny::runApp("~/R/shiny/app")

Listening on domain socket /tmp/tmp.vYP61Jmq4y/app.sock
createPipeServer: invalid argument
Warning in normalizePath(name) :
  path[1]="/tmp/tmp.vYP61Jmq4y/app.sock": No such file or directory
Error in .subset2(public_bind_env, "initialize")(...) : 
  Failed to create server

```

generate an error.  
I’m pretty sure I’m doing something dummy here. Can anyone give me a clue?

---

<div class="post-metadata">

**Author:** ![fenz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/fenz/32/496_2.png) [@fenz](https://discourse.openondemand.org/u/fenz)\
**Post date:** [July 28, 2021, 2:18pm UTC](https://discourse.openondemand.org/t/shiny-app-error/1601/2 "2021-07-28T14:18:05Z")

</div>

I think maybe that’s an issue from the “proxy” side since I just figured out Shiny is waiting for the proxy to create the socket.  
Is there anything I can do to know if the lua-resty-session works properly?  
The app seems just an example, not sure if that’s supposed to work out of the box or it needs more adjustments.  
Does anyone have a working example of shiny app?

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [July 28, 2021, 3:50pm UTC](https://discourse.openondemand.org/t/shiny-app-error/1601/3 "2021-07-28T15:50:30Z")

</div>

Hello,

Unfortunately I wasn’t able to replicate this. For the lua-resty-session, I would see if you can find something in the logs, but other than that I don’t know how else you could test the session working properly.

There are some working rstudio apps out there, and you are correct that the repo in that bit of docs here [1. Copy RStudio App — Open OnDemand 2.0.13 documentation](https://osc.github.io/ood-documentation/latest/app-development/tutorials-interactive-apps/add-rstudio/copy-app.html) is an example.

This may be more of what you are looking for [GitHub - OSC/bc\_osc\_rstudio\_server: Batch Connect - OSC RStudio Server](https://github.com/OSC/bc_osc_rstudio_server) and there are others out there like [OOD-apps/rstudio\_server\_app at master · CHPC-UofU/OOD-apps · GitHub](https://github.com/CHPC-UofU/OOD-apps/tree/master/rstudio_server_app) but I have not had any experience with that repo. Let me know if those are the right docs you were working from and the correct apps you are after though.

---

<div class="post-metadata">

**Author:** ![fenz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/fenz/32/496_2.png) [@fenz](https://discourse.openondemand.org/u/fenz)\
**Post date:** [July 28, 2021, 4:27pm UTC](https://discourse.openondemand.org/t/shiny-app-error/1601/4 "2021-07-28T16:27:36Z")

</div>

Thanks for your answer. Actually I’m not using RStudio but Shiny application from this list: [https://osc.github.io/ood-documentation/master/install-ihpc-apps.html](https://osc.github.io/ood-documentation/master/install-ihpc-apps.html) which points to: [https://github.com/CHPC-UofU/bc\_osc\_example\_shiny](https://github.com/CHPC-UofU/bc_osc_example_shiny).  
Shiny through RStudio will probably work but I was interested in trying the “shiny-only” app.

---

<div class="post-metadata">

**Author:** ![dugan](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@dugan](https://discourse.openondemand.org/u/dugan)\
**Post date:** [July 30, 2021, 10:38am UTC](https://discourse.openondemand.org/t/shiny-app-error/1601/5 "2021-07-30T10:38:50Z")

</div>

I’m able to reproduce the error that @fenz reports. It is occurring for R versions 4.0.x, x = 0-5.  
versions 3 work fine. This bug report seems to be relevant:

> <https://github.com/rstudio/httpuv/issues/282>
>
> I’ve been debugging an issue I’m having with rmarkdown/shiny and came to the con…clusion this must be a bug in httpuv. Originally I tried to run:
> 
> \`\`\` console
> $ R -q --no-save -e 'rmarkdown::run(file = NULL, dir = ".", shiny\_args=list(port=structure("test.sock", mask=0), quiet=FALSE, launch.browser=FALSE))'
> \`\`\`
> 
> But I can reproduce the issue with the example code from the README as well, replacing \`startServer\` with \`startPipeServer\`:
> \`\`\` r
> library(httpuv)
> 
> s \<- startPipeServer(name="test.sock", mask=NULL,
> app = list(
> call = function(req) {
> body \<- paste0("Time: ", Sys.time(), "\<br\>Path requested: ", req$PATH\_INFO)
> list(
> status = 200L,
> headers = list('Content-Type' = 'text/html'),
> body = body
> )
> }
> )
> )
> \`\`\`
> This is the output with 1.5.3.1:
> \`\`\` console
> $ R -q -f server.R
> \> library(httpuv)
> \>
> \> s \<- startPipeServer(name="test.sock", mask=NULL,
> + app = list(
> + call = function(req) {
> + body \<- paste0("Time: ", Sys.time(), "\<br\>Path requested: ", req$PATH\_INFO)
> + list(
> + status = 200L,
> + headers = list('Content-Type' = 'text/html'),
> + body = body
> + )
> + }
> + )
> + )
> createPipeServer: invalid argument
> Error in .subset2(public\_bind\_env, "initialize")(...) :
> Failed to create server
> Calls: startPipeServer -\> \<Anonymous\> -\> \<Anonymous\>
> In addition: Warning message:
> In normalizePath(name) : path\[1\]="test.sock": No such file or directory
> Execution halted
> \`\`\`
> (notice the error “invalid argument”)
> This works with 1.5.2, so I’m assuming this is a regression introduced by the upgrade from libuv 1.27 to 1.37.

---

<div class="post-metadata">

**Author:** ![fenz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/fenz/32/496_2.png) [@fenz](https://discourse.openondemand.org/u/fenz)\
**Post date:** [July 30, 2021, 1:53pm UTC](https://discourse.openondemand.org/t/shiny-app-error/1601/6 "2021-07-30T13:53:32Z")

</div>

Thanks for your reply.  
I actually get the same issue on both R 4.0.3 and R 3.6.3. I just checked the modules I have access to on the system and the configuration is:

```auto
R-4.0.3> packageVersion("shiny")
[1] ‘1.4.0.2’

```

```auto
R-3.6.3> packageVersion("shiny")
[1] ‘1.5.0’

```

So in my modules the newer R has an older shiny package but, in both cases, older than version “1.5.3.1” (mentioned in the issue linked).  
Can you tell me the versions of both R and shiny which work for you?  
Many thanks for your help!

---

<div class="post-metadata">

**Author:** ![dugan](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@dugan](https://discourse.openondemand.org/u/dugan)\
**Post date:** [July 30, 2021, 2:39pm UTC](https://discourse.openondemand.org/t/shiny-app-error/1601/7 "2021-07-30T14:39:52Z")

</div>

The working version is R-3.6.2 with:

> packageVersion(“shiny”)  
> [1] ‘1.4.0’  
> packageVersion(“httpuv”)  
> [1] ‘1.5.2’

---

<div class="post-metadata">

**Author:** ![fenz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/fenz/32/496_2.png) [@fenz](https://discourse.openondemand.org/u/fenz)\
**Post date:** [July 30, 2021, 3:21pm UTC](https://discourse.openondemand.org/t/shiny-app-error/1601/8 "2021-07-30T15:21:09Z")

</div>

I was not checking httpuv package (I overlooked the link you shared I thought it was about shiny package):

```auto
R-3.6.3> packageVersion("httpuv")
[1] ‘1.5.4’

```

So, you are right. version of httpuv \> 1.5.3.1 seems to be an issue.  
Many thanks again for your help!

---

<div class="post-metadata">

**Author:** ![fenz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/fenz/32/496_2.png) [@fenz](https://discourse.openondemand.org/u/fenz)\
**Post date:** [July 30, 2021, 4:45pm UTC](https://discourse.openondemand.org/t/shiny-app-error/1601/9 "2021-07-30T16:45:41Z")

</div>

So, following @dugan info, I run shiny in a container instead of using the one from the R module.  
I can confirm this image: rocker/shiny:3.6.2 still works.  
But it seems newer versions fail.

---

<div class="post-metadata">

**Author:** ![westburg.2](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@westburg.2](https://discourse.openondemand.org/u/westburg.2)\
**Post date:** [May 26, 2022, 3:42pm UTC](https://discourse.openondemand.org/t/shiny-app-error/1601/10 "2022-05-26T15:42:51Z")

</div>

Closed on May 26, 2022, 3:42pm UTC


