lpereira / lwan

Experimental, scalable, high performance HTTP server
https://lwan.ws
GNU General Public License v2.0
5.94k stars 548 forks source link

Illegal instruction (core dumped) in latest docker image #346

Closed haliliceylan closed 2 years ago

haliliceylan commented 2 years ago

i am using docker run --rm -P -v $(pwd):/html ghcr.io/lpereira/lwan -r /html

its giving this error

Ekran Resmi 2022-05-09 18 43 03

and inside of lwan.conf

# Timeout in seconds to keep a connection alive.
keep_alive_timeout = 15

# Set to true to not print any debugging messages. (Only effective in
# release builds.)
quiet = false

# Value of "Expires" header. Default is 1 month and 1 week.
expires = 1M 1w

# Number of I/O threads. Default (0) is number of online CPUs.
threads = 0

# Disable HAProxy's PROXY protocol by default. Only enable if needed.
proxy_protocol = false

# Enable straitjacket by default. The `drop_capabilities` option is `true`
# by default.  Other options may require more privileges.
straitjacket

listener *:8080 {
    serve_files / {
            path = ./wwwroot

            # When requesting for file.ext, look for a smaller/newer file.ext.gz,
            # and serve that instead if `Accept-Encoding: gzip` is in the
            # request headers.
            serve precompressed files = true
    }
}

basically, i want to serve my static files with lwan. i do not edit conf file, its coming from original docker image

lpereira commented 2 years ago

Is the CPU you're running the container the same one the container was built for?

On Mon, May 9, 2022, at 8:44 AM, Halil İbrahim ceylan wrote:

i am using docker run --rm -P -v $(pwd):/html ghcr.io/lpereira/lwan -r /html

its giving this error Ekran Resmi 2022-05-09 18 43 03 https://user-images.githubusercontent.com/33789758/167446875-32811c35-d111-41b6-839d-a63fe006a86a.png

and inside of lwan.conf

`# Timeout in seconds to keep a connection alive. keep_alive_timeout = 15

Set to true to not print any debugging messages. (Only effective in

release builds.)

quiet = false

Value of "Expires" header. Default is 1 month and 1 week.

expires = 1M 1w

Number of I/O threads. Default (0) is number of online CPUs.

threads = 0

Disable HAProxy's PROXY protocol by default. Only enable if needed.

proxy_protocol = false

Enable straitjacket by default. The drop_capabilities option is true

by default. Other options may require more privileges.

straitjacket

listener *:8080 { serve_files / { path = ./wwwroot

        # When requesting for file.ext, look for a smaller/newer file.ext.gz,
        # and serve that instead if `Accept-Encoding: gzip` is in the
        # request headers.
        serve precompressed files = true
}

} ` basically, i want to serve my static files with lwan.

— Reply to this email directly, view it on GitHub https://github.com/lpereira/lwan/issues/346, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADVGJC3YCWIBRL34UMUHDVJEXFBANCNFSM5VOWKBWA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

haliliceylan commented 2 years ago

i checked, they are same.

image
lpereira commented 2 years ago

Are you building this in the same computer?

x86_64 is just the architecture. You'll get an invalid instruction if you build for a particular CPU but use it in another that lacks some instruction. If you're building Lwan in the same computer that is running the container, then this doesn't matter that much. But if you're running on a different computer, then this might be a bug in Lwan CPU detection code.

Are you familiar with gdb to obtain a backtrace where Lwan crashes so I can see what needs fixed?

On Tue, May 10, 2022, at 3:05 AM, Halil İbrahim ceylan wrote:

i checked, they are same. image https://user-images.githubusercontent.com/33789758/167604292-9ffc4ed0-5876-4d52-8d9e-03bb162b6c1d.png

— Reply to this email directly, view it on GitHub https://github.com/lpereira/lwan/issues/346#issuecomment-1122187757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADVGJMXEJHVWVV3XETSBTVJIYF5ANCNFSM5VOWKBWA. You are receiving this because you commented.Message ID: @.***>

haliliceylan commented 2 years ago

As you can see I'm not building this image, I'm directly using from ghcr.io

do i need to build to use image

I thought there are some ready images building by you in ghrc.io

Of course i can trace with gdb, is there any instructions for that ?

image: ghcr.io/lpereira/lwan

lpereira commented 2 years ago

