Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ohNet crashes on QNAP ARM models
12-12-2017, 01:46 PM
Post: #1
ohNet crashes on QNAP ARM models
The change in this commit is causing ohNet to crash with a SIGSEGV when running MinimServer on a QNAP TS-119 and similar ARM-based models. Here is the crash information:

# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb6e66ffc, pid=5396, tid=2869281936
#
# JRE version: Java™ SE Embedded Runtime Environment (8.0_65-b17) (build 1.8.0_65-b17)
# Java VM: Java HotSpot™ Embedded Client VM (25.65-b01 mixed mode linux-arm )
# Problematic frame:
# C [libc.so.6+0xdfffc] backtrace+0x64


This happens when ohNet code throws an exception (for a timeout, not an error):
THROW Timeout from OpenHome/Thread.cpp:42 (th=TimerManager)

The Exception constructor calls Os::StackTraceInitialise, which calls backtrace() in libc.so and the backtrace() call produces a SIGSEGV. A number of MinimServer users with different QNAP ARM models have reported this crash when using the latest version of ohNet, so it seems that the backtrace() call doesn't work correctly in the QNAP firmware for these models.

I have used gdb to set a breakpoint in the backtrace() function. When stopped at the breakpoint, the gdb bt command prints the following:

#0 0xb6ed4fdc in backtrace () from /lib/libc.so.6
#1 0xab766384 in OsStackTraceInitialise () from /share/HDA_DATA/.qpkg/MinimServer/tmp/native/libohNet.so
#2 0xab6e8a70 in OpenHome::Exception::Exception () from /share/HDA_DATA/.qpkg/MinimServer/tmp/native/libohNet.so
#3 0xab7560b4 in OpenHome::Semaphore::Wait () from /share/HDA_DATA/.qpkg/MinimServer/tmp/native/libohNet.so
#4 0xab7585ec in OpenHome::TimerManager::Run () from /share/HDA_DATA/.qpkg/MinimServer/tmp/native/libohNet.so
#5 0xab758ed4 in OpenHome::MemberTranslator<OpenHome::TimerManager, void (OpenHome::TimerManager::*)()>::Thunk () from /share/HDA_DATA/.qpkg/MinimServer/tmp/native/libohNet.so
#6 0x00a07400 in ?? ()


Is the problem with the last entry #6? When backtrace() reaches this in its stack walk, could it throw a SIGSEGV?

Is this an ohNet problem or a backtrace() problem? The last valid entry in the stack trace is a TimerManager Thunk. Could this perhaps be malformed and causing backtrace() to throw a SIGSEGV?

Whatever the reason for the problem, ohNet shouldn't crash in this situation. Could the STACK_TRACE_ENABLE setting be removed from Linux builds until this problem is resolved?
Find all posts by this user
Quote this message in a reply
13-01-2018, 02:06 PM (This post was last modified: 13-01-2018 05:34 PM by simoncn.)
Post: #2
RE: ohNet crashes on QNAP ARM models
I see there has been a change to Makefile in this commit that avoids setting -DPLATFORM_LINUX for Qnap-specific builds (i.e., the platform variable contains Qnap).

I am not doing QNAP-specific builds and I would like to have the capability to build without the -DPLATFORM_LINUX option as a solution for the problem with MinimServer getting a SIGSEGV in backtrace().

A suitable solution would be to add a new option no_platform_linux=yes to the make command and change lines 305-308 of Makefile from:

Code:
ifeq (,$(findstring Qnap,$(platform)))
    # Enable pthread names for non-Qnap Linux platforms
    platform_cflags += -DPLATFORM_LINUX
endif

to:

Code:
ifneq (,$(findstring Qnap,$(platform)))
    # Disable pthread names for Qnap Linux platforms
    no_platform_linux = yes
endif
ifneq ($(no_platform_linux), yes)
    platform_cflags += -DPLATFORM_LINUX
endif

With this change, -DPLATFORM_LINUX would not be set for Qnap builds and would also not be set for builds with no_platform_linux=yes on the make command.
Find all posts by this user
Quote this message in a reply
15-01-2018, 01:53 PM
Post: #3
RE: ohNet crashes on QNAP ARM models
(13-01-2018 02:06 PM)simoncn Wrote:  I see there has been a change to Makefile in this commit that avoids setting -DPLATFORM_LINUX for Qnap-specific builds (i.e., the platform variable contains Qnap).

I am not doing QNAP-specific builds and I would like to have the capability to build without the -DPLATFORM_LINUX option as a solution for the problem with MinimServer getting a SIGSEGV in backtrace().

A suitable solution would be to add a new option no_platform_linux=yes to the make command and change lines 305-308 of Makefile from:

In hindsight, I'm not keen on using a platform define to control access to features that are not platform specific. We'll rework this to allow support for backtrace and thread naming to be specified on the command line.
Find all posts by this user
Quote this message in a reply
15-01-2018, 04:36 PM
Post: #4
RE: ohNet crashes on QNAP ARM models
Thanks, this sounds like the right approach.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: