Using Alpine linux docker image (node:12-alpine)
apk install graphicsmagick
Use the library to resize an image and it fails:
traps: gm[24562] trap invalid opcode ip:7fa6c4553048 sp:7ffe4b7b46c8 error:0
[2934835.125412] in png.so[7fa6c4553000+1000]
The host machine is ECS t3a:
cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 23
model : 1
model name : AMD EPYC 7571
stepping : 2
microcode : 0x8001227
cpu MHz : 2199.636
cache size : 512 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch topoext vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 clzero arat npt nrip_save
bugs : fxsave_leak sysret_ss_attrs null_seg
bogomips : 4399.27
TLB size : 2560 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management:
On Mon, 25 Nov 2019, EmlynB wrote:
We don't provide any pre-built binaries for Alpine Linux. This issue
should be reported to whoever is producing the binaries you are using
for Alpine Linux (in particular libpng). It seems like a machine
instruction produced in png.so is not compatible with your CPU. The
compiler might be targeting a different CPU.
Does your GraphicsMagick work for formats other than PNG?
Bob
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt
I agree it's likely something off with the CPU options of the compiled PNG library. What I can't determine is what - and I've not (yet) found a way to raise a bug against the Alpine package creator.
From what I can tell with alpine packages they should run on generic 64 bit CPUs.
I've simply changed my docker image from the alpine distro to a debian one and I'm back to a functional system.
If there's known issues between some of the flags used for specific parts of the PNG library on different CPUs, do you have a list?
Thanks,
On Mon, 25 Nov 2019, EmlynB wrote:
There are multiple ways to build libpng. It is also possible that
libpng source code has been patched. A compiler bug could easily
cause this sort of problem. Libpng is considered
performance-sensitive so there may have been use of maximum
optimizations.
Bob
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt
Thanks for your help. I'll find a way to raise it with alpine I guess; works for other linux distros.
This appears to be a build/platform specific issue. Even a corrupted byte in a file could cause this issue.