I'm trying to understand how to reproduce the issue and fix it. I'm asking these questions to try and pinpoint the cause, because this works on my machines.

Have you tried using a debugger like I asked? The backtrace will be useful.

On Fri, May 13, 2022, at 11:35 PM, Halil İbrahim ceylan wrote:

As you can see I'm not building this image, I'm directly using from hub.docker.com

do i need to build to use image

İf is this the case, we can close the issue because i did not build

I thought there are some ready images building by you in hub.docker.com(actually github docker images)

— Reply to this email directly, view it on GitHub https://github.com/lpereira/lwan/issues/346#issuecomment-1126654871, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADVGNKBT67GHCJBJQUPI3VJ5CUZANCNFSM5VOWKBWA. You are receiving this because you commented.Message ID: @.***>

haliliceylan commented 2 years ago

ok, so i am trying to backtrace inside container, but backtrace command is not found. i tried to install "apk update && apk add alpine-sdk" but i can not trace inside container. do you have any walkthrough for that ?

also this is my cpuinfo, (one of the cores)

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 62
model name  : Intel(R) Xeon(R) CPU E5-2697 v2 @ 2.70GHz
stepping    : 4
microcode   : 0x42d
cpu MHz     : 2693.250
cache size  : 30720 KB
physical id : 0
siblings    : 1
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 ss syscall nx rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cpuid_fault pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust smep arat flush_l1d arch_capabilities
bugs        : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips    : 5386.50
clflush size    : 64
cache_alignment : 64
address sizes   : 43 bits physical, 48 bits virtual
power management:
haliliceylan commented 2 years ago

ping

lpereira commented 2 years ago

I don't use containers, I don't know how to help you. Since this is a CPU instruction related issue, have you tried building outside the container to see if the problem persists?

On Sun, May 22, 2022, at 4:10 PM, Halil İbrahim ceylan wrote:

ping

— Reply to this email directly, view it on GitHub https://github.com/lpereira/lwan/issues/346#issuecomment-1134012988, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADVGIDL75QZLCDIECOBIDVLK5GPANCNFSM5VOWKBWA. You are receiving this because you commented.Message ID: @.***>

lpereira commented 2 years ago

Anyway, your CPU doesn't seem to have AVX2 instructions, and it's probable that the machine that built Lwan has that, the build system picked it up and the compiler generated code using those instructions.

You'll need to build Lwan from source rather than using the ready-made image if you want to run it in this machine.

On Sun, May 22, 2022, at 4:16 PM, L. Pereira wrote:

I don't use containers, I don't know how to help you. Since this is a CPU instruction related issue, have you tried building outside the container to see if the problem persists?

On Sun, May 22, 2022, at 4:10 PM, Halil İbrahim ceylan wrote:

ping

— Reply to this email directly, view it on GitHub https://github.com/lpereira/lwan/issues/346#issuecomment-1134012988, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADVGIDL75QZLCDIECOBIDVLK5GPANCNFSM5VOWKBWA. You are receiving this because you commented.Message ID: @.***>

lpereira commented 2 years ago

OK, I released a new container version that should build Lwan using more generic instructions and it should work fine on your computer now. If it doesn't, then we'll have to debug this because it's probably actually a bug in Lwan.

Please let me know if v0.5 works for you.

On Mon, May 23, 2022, at 12:30 AM, L. Pereira wrote:

Anyway, your CPU doesn't seem to have AVX2 instructions, and it's probable that the machine that built Lwan has that, the build system picked it up and the compiler generated code using those instructions.

You'll need to build Lwan from source rather than using the ready-made image if you want to run it in this machine.

On Sun, May 22, 2022, at 4:16 PM, L. Pereira wrote:

I don't use containers, I don't know how to help you. Since this is a CPU instruction related issue, have you tried building outside the container to see if the problem persists?

On Sun, May 22, 2022, at 4:10 PM, Halil İbrahim ceylan wrote:

ping

— Reply to this email directly, view it on GitHub https://github.com/lpereira/lwan/issues/346#issuecomment-1134012988, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADVGIDL75QZLCDIECOBIDVLK5GPANCNFSM5VOWKBWA. You are receiving this because you commented.Message ID: @.***>

haliliceylan commented 2 years ago

v0.5 is working perfectly, thanks !