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

defer cancel #2937

Closed
starzhanganz opened this issue Jun 2, 2022 · 2 comments
Closed

defer cancel #2937

starzhanganz opened this issue Jun 2, 2022 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@starzhanganz
Copy link

starzhanganz commented Jun 2, 2022

Description

Found an issue if defer the cancel here: link
This application won't be interrupted if the gRPC or collecter server is not reachable, and that will cause the process can't be killed.

Environment

  • OS: [Mac]
  • Architecture: [14.2]
  • Go Version: [1.18]
  • opentelemetry-go version: [e.g. v0.14.0, 3c7face]

Steps To Reproduce

  1. Start a collector on local running on local port localhost:4317

Example of the Docker-composer code to start the service:


services:
  otel-collector:
    container_name: otel-collector
    image: otel/opentelemetry-collector-contrib:latest
    command: "--config=/etc/collector-config.yaml"
    volumes:
      - ./collector-config.yaml:/etc/collector-config.yaml
    ports:
      - "1888:1888"   # pprof extension
      - "8888:8888"   # Prometheus metrics exposed by the collector
      - "4317:4317"   # OTLP gRPC receiver
    networks:
      - otel
    depends_on:
      - jaeger
      - .......
 
  1. copy code from https://github.com/open-telemetry/opentelemetry-go/blob/main/example/otel-collector/main.go, and change the port to localhost:4317
  2. Run 'go run .'
  3. it should start sending test data
  4. change the port to some port that doesn't exist, i.e. localhost:43171
  5. Process hangs at "2022/06/02 09:58:29 Waiting for connection...", can't interrupt by press ctrl+c

Expected behavior

the process should be able to be interrupted by press ctrl+c

@dmathieu
Copy link
Member

dmathieu commented Jun 2, 2022

Hi,

Thank you for reporting this issue. It is due to trying to open the gRPC connection without a timeout. So when the endpoint doesn't respond, the process blocks and waits forever.

I have opened #2939 as a fix.

@MrAlias
Copy link
Contributor

MrAlias commented Jun 2, 2022

Fixed in #2939, closing.

@MrAlias MrAlias closed this as completed Jun 2, 2022
@pellared pellared added this to the untracked milestone Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants