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

Fails to start in minikube with "does not support all ... CPU features" / "Please rebuild the executable" #166

Open
dfuhry opened this issue Jan 15, 2024 · 4 comments

Comments

@dfuhry
Copy link

dfuhry commented Jan 15, 2024

The image runs fine for me in docker, with command:
docker run --rm -it ghcr.io/observabilitystack/geoip-api:latest.

However, when I try to run in minikube (kubernetes), with command:
kubectl create deployment --image ghcr.io/observabilitystack/geoip-api:latest geoip-test1

The pod terminates immediately in error, producing only the output:

The current machine does not support all of the following CPU features that are required by the image: [CX8, CMOV, FXSR, MMX, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT, LZCNT, AVX, AVX2, BMI1, BMI2, FMA].
Please rebuild the executable with an appropriate setting of the -march option.

In a full (non-minikube) kubernetes cluster when trying to run an older (2023-06) image, it terminates immediately with error:

/srv/geoip-api: CPU ISA level is lower than required

Suggestions online range from those related to the first error, e.g. "change -march=native to -march=x86-64", to running with different versions of libc. Are there any suggested workarounds to, or possible fixes for, the above errors?

@dfuhry
Copy link
Author

dfuhry commented Jan 16, 2024

I notice in the Dockerfile that the mvn command seems to specify build architecture native:

https://github.com/observabilitystack/geoip-api/blob/master/Dockerfile#L11C1-L11C1

The Graalvm JDK 17 release notes in the third bullet mention:

"Use -march=compatibility for best compatibility or -march=native for best performance if a native executable is deployed on the same machine or on a machine with the same CPU features."
https://www.graalvm.org/release-notes/JDK_17/

If this is indeed the issue I'm experiencing, then it seems adding a "compatibility" variant image, or switching builds to "compatibility" if there is no noticeable performance difference, would resolve it.

@dfuhry
Copy link
Author

dfuhry commented Jan 16, 2024

I built the project locally and was able to run the image in both docker and minikube.

However, I noticed among my build output, the line:

#11 27.20 Warning: The host machine does not support all features of 'x86-64-v3'. Falling back to '-march=compatibility' for best compatibility.

So the architecture of the built image can depend on that of the machine that builds it, at least in this case. My guess is that the above fallback does not happen on the machine that builds the published geoip-api images.

@tboeghk
Copy link
Member

tboeghk commented Jan 24, 2024

I'll change to build args. Thanks for the find!

@tboeghk
Copy link
Member

tboeghk commented Jan 24, 2024

Thanks for the PR! Accepted and I re-triggered todays release build. You should be able to use the release in approx. 1h.

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

No branches or pull requests

2 participants