question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Local port forwarding failing

See original GitHub issue

Describe the issue:

I’m consistently getting “kubectl port forward failed” from port_forward_service using the standard KubeCluster class to create an ad hoc cluster. When this happens the port forward is successfully setup and I can connect via the port that is opened, but the is_comm_open check returns false. sock.connect_ex((ip, port)) is always returning code 22 which is essentially “invalid input”. If I change the is_comm_open check to:

if await is_comm_open("", local_port, retries=100):  # pass an empty string instead of localhost

it began to temporarily work, but after about 30 minutes that also began to fail.

Minimal Complete Verifiable Example:

I’m seeing this on a very basic setup (environment posted below):

pod_spec = make_pod_spec(image='ghcr.io/dask/dask:latest',
                         memory_limit='4G', memory_request='4G',
                         cpu_limit=1, cpu_request=1)

n_workers = 4
with KubeCluster(
    pod_template=pod_spec,
    name="test",
    n_workers=3
) as cluster:

Environment:

  • Dask version: 2022.9.1
  • Dask-kubernetes version: 2022.7.0
  • Python version: 3.8
  • Operating System: MacOS 12.6
  • Install method (conda, pip, source): conda

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
semnooijcommented, Oct 23, 2022

That seems to resolve it for me as well. I’d suggest the following instead of the explicit closure.

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
    result = sock.connect_ex((ip, port))
1reaction
jacobtomlinsoncommented, Oct 24, 2022

Thanks for looking at this @baswelsh I’d love to see a PR with this. Totally agree with @semnooij that a context manager is a nice way to handle this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What to do if port forwarding does not work - Keenetic
1. When setting up port forwarding, it is necessary to have a public IP address on the router's WAN interface through which it...
Read more >
Why Is Port Forwarding Not Working? Here's How To Fix
How To Fix Port Forwarding Not Working · Check for Errors in the Configuration Settings · Restart Your Router · Examine Internet Connection...
Read more >
Why port forwarding feature is not working on my Wi-Fi router ...
Step 1: Make sure the server is accessible from the internal network · Step 2: Check the port forwarding settings in the router....
Read more >
How To Troubleshoot Port Forwarding Issues
First, use the default port is working for remote connect (port 8080). Then, test the port you are trying to forward. If some...
Read more >
ssh local port forwarding not working [duplicate] - Super User
I have a computer in a location A, let's call it host-A. I have a computer in a location B (host-B) running an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found