Skip to content

[supervisor] fix ports forwarding hangs issue #20841

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

Merged
merged 4 commits into from
May 27, 2025
Merged

Conversation

mustard-mh
Copy link
Contributor

@mustard-mh mustard-mh commented May 26, 2025

Description

Related Issue(s)

Fixes CLC-1313

How to test

  • Start a workspace in preview env
  • Exec for p in {1230..1270}; do python3 -m http.server $p & done
  • Make sure ports feature is working well. like: gp ports list

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • /werft preemptible
    Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@@ -772,14 +778,14 @@ func (pm *Manager) Subscribe() (*Subscription, error) {
sub := &Subscription{updates: make(chan []*api.PortsStatus, 5)}
var once sync.Once
sub.Close = func() error {
pm.mu.Lock()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sub.Close and updateState both need mutex, which makes a dead lock

requests: make(chan *exposePortRequest, 30),
localExposedNotice: make(chan struct{}, 30),
// allow clients to submit 3000 expose requests without blocking
requests: make(chan *exposePortRequest, 3000),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ports expose requests more than 30 at the same time will make updateState hangs, and hold mutex forever

@roboquat roboquat added size/M and removed size/S labels May 26, 2025
@mustard-mh mustard-mh force-pushed the hw/port-forwarding branch from 76d4f27 to a720018 Compare May 26, 2025 13:02
Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes LGTM, tests are green ✔️

Thank you for this fix @mustard-mh ! 🙏

@roboquat roboquat merged commit 3f611bf into main May 27, 2025
34 checks passed
@roboquat roboquat deleted the hw/port-forwarding branch May 27, 2025 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants