Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shiny.port error #103

Closed
andyquinterom opened this issue Aug 5, 2024 · 8 comments
Closed

Shiny.port error #103

andyquinterom opened this issue Aug 5, 2024 · 8 comments
Labels
question Further information is requested

Comments

@andyquinterom
Copy link
Member

andyquinterom commented Aug 5, 2024

No description provided.

@andyquinterom andyquinterom added the bug Something isn't working label Aug 5, 2024
@andyquinterom andyquinterom added this to the 1.0.0 milestone Aug 5, 2024
@andyquinterom andyquinterom added the help wanted Extra attention is needed label Sep 14, 2024
@andyquinterom andyquinterom removed this from the 1.0.0 milestone Sep 14, 2024
@abrahammbs93
Copy link

abrahammbs93 commented Nov 3, 2024

maybe I am having this issue, when I use more than 1 worker ports collide:

FROM ixpantia/faucet:r4.4
ENV FAUCET_WORKERS=2

RUN apt-get update && apt-get install -y \
    libglpk40 \
    libjq-dev \
    jq \
    libgit2-dev \
    libcurl4-openssl-dev \
    cmake \
    libmagick++-dev imagemagick \
    && rm -rf /var/lib/apt/lists/*
...
COPY www/ www/
COPY app.R app.R

using this Docker command:
docker run -it --rm xxx/yyy:f.4.4

I get this error:

[2024-11-03T17:57:24Z WARN  Worker::2]
[2024-11-03T17:57:24Z WARN  Worker::2] Listening on http://0.0.0.0:8180
[2024-11-03T17:57:24Z WARN  Worker::2] createTcpServer: address already in use
[2024-11-03T17:57:24Z WARN  Worker::2] Error in initialize(...) : Failed to create server
[2024-11-03T17:57:24Z WARN  Worker::2] Calls: <Anonymous> ... startApp -> startServer -> <Anonymous> -> initialize
[2024-11-03T17:57:24Z WARN  Worker::2] Execution halted
[2024-11-03T17:57:24Z ERROR faucet] Worker::2's process (220) exited with status exit status: 1
[2024-11-03T17:57:24Z INFO  faucet] Starting process 253 for Worker::2 on port 34515

And it does it in loop.

Any clues? Many thanks

@andyquinterom
Copy link
Member Author

@abrahammbs93 is this happening to you on windows? This is an issue that happens (a little un-predictibly) on windows. I think the answer is creating some sort of randomness.

This is definetely a bug

@abrahammbs93
Copy link

i actually get it in also in ubuntu (AWS EC2 machine):

ubuntu@ip-xxx-xx-xx-xxx:~$ sudo docker run --rm -it -p 8180:8180 -e FAUCET_WORKERS=2 user/image:v.1.0
[2024-11-05T09:06:14Z INFO  faucet] Building the faucet server...
[2024-11-05T09:06:14Z INFO  faucet] Using load balancing strategy: Some(RoundRobin)
[2024-11-05T09:06:14Z INFO  faucet] Will spawn 2 workers
[2024-11-05T09:06:14Z INFO  faucet] Using worker type: Shiny
[2024-11-05T09:06:14Z INFO  faucet] Using IP extractor: ClientAddr
[2024-11-05T09:06:14Z INFO  faucet] Will bind to: 0.0.0.0:3838
[2024-11-05T09:06:14Z INFO  faucet] Using workdir: "/srv/faucet"
[2024-11-05T09:06:14Z INFO  faucet] Using Rscript command: "Rscript"
[2024-11-05T09:06:14Z INFO  faucet] Using quarto command: "quarto"
[2024-11-05T09:06:14Z INFO  faucet] Round robin load balancing strategy specified for shiny, switching to IP hash.
[2024-11-05T09:06:14Z INFO  faucet] Starting immediate shutdown handle
[2024-11-05T09:06:14Z INFO  faucet] Listening on http://0.0.0.0:3838
[2024-11-05T09:06:14Z INFO  faucet] Starting process 11 for Worker::2 on port 40853
[2024-11-05T09:06:14Z INFO  faucet] Starting process 10 for Worker::1 on port 41889
[2024-11-05T09:06:14Z WARN  Worker::2] Loading required package: shiny
[2024-11-05T09:06:14Z WARN  Worker::1] Loading required package: shiny
[2024-11-05T09:06:16Z WARN  Worker::1] Loading required package: data.table
[2024-11-05T09:06:16Z WARN  Worker::2] Loading required package: data.table
[2024-11-05T09:06:22Z WARN  Worker::1] 
[2024-11-05T09:06:22Z WARN  Worker::1] Listening on http://0.0.0.0:8180
[2024-11-05T09:06:22Z WARN  Worker::2]
[2024-11-05T09:06:22Z WARN  Worker::2] Listening on http://0.0.0.0:8180
[2024-11-05T09:06:22Z WARN  Worker::2] createTcpServer: address already in use
[2024-11-05T09:06:22Z WARN  Worker::2] Error in initialize(...) : Failed to create server
[2024-11-05T09:06:22Z WARN  Worker::2] Calls: <Anonymous> ... startApp -> startServer -> <Anonymous> -> initialize
[2024-11-05T09:06:22Z WARN  Worker::2] Execution halted
[2024-11-05T09:06:22Z ERROR faucet] Worker::2's process (11) exited with status exit status: 1
[2024-11-05T09:06:22Z INFO  faucet] Starting process 47 for Worker::2 on port 40853

@andyquinterom
Copy link
Member Author

andyquinterom commented Nov 5, 2024

i actually get it in also in ubuntu (AWS EC2 machine):


ubuntu@ip-xxx-xx-xx-xxx:~$ sudo docker run --rm -it -p 8180:8180 -e FAUCET_WORKERS=2 user/image:v.1.0

[2024-11-05T09:06:14Z INFO  faucet] Building the faucet server...

[2024-11-05T09:06:14Z INFO  faucet] Using load balancing strategy: Some(RoundRobin)

[2024-11-05T09:06:14Z INFO  faucet] Will spawn 2 workers

[2024-11-05T09:06:14Z INFO  faucet] Using worker type: Shiny

[2024-11-05T09:06:14Z INFO  faucet] Using IP extractor: ClientAddr

[2024-11-05T09:06:14Z INFO  faucet] Will bind to: 0.0.0.0:3838

[2024-11-05T09:06:14Z INFO  faucet] Using workdir: "/srv/faucet"

[2024-11-05T09:06:14Z INFO  faucet] Using Rscript command: "Rscript"

[2024-11-05T09:06:14Z INFO  faucet] Using quarto command: "quarto"

[2024-11-05T09:06:14Z INFO  faucet] Round robin load balancing strategy specified for shiny, switching to IP hash.

[2024-11-05T09:06:14Z INFO  faucet] Starting immediate shutdown handle

[2024-11-05T09:06:14Z INFO  faucet] Listening on http://0.0.0.0:3838

[2024-11-05T09:06:14Z INFO  faucet] Starting process 11 for Worker::2 on port 40853

[2024-11-05T09:06:14Z INFO  faucet] Starting process 10 for Worker::1 on port 41889

[2024-11-05T09:06:14Z WARN  Worker::2] Loading required package: shiny

[2024-11-05T09:06:14Z WARN  Worker::1] Loading required package: shiny

[2024-11-05T09:06:16Z WARN  Worker::1] Loading required package: data.table

[2024-11-05T09:06:16Z WARN  Worker::2] Loading required package: data.table

[2024-11-05T09:06:22Z WARN  Worker::1] 

[2024-11-05T09:06:22Z WARN  Worker::1] Listening on http://0.0.0.0:8180

[2024-11-05T09:06:22Z WARN  Worker::2]

[2024-11-05T09:06:22Z WARN  Worker::2] Listening on http://0.0.0.0:8180

[2024-11-05T09:06:22Z WARN  Worker::2] createTcpServer: address already in use

[2024-11-05T09:06:22Z WARN  Worker::2] Error in initialize(...) : Failed to create server

[2024-11-05T09:06:22Z WARN  Worker::2] Calls: <Anonymous> ... startApp -> startServer -> <Anonymous> -> initialize

[2024-11-05T09:06:22Z WARN  Worker::2] Execution halted

[2024-11-05T09:06:22Z ERROR faucet] Worker::2's process (11) exited with status exit status: 1

[2024-11-05T09:06:22Z INFO  faucet] Starting process 47 for Worker::2 on port 40853

I see that both apps are starting on port 8180. I'm betting this is not a coincidence, do you have this port hard coded somewhere in your app code? This sounds related to the issue related to static ports. (#50)

@andyquinterom
Copy link
Member Author

@abrahammbs93 I created a new issue #159 to continue the conversation

@abrahammbs93
Copy link

My code is like this:

shinyApp(
    ui = ui_app,
    server = server_app   
)

I tried without using in the docker command any ports (which eventually would be a problem for the EC2 port) but I had the same issue.

@andyquinterom
Copy link
Member Author

@abrahammbs93

I noticed that faucet is telling shiny to use the correct ports. Notice these two lines on the logs you provided:

[2024-11-05T09:06:14Z INFO  faucet] Starting process 11 for Worker::2 on port 40853
[2024-11-05T09:06:14Z INFO  faucet] Starting process 10 for Worker::1 on port 41889

That means somewhere in the code there is an explicit declarations to set the option shiny.port. Can you check if there are any explicit sets of shiny.port?

@abrahammbs93
Copy link

You were right, the shiny.options (in the .Rprofile that the company imposes) had the port fixed there.
Many thanks for the support, it works perfectly.

@andyquinterom andyquinterom changed the title Improve windows compatibility Shiny.port error Nov 11, 2024
@andyquinterom andyquinterom added question Further information is requested and removed bug Something isn't working help wanted Extra attention is needed labels Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants