Skip to content

odo dev port forward timeouts if app is not ready #5877

@vinny-sabatini

Description

@vinny-sabatini

/kind bug

What versions of software are you using?

Operating System:
MacOS

Output of odo version:

$ odo version
odo v3.0.0-alpha3 (77ff2b89d)

Server: https://my.openshift.cluster:6443
Kubernetes: v1.23.5+3afdacb

How did you run odo exactly?

I started a new project using odo init. I used the Go starter project and added a sleep before starting the web server. I ran the odo dev command, and when the odo said it was running, I tried to access the endpoint before the duration of the sleep. I also tried to access the endpoint multiple times after the sleep.

The intention of the sleep is to simulate if the container takes some time to initialize and reach a ready state, which could be handled by a readiness probe if it were running in Kubernetes. I originally experienced this behavior with a Java Spring Boot application that took about 10 seconds to reach a ready state.

Actual behavior

The first request returned immediately with an empty reply from server. After the duration of the sleep, some requests were successful, but others would occasionally timeout with a connection reset by peer.

Expected behavior

  • I think odo should wait until the container is listening on the intended port before stating the application was ready
  • I would not expect intermittent connection timeouts when the application is running

Any logs, error output, etc?

Here is the odo output, note the first error is from when the first request came through (before the sleep duration completed), the second error is from an intermittent error:

$ odo dev
  __
 /  \__     Developing using the app Devfile
 \__/  \    Namespace: vinny-test-odo
 /  \__/    odo version: v3.0.0-alpha3
 \__/

↪ Deploying to the cluster in developer mode
 ✓  Waiting for Kubernetes resources [16s]
 ✓  Syncing files into the container [726ms]
 ✓  Building your application in container on cluster (command: build) [3s]
 •  Executing the application (command: run)  ...

Your application is now running on the cluster
 - Forwarding from 127.0.0.1:40001 -> 8080

Watching for changes in the current directory /Users/vinny/projects/odo-testing
Press Ctrl+c to exit `odo dev` and delete resources from the cluster

E0624 16:53:03.016599    9294 portforward.go:400] an error occurred forwarding 40001 -> 8080: error forwarding port 8080 to pod 3b77b1f3d378f912ec93eda422f7bd5fe99f63dd63466249ae41364edb59effe, uid : port forward into network namespace "/var/run/netns/ea2bbe59-8ea2-40f2-aca4-01228c6072f7": failed to connect to localhost:8080 inside namespace 3b77b1f3d378f912ec93eda422f7bd5fe99f63dd63466249ae41364edb59effe: dial tcp [::1]:8080: connect: connection refused
E0624 16:54:20.148247    9294 portforward.go:340] error creating error stream for port 40001 -> 8080: Timeout occurred

Here is the output from the failed curl request:

$ # First request before sleep
$ curl -vvv 127.0.0.1:40001
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 40001 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:40001
> User-Agent: curl/7.64.1
> Accept: */*
>
* Empty reply from server
* Connection #0 to host 127.0.0.1 left intact
curl: (52) Empty reply from server
* Closing connection 0

$ # Intermittent timeout request
$ curl -vvv http://127.0.0.1:40001
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 40001 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:40001
> User-Agent: curl/7.64.1
> Accept: */*
>
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

Metadata

Metadata

Assignees

Labels

estimated-size/S (5-10)Rough sizing for Epics. Less then one sprint of work for one personkind/bugCategorizes issue or PR as related to a bug.priority/HighImportant issue; should be worked on before any other issues (except priority/Critical issue(s)).

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions