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

Build and run binary return code 137 #1161

Open
3 of 7 tasks
theaveasso opened this issue Mar 31, 2024 · 3 comments
Open
3 of 7 tasks

Build and run binary return code 137 #1161

theaveasso opened this issue Mar 31, 2024 · 3 comments

Comments

@theaveasso
Copy link

theaveasso commented Mar 31, 2024

Description

I want to start testing kafka producer but always fail to run from binary when I adding this package. If I run it using go run . it works perfectly fine.

  • Operating system: MacOS M1
  • Kafka version:
    I ran it on docker, using docker compose
version: '3'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:7.4.4
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
    ports:
      - 22181:2181
  kafka:
    image: confluentinc/cp-kafka:7.4.4
    depends_on:
      - zookeeper
    ports:
      - 29092:29092
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1

Here is my code

func main() {
	producer, err := kafka.NewProducer(&kafka.ConfigMap{
        "bootstrap.servers": "localhost:29092",
    })
	if err != nil {
		log.Println(err)
	}
    fmt.Println("hello world")

    defer producer.Close()
}

/bin/sh: line 1: 55716 Killed: 9
Error: Producer process terminated with code 137

How to reproduce

  1. Create a simple main.go
  2. Create a new Producer
func main() {
	producer, err := kafka.NewProducer(&kafka.ConfigMap{
        "bootstrap.servers": "localhost:29092",
    })
	if err != nil {
		log.Println(err)
	}
    fmt.Println("hello world")

    defer producer.Close()
}
  1. Run build
go build -o ./bin/producer ./main.go
./bin/producer

Checklist

Please provide the following information:

  • confluent-kafka-go and librdkafka version (LibraryVersion()):
  • Apache Kafka broker version:
  • Client configuration: ConfigMap{...}
  • Operating system:
  • Provide client logs (with "debug": ".." as necessary)
  • Provide broker log excerpts
  • Critical issue
@milindl
Copy link
Contributor

milindl commented Apr 3, 2024

Seems similar to #1092. It seems to be a macOS specific thing (code 137 is SIGKILL). It seems to be a consequence of the binary being unsigned... Something like in this issues golang/go#63997 (comment) (not the exact same thing, but something similar). There are a lot of issues around macOS arm64 requiring a signed binary.

I can suggest to try signing the binary manually as described in the ticket above^.

Other way might be to try something as given on this page: https://github.molgen.mpg.de/pages/bs/macOSnotes/mac/mac_procs_unsigned.html

I could not try either of these methods since I'm using a Linux machine. If either of those works for you, please let me know so I will update the READMEs to highlight this particular issue.

@theaveasso
Copy link
Author

@milindl I have tried, but still the same error.

spctl --add ./bin/producer

@milindl
Copy link
Contributor

milindl commented Apr 8, 2024

What about the codesign method shown in the github comment?

Also could you check /var/log/system.log after the kill of the application? It might contain some more useful hints for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants