lightpanda-io / browser

The open-source browser made for headless usage
https://lightpanda.io
GNU Affero General Public License v3.0
117 stars 0 forks source link

avx: illegal instruction on Intel Celeron #264

Closed fjebaker closed 2 weeks ago

fjebaker commented 2 weeks ago

Hi! First of all this browser is absolutely excellent, thanks for creating and sharing it!

On one of my machines I hit an illegal instruction when trying to run the nightly binary:

user@virgil: ~ % ./lightpanda-get-x86_64-linux 
zsh: illegal hardware instruction  ./lightpanda-get-x86_64-linux

Looking with gdb

(gdb) r
Starting program: /home/user/lightpanda-get-x86_64-linux
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
compiler_rt.memmove.memmove (
    dest=0x2939010 <std::Cr::(anonymous namespace)::make<std::Cr::locale::__imp, unsigned int>(unsigned int)::buf+304> "C", src=0x10c4d32 "C", n=<optimized out>)
    at /opt/hostedtoolcache/zig/0.13.0/x64/lib/compiler_rt/memmove.zig:24
24  /opt/hostedtoolcache/zig/0.13.0/x64/lib/compiler_rt/memmove.zig: No such file or directory.
(gdb) x/10ai $pc-10
   0x287222f <compiler_rt.memmove.memmove+735>: clc
   0x2872230 <compiler_rt.memmove.memmove+736>: add    $0xfffffffffffffff8,%rdx
   0x2872234 <compiler_rt.memmove.memmove+740>: mov    %rdx,%rcx
   0x2872237 <compiler_rt.memmove.memmove+743>: 
    jne    0x28721e0 <compiler_rt.memmove.memmove+656>
=> 0x2872239 <compiler_rt.memmove.memmove+745>: vzeroupper
   0x287223c <compiler_rt.memmove.memmove+748>: ret
   0x287223d:   int3
   0x287223e:   int3
   0x287223f:   int3
   0x2872240 <compiler_rt.memcmp.memcmp>:   test   %rdx,%rdx

It's specifically the vzeroupper instruction. The server I am trying to use lightpanda on is quite old and small, and the CPU is not very capable (Intel Celeron). It does not have avx capabilities, which is why this is failing.

I can imagine non-AVX capable CPUs are probably not your target (given https://github.com/lightpanda-io/browser/issues/256), but flagging this just in case they are.

Would you also happen to know how to build the browser without avx capabilities? I can't build natively since the machine is too constrained -- the compile takes at least 4 hours (I gave up after 4).

krichprollsch commented 2 weeks ago

Hello @fjebaker, Thank you for the issue and trying to use Lightpanda!

About the issue itself, #256 was about setting a specific list of CPU capabilities with -Dcpu=x86_64_v3+aes instead of using a list generated at build time from the machine itself. I did that because I had the same kind of issue: my CPU don't have the sha instruction at the difference of Github's CI servers.

What I can do is to force a -Dcpu=x86_64 [1] for the nightly build. I think it will improve the CPU support and I hope, fix your use case. The counter part is is less performance on modern CPUs.

IMO it's more important to allow more users to test the browser. If we want improve perf, we still can re-build the browser w/o this option.

krichprollsch commented 2 weeks ago

I forced a nightly build with the -Dcpu=x86_64 option. @fjebaker can you try this new version and let-me know if the issue persists? https://github.com/lightpanda-io/browser/releases/tag/nightly

Thanks!

fjebaker commented 2 weeks ago

Hi @krichprollsch thanks for seeing to this so quickly. I tested the new nightly binary and it works perfectly :+1:

Will close the issue as this is now all resolved. Thanks!

krichprollsch commented 2 weeks ago

Great news! If you have any question or issue, don't hesitate to open another issue or send me directly an email if you prefer (available on my GH's profile). I would love to hear your feedback an know more about your use case.