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 generate ./... fails with a segmentation fault #4155

Open
sid-maddy opened this issue Jan 5, 2025 · 6 comments
Open

go generate ./... fails with a segmentation fault #4155

sid-maddy opened this issue Jan 5, 2025 · 6 comments
Assignees
Labels

Comments

@sid-maddy
Copy link

sid-maddy commented Jan 5, 2025

It seems the deps job in the lint workflow has been silently failing, due to enumer exiting with a segmentation fault (and protoc not being installed or available on the PATH).
Most recent failure as of this comment: https://github.com/grafana/k6/actions/runs/12598439266/job/35113278833#step:5:594

Originally posted by @sid-maddy in #2998

Output of go generate ./...: https://github.com/user-attachments/files/18309644/go-generate-output.txt

grafana/k6 branch: master
Go version: 1.23

@oleiade
Copy link
Member

oleiade commented Jan 6, 2025

I have been unable to reproduce with go 1.22.6:
Image

Trying with go 1.23.

@oleiade
Copy link
Member

oleiade commented Jan 6, 2025

Unable to reproduce with v1.23 either:
Image

@oleiade
Copy link
Member

oleiade commented Jan 6, 2025

I'm using the latest up-to-date version of mac OS, with go 1.23.4, and have freshly reinstalled enumer and easyjson. Can you tell us more about your system, toolchain, and how we might be able to reproduce this SEGFAULT please? 🙇🏻

@sid-maddy
Copy link
Author

The output I shared in the issue description was using Ubuntu 24.04, Go v1.23.4 (installed using https://mise.jdx.dev).

I'm able to reproduce the issue using macOS Sequoia (15.1.1), Go v1.22.10 and v1.23.4 (both re-installed using mise as well).

With Go v1.22.10: https://github.com/user-attachments/files/18317957/go-generate-output-go1.22.10-macos.txt
With Go v1.23.4: https://github.com/user-attachments/files/18318080/go-generate-output-go1.23.4_macos.txt

@sid-maddy
Copy link
Author

I'm also able to reproduce the issue using Go (v1.23.4) installed from Homebrew: https://github.com/user-attachments/files/18318275/go-generate-output-go1.23.4-homebrew-macos.txt

@oleiade
Copy link
Member

oleiade commented Jan 6, 2025

Thanks for the context folks 🙇🏻

I was indeed able to reproduce. Dockerfile for reference:

FROM ubuntu:latest

# Install dependencies
RUN apt-get update && apt-get install -y \
    curl \
    git \
    build-essential \
    unzip \
    && rm -rf /var/lib/apt/lists/*

# Install Go (latest version)
RUN curl -OL https://go.dev/dl/go1.23.4.linux-amd64.tar.gz && \
    tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz && \
    rm go1.23.4.linux-amd64.tar.gz

# Install `protoc`
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v24.4/protoc-24.4-linux-x86_64.zip && \
    unzip protoc-24.4-linux-x86_64.zip -d /usr/local && \
    rm protoc-24.4-linux-x86_64.zip

# Set environment variables
ENV PATH="/usr/local/go/bin:$PATH" GOPATH="/root/go"
ENV PATH="$GOPATH/bin:$PATH"

# Create directory for project
WORKDIR /usr/src/app

# Install `protoc-gen-go` plugin for Go
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

# Install dependencies
RUN go install github.com/mailru/easyjson/[email protected]
RUN go install github.com/alvaroloes/[email protected]
RUN go install mvdan.cc/gofumpt@latest

# Download k6's latest master
RUN git clone https://github.com/grafana/k6

# Change directory to k6
WORKDIR /usr/src/app/k6

# Run go generate to assert whether it segfaults
RUN go generate ./...

Investigating some more 🔍

@oleiade oleiade added bug and removed triage labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants