lpereira / lwan

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

Core dump at first run #134

Closed xyproto closed 8 years ago

xyproto commented 8 years ago

Hi,

This is on 64-bit Arch Linux with gcc 5.3.0.

$ git clone git@github.com:lpereira/lwan.git
Cloning into 'lwan'...
remote: Counting objects: 6077, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6077 (delta 0), reused 0 (delta 0), pack-reused 6074
Receiving objects: 100% (6077/6077), 2.31 MiB | 1.57 MiB/s, done.
Resolving deltas: 100% (4163/4163), done.
Checking connectivity... done.
$ cd lwan 
~/checkout/lwan% ls
CMakeLists.txt  README.md  freegeoip/  lwan.conf     test.lua     testrunner.conf  wwwroot/
COPYING         common/    lwan/       techempower/  testrunner/  tools/
$ mkdir build
$ cd build
$ cmake .. -GNinja
-- The C compiler identification is GNU 5.3.0
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- No build type selected, defaulting to Debug
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.8") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Performing Test HAVE_BUILTIN_CPU_INIT
-- Performing Test HAVE_BUILTIN_CPU_INIT - Success
-- Performing Test HAVE_BUILTIN_CLZLL
-- Performing Test HAVE_BUILTIN_CLZLL - Success
-- Performing Test HAVE_BUILTIN_MUL_OVERFLOW
-- Performing Test HAVE_BUILTIN_MUL_OVERFLOW - Success
-- Performing Test HAVE_STATIC_ASSERT
-- Performing Test HAVE_STATIC_ASSERT - Success
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- libc has clock_gettime(). Good.
-- tcmalloc found: /usr/lib64/libtcmalloc_minimal.so
-- Performing Test HAS_IMMEDIATE_BINDING
-- Performing Test HAS_IMMEDIATE_BINDING - Success
-- Performing Test HAS_READ_ONLY_GOT
-- Performing Test HAS_READ_ONLY_GOT - Success
-- Valgrind headers not found -- disabling valgrind support
-- Looking for include file sys/epoll.h
-- Looking for include file sys/epoll.h - found
-- Looking for rawmemchr
-- Looking for rawmemchr - found
-- Looking for mempcpy
-- Looking for mempcpy - found
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for modules 'luajit>=2.0;luajit<=2.0.999'
--   
--   
-- Checking for modules 'lua>=5.1.0;lua<=5.1.999'
--   
-- Checking for modules 'lua51>=5.1.0;lua51<=5.1.999'
--   
--   
-- Checking for modules 'lua5.1>=5.1.0;lua5.1<=5.1.999'
--   Found lua5.1, version 5.1.5
--   Found lua5.1, version 5.1.5
-- Building with Lua support using lua5.1;m
-- Found PythonInterp: /usr/bin/python (found version "3.5.1") 
-- Checking for module 'sqlite3>=3.6.20'
--   Found sqlite3, version 3.11.1
-- Found MySQL includes at /usr/include/mysql
-- Found MySQL client library at /usr/lib64/libmysqlclient.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/afr/checkout/lwan/build
$ ls
CMakeCache.txt  build.ninja          common/     lwan/        techempower/
CMakeFiles/     cmake_install.cmake  freegeoip/  rules.ninja  testrunner/
$ ninja
[43/43] Linking C executable techempower/techempower
$ ls
CMakeCache.txt  build.ninja          common/     lwan/         rules.ninja   testrunner/
CMakeFiles/     cmake_install.cmake  freegeoip/  mime-types.h  techempower/
$ cd techempower 
$ ls
CMakeFiles/  cmake_install.cmake  techempower*
$ ./techempower 
5581 lwan-job.c:83 lwan_job_thread_init() Initializing low priority job thread.
5581 lwan-tables.c:40 lwan_tables_init() Uncompressing MIME type table.
5581 lwan.c:64 lwan_module_init() Initializing module registry.
5581 lwan.c:405 setup_from_config() Loading configuration file: techempower.conf.
5581 lwan.c:556 lwan_init_with_config() Could not read config file, using defaults.
5581 lwan-response.c:76 lwan_response_init() Initializing default response.
5581 lwan.c:565 lwan_init_with_config() Initializing lwan web server.
5581 lwan.c:580 lwan_init_with_config() Using 8 threads, maximum 512 sockets per thread.
5581 lwan-thread.c:437 lwan_thread_init() Initializing threads.
5583 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #1.
5584 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #2.
5585 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #3.
5586 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #4.
5587 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #5.
5588 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #6.
5589 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #7.
5581 lwan-socket.c:233 lwan_socket_init() Initializing sockets.
5590 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #8.
5581 lwan-socket.c:152 listen_addrinfo() Listening on http://127.0.0.1:8080.
5581 techempower.c:347 main() Could not connect to the database.
zsh: abort (core dumped)  ./techempower
$ echo $?
134
$ gdb ./techempower 
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./techempower...done.
(gdb) r
Starting program: /home/afr/checkout/lwan/build/techempower/techempower 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
5620 lwan-job.c:83 lwan_job_thread_init() Initializing low priority job thread.
[New Thread 0x7ffff4a80700 (LWP 5624)]
5620 lwan-tables.c:40 lwan_tables_init() Uncompressing MIME type table.
5620 lwan.c:64 lwan_module_init() Initializing module registry.
5620 lwan.c:405 setup_from_config() Loading configuration file: techempower.conf.
5620 lwan.c:556 lwan_init_with_config() Could not read config file, using defaults.
5620 lwan-response.c:76 lwan_response_init() Initializing default response.
5620 lwan.c:565 lwan_init_with_config() Initializing lwan web server.
5620 lwan.c:580 lwan_init_with_config() Using 8 threads, maximum 512 sockets per thread.
5620 lwan-thread.c:437 lwan_thread_init() Initializing threads.
[New Thread 0x7ffff427f700 (LWP 5625)]
5625 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #1.
[New Thread 0x7ffff3a7e700 (LWP 5626)]
5626 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #2.
[New Thread 0x7ffff327d700 (LWP 5627)]
5627 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #3.
[New Thread 0x7ffff2a7c700 (LWP 5628)]
5628 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #4.
[New Thread 0x7ffff227b700 (LWP 5629)]
5629 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #5.
[New Thread 0x7ffff1a7a700 (LWP 5630)]
5630 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #6.
[New Thread 0x7ffff1279700 (LWP 5631)]
5631 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #7.
[New Thread 0x7ffff0a78700 (LWP 5632)]
5620 lwan-socket.c:233 lwan_socket_init() Initializing sockets.
5632 lwan-thread.c:335 thread_io_loop() Starting IO loop on thread #8.
5620 lwan-socket.c:152 listen_addrinfo() Listening on http://127.0.0.1:8080.
5620 techempower.c:347 main() Could not connect to the database.

Thread 1 "techempower" received signal SIGABRT, Aborted.
0x00007ffff57342a8 in raise () from /usr/lib/libc.so.6
(gdb) bt full
#0  0x00007ffff57342a8 in raise () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x00007ffff573572a in abort () from /usr/lib/libc.so.6
No symbol table info available.
#2  0x000000000042dd75 in lwan_status_critical_debug (file=0x441e80 "../techempower/techempower.c", 
    line=347, func=0x442086 <__FUNCTION__.4975> "main", fmt=0x442020 "Could not connect to the database")
    at ../common/lwan-status.c:231
No locals.
#3  0x0000000000407b62 in main () at ../techempower/techempower.c:347
        url_map = {{handler = 0x406ebd <json>, data = 0x0, prefix = 0x44208b "/json", prefix_len = 0, 
            flags = 0, module = 0x0, args = 0x0, authorization = {realm = 0x0, password_file = 0x0}}, {
            handler = 0x407078 <db>, data = 0x0, prefix = 0x442091 "/db", prefix_len = 0, flags = 0, 
            module = 0x0, args = 0x0, authorization = {realm = 0x0, password_file = 0x0}}, {
            handler = 0x407147 <queries>, data = 0x0, prefix = 0x442095 "/queries", prefix_len = 0, 
            flags = 0, module = 0x0, args = 0x0, authorization = {realm = 0x0, password_file = 0x0}}, {
            handler = 0x407329 <plaintext>, data = 0x0, prefix = 0x44209e "/plaintext", prefix_len = 0, 
            flags = 0, module = 0x0, args = 0x0, authorization = {realm = 0x0, password_file = 0x0}}, {
            handler = 0x407925 <fortunes>, data = 0x0, prefix = 0x4420a9 "/fortunes", prefix_len = 0, 
            flags = 0, module = 0x0, args = 0x0, authorization = {realm = 0x0, password_file = 0x0}}, {
            handler = 0x0, data = 0x0, prefix = 0x0, prefix_len = 0, flags = 0, module = 0x0, args = 0x0, 
            authorization = {realm = 0x0, password_file = 0x0}}}
        l = {url_map_trie = {root = 0x0, free_node = 0x413c2b <destroy_urlmap>}, conns = 0xedc000, 
          thread = {threads = 0xefc000, max_fd = 512, count = 8}, module_registry = 0xec6000, config = {
            listener = 0x442c00 "localhost:8080", error_template = 0x0, keep_alive_timeout = 15, 
            expires = 604800, n_threads = 0, quiet = false, reuse_port = false, proxy_protocol = false}, 
          main_socket = 27}
        __FUNCTION__ = "main"
(gdb)
lpereira commented 8 years ago

This is on purpose: abort() is being called since it can't connect to the database server. The techempower executable is supposed to be used for the TechEmpower Web Framework benchmarks, and requires a setup of their environment.

xyproto commented 8 years ago

I see. It's a bit unusual to abort() instead of writing to stderr and exiting with an error code >0.

bonog commented 8 years ago

fix it pls........

bonog commented 8 years ago

133

bonog commented 8 years ago

48