Skip to content

timer-sense-light crashes after web server started #2

Closed
@codelast

Description

@codelast

subproject: timer-sense-light

When Mongoose web server embedded in the timer-sense-light started in a thread, it crashed immediately.
It seems that it's because of specifying the web-root for mongoose web server caused the problem, but don't konw why.

GDB debug info

[root@alarmpi deploy]# gdb timer_sense_light core.4929
GNU gdb (GDB) 7.10
Copyright (C) 2015 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 "armv6l-unknown-linux-gnueabihf".
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 timer_sense_light...done.

warning: core file may not match specified executable file.
[New LWP 4930]
[New LWP 4929]
[New LWP 4931]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/root/raspberry-pi/gpio/timer-sense-light/deploy/timer_sense_light /root/raspbe'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0001f634 in mg_mgr_poll (mgr=0xb6b5ce00, milli=1000) at src/3rd/mongoose.c:2857

2857 tmp = nc->next;
Current thread is 1 (Thread 0xb6b5d450 (LWP 4930)) bt
#0 0x0001f634 in mg_mgr_poll (mgr=0xb6b5ce00, milli=1000) at src/3rd/mongoose.c:2857
#1 0x00012f40 in threadWebHandler () at ./include/thread_web_handler.h:86
#2 0xb6f0d00c in start_thread () from /usr/lib/libpthread.so.0
#3 0xb6c2d718 in ?? () from /usr/lib/libc.so.6

Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) quit

GDB debug guide

  • turn on the core dump for Arch Linux ARM

    ulimit -c unlimited
    sysctl -w kernel.core_pattern=core

  • modify Makefile to include debugging info in the binary executable program

    DEBUG = YES

  • compile & run the program

    make && make install
    cd deploy/bin && ./run-timer-sense-light.sh

You'll find that a core.xxx(e.g. core.4929) file generated under the same dir as the timer-sense-light executable program.

  • run GDB

    gdb timer_sense_light core.xxx
    set args /root/raspberry-pi/gpio/timer-sense-light/deploy/conf/main.conf /root/raspberry-pi/gpio/timer-sense-light/deploy/conf/time-range.txt
    b mongoose.c:2855
    r
    n

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions