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

Go client connection initialisation to an empty event stream is slow #10636

Closed
h3yduck opened this issue May 21, 2021 · 1 comment · Fixed by #10637
Closed

Go client connection initialisation to an empty event stream is slow #10636

h3yduck opened this issue May 21, 2021 · 1 comment · Fixed by #10637
Labels
theme/api HTTP API and SDK issues theme/events Issues related to events type/bug

Comments

@h3yduck
Copy link
Contributor

h3yduck commented May 21, 2021

Nomad version

Nomad v1.1.0 (2678c36)

Operating system and Environment details

  • most probably affects all operating systems (tested on macOS Big Sur and debian:buster Docker image)
  • most probably affects all client libraries where the HTTP client waits for any response (at least HTTP headers) before returning the HTTP body to the caller (tested on go version go1.16 darwin/amd64 and go version go1.16.2 linux/amd64)

Issue

Go client connection initialisation to an empty event stream takes 30 seconds: client waits until first heartbeat before returning.

Reproduction steps

  1. Start Nomad in dev mode with nomad agent -dev
  2. Connect to Nomad event stream's job topic having 0 Nomad jobs with time go run .:
    package main
    
    import (
    	"context"
    
    	"github.com/hashicorp/nomad/api"
    )
    
    func main() {
    	nomadClient, _ := api.NewClient(&api.Config{})
    	eventStreamClient := nomadClient.EventStream()
    	topics := map[api.Topic][]string{
    		api.TopicJob: {"*"},
    	}
    	eventStreamClient.Stream(context.Background(), topics, 0, nil)
    }

Expected Result

eventStreamClient.Stream call returns in a reasonable amount of time (< 1s).

Actual Result

eventStreamClient.Stream call returns after 30s.

@tgross tgross added the theme/events Issues related to events label May 21, 2021
@tgross tgross added this to Needs Triage in Nomad - Community Issues Triage via automation May 21, 2021
@tgross tgross added the theme/api HTTP API and SDK issues label May 21, 2021
Nomad - Community Issues Triage automation moved this from Needs Triage to Done May 21, 2021
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme/api HTTP API and SDK issues theme/events Issues related to events type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants