hyperion-project / hyperion.ng

The successor to Hyperion aka Hyperion Next Generation
https://hyperion-project.org/
MIT License
3.04k stars 377 forks source link

Segmentation fault #87

Closed NicoHood closed 8 years ago

NicoHood commented 8 years ago

I compiled hyperion for my raspberry 3 in arch and sometimes get a segmentation fault.

[alarm@alarmpi3 ~]$ /usr/bin/hyperiond /etc/hyperion/hyperion.config.json
INFO: Creating linear smoothing
HYPERION (CS) INFO: Created linear-smoothing(interval_ms=50;settlingTime_ms=200;updateDelay=0
BLACKBORDER INFO: threshold set to 0 (0)
BLACKBORDER INFO: mode:default
BLACKBORDER INFO: threshold set to 0 (0)
BLACKBORDER INFO: mode:default
PROTOCONNECTION INFO: Connecting to Hyperion: 127.0.0.1:19447
[HYPERIOND MAIN] <ERROR> Hyperion Daemon aborted
QtHttpServer started on port 8099 "Qt Static HTTP File Server"
KODICHECK ERROR: Kodi Connection error (0)
Segmentation fault (core dumped)

I only changed the number of leds to 25 and the adalight device:

    "device" :
    {
        "name"       : "MyHyperionConfig",
        "type"       : "adalight",
        "output"     : "/dev/ttyACM0",
        "VID"        : "0x2341",
        "PID"        : "0x8036",
        "rate"       : 115200,
        "colorOrder" : "rgb"
    },

SPI is not enabled, nor used. It is not even compiled in this binary I use.

I used this PKGBUILD (which is incomplete, but just for documentation):

# Maintainer: TODO

pkgname=hyperion
pkgver=r1160.0feb1d7
pkgrel=1
pkgdesc="An opensource 'AmbiLight' implementation"
arch=('armv6h' 'armv7h')
url="https://github.com/hyperion-project/hyperion.ng"
license=('MIT')

depends=('libusb' 'python' 'icu')
optdepends=('xorg-server: X11 grabbing')
makedepends=('git' 'cmake' 'qt5-base' 'qt5-serialport' 'avahi')
provides=('hyperion')
conflicts=('hyperion')
backup=('etc/hyperion.config.json')
source=('hyperion::git+https://github.com/hyperion-project/hyperion.ng#branch=master')
sha256sums=('SKIP')

pkgver() {
        cd "$srcdir/${pkgname%-git}"
        printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
        cd "${srcdir}/${pkgname%-git}"
        git submodule init
        git submodule update
  mkdir -p build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX="${pkgdir}/usr" -DPLATFORM=x86 -DCMAKE_BUILD_TYPE=Release -DUSE_SHARED_AVAHI_LIBS=ON ..
        make -j $(nproc)
}

package() {
        cd "${srcdir}/${pkgname%-git}/build"
        make install

        install -Dm 644 "${srcdir}/hyperion/config/hyperion.config.json.default" "${pkgdir}/etc/hyperion/hyperion.config.json"
        # TODO symlink service from make install service?
        install -Dm 644 "${srcdir}/hyperion/bin/service/hyperion.systemd.sh" "${pkgdir}/usr/lib/systemd/system/hyperiond.service"
}
redPanther commented 8 years ago

Same on ubuntu. There is a problem when connecting to kodi fails. Disable xbmccheck when not used together with kodi. This will be investigated later

NicoHood commented 8 years ago

But why do you need xbmc check at all? I use the kodi addon that streams the data to the localhost and all works fine. XBMC check never gave me any better expierience. Just asking to understand ;) Maybe it should be disabled by default if its not essentially important.

Edit: I tried to disable it, but I still get the segfault: Might be related to this as i am not sure if i disabled it correct.

        "xbmcVideoChecker" :
        {
                "enable" : false,
                "xbmcAddress" : "localhost",
                "xbmcTcpPort" : 9090,
                "grabVideo" : true,
                "grabPictures" : true,
                "grabAudio" : true,
                "grabMenu" : false,
                "grabPause" : false,
                "grabScreensaver" : true,
                "enable3DDetection" : true
        },
redPanther commented 8 years ago

Delete the section

redPanther commented 8 years ago

Enable flag is not implemented for kodi yet.

Read hyperiond.cpp for more details

NicoHood commented 8 years ago

Okay then the other issue I opened applies here. That should be added.

I tried removing it, but I still get a segfault (sometimes):

INFO: Creating linear smoothing
HYPERION (CS) INFO: Created linear-smoothing(interval_ms=50;settlingTime_ms=200;updateDelay=0
BLACKBORDER INFO: threshold set to 0 (0)
BLACKBORDER INFO: mode:default
BLACKBORDER INFO: threshold set to 0 (0)
BLACKBORDER INFO: mode:default
PROTOCONNECTION INFO: Connecting to Hyperion: 127.0.0.1:19447
[HYPERIOND MAIN] <ERROR> Hyperion Daemon aborted
Segmentation fault (core dumped)
redPanther commented 8 years ago

Plese use --debug for hyperiond, to get more details. App exit on error abort has issues too, I have a fix, but this is not commited atm.

Dont forget, this is a developer version. This works currently for the devs in the way they use it. In current state of development, this version hasn't the intention to work for everyone. It's ok when you try it from time to time, but expect to much until official testing stage is announced. I think it will take some month to get bleeding edge hyperion rock solid

penfold42 commented 8 years ago

Do you have a v4l grabber configured that is not present ? This causes the daemon aborted message for me and may be your default cause

NicoHood commented 8 years ago

Yes i have a grabber setting (which is the default) and it is not present.

Another question: Why are there still debug symbols in the binary if we use the type "release" in the cmake? Should this all get removed?

[alarm@alarmpi3 hyperion]$ /usr/bin/hyperiond --debug /etc/hyperion/hyperion.config.json
[HYPERIOND MAIN] <INFO> Selected configuration file: /etc/hyperion/hyperion.config.json
[HYPERIOND Core] <INFO> ColorTransform 'default' => [0; 24]
[HYPERIOND Core] <INFO> ColorTemperature 'default' => [0; 24]
[HYPERIOND Core] <INFO> ColorAdjustment 'default' => [0; 24]
[HYPERIOND LedDevice] <INFO> configuration: 
{
    "PID" : "0x8036",
    "VID" : "0x2341",
    "colorOrder" : "rgb",
    "name" : "DefaultHyperionConfig",
    "output" : "/dev/ttyACM0",
    "rate" : 115200,
    "type" : "adalight"
}

[HYPERIOND LedDevice] <INFO> Opening UART: /dev/ttyACM0
[HYPERIOND Core] <INFO> Json forward to 127.0.0.1:19446
[HYPERIOND Core] <INFO> Proto forward to 127.0.0.1:19447
INFO: Creating linear smoothing
HYPERION (CS) INFO: Created linear-smoothing(interval_ms=50;settlingTime_ms=200;updateDelay=0
[HYPERIOND EFFECTENGINE] <INFO> 27 effects loaded from directory /usr/share/hyperion/effects
[HYPERIOND EFFECTENGINE] <DEBUG> <EffectEngine.cpp:63:EffectEngine()> Initializing Python interpreter
[HYPERIOND Core] <DEBUG> <Hyperion.cpp:599:Hyperion()> configured leds: 25 hw leds: 25
[HYPERIOND LOGGER] <WARNING> Logger settings overriden by command line argument
[HYPERIOND MAIN] <INFO> Hyperion started and initialised
[HYPERIOND EFFECTENGINE] <INFO> run effect Rainbow swirl fast on channel 0
BLACKBORDER INFO: threshold set to 0 (0)
BLACKBORDER INFO: mode:default
[HYPERIOND MAIN] <INFO> Inital foreground effect 'Rainbow swirl fast' started
[HYPERIOND EFFECTENGINE] <INFO> run effect Full color mood blobs on channel 2147483646
BLACKBORDER INFO: threshold set to 0 (0)
BLACKBORDER INFO: mode:default
[HYPERIOND MAIN] <INFO> Inital background effect 'Full color mood blobs' started
[HYPERIOND MAIN] <INFO> Json server created and started on port 19444
PROTOCONNECTION INFO: Connecting to Hyperion: 127.0.0.1:19447
[HYPERIOND MAIN] <INFO> Proto server created and started on port 19445
[HYPERIOND MAIN] <DEBUG> <hyperiond.cpp:259:startNetworkServices()> Boblight server created
[HYPERIOND MAIN] <DEBUG> <hyperiond.cpp:278:startNetworkServices()> UDP listener created
[HYPERIOND MAIN] <INFO> UDP LIstener mDNS responder started
[HYPERIOND MAIN] <INFO> Json mDNS responder started
[HYPERIOND MAIN] <INFO> Proto mDNS responder started
[HYPERIOND MAIN] <ERROR> Hyperion Daemon aborted
Segmentation fault (core dumped)
penfold42 commented 8 years ago

Are you confusing debug level logging with debug symbols that get stripped ?

NicoHood commented 8 years ago

That might be true. But I'd also remove the debug level from the final binary. And if someone needs special debug output you can recompile it with debug settings.

redPanther commented 8 years ago

Debug messages always there this hasn't anything to do how you compile. With --debug you enable debug message output of the used logger

NicoHood commented 8 years ago

With this config I get the following error still:

{
    "logger" :
    {
        "level" : "warn"
    },

    "device" :
    {
        "name"       : "DefaultHyperionConfig",
        "type"       : "adalight",
        "output"     : "/dev/ttyACM0",
        "VID"        : "0x2341",
        "PID"        : "0x8036",
        "rate"       : 115200,
        "colorOrder" : "rgb"
    },

    "color" :
    {
        "channelAdjustment" :
        [
            {
                "id"   : "default",
                "leds" : "*",
                "pureRed" :
                {
                    "redChannel"        : 255,
                    "greenChannel"      : 0,
                    "blueChannel"       : 0
                },
                "pureGreen" :
                {
                    "redChannel"        : 0,
                    "greenChannel"      : 255,
                    "blueChannel"       : 0
                },
                "pureBlue" :
                {
                    "redChannel"        : 0,
                    "greenChannel"      : 0,
                    "blueChannel"       : 255
                }
            }
        ],
        "temperature" :
        [
            {
                "id"   : "default",
                "leds" : "*",
                "correctionValues" :
                {
                    "red"   : 255,
                    "green" : 255,
                    "blue"  : 255
                }
            }
        ],
        "transform" :
        [
            {
                "id"   : "default",
                "leds" : "*",
                "hsl" :
                {
                    "saturationGain"    : 1.0000,
                    "luminanceGain"     : 1.0000,
                    "luminanceMinimum"  : 0.0000
                },
                "red" :
                {
                    "threshold"     : 0.0000,
                    "gamma"         : 2.5000
                },
                "green" :
                {
                    "threshold"     : 0.0000,
                    "gamma"         : 2.5000
                },
                "blue" :
                {
                    "threshold"     : 0.0000,
                    "gamma"         : 2.5000
                }
            }
        ],
        "smoothing" :
        {
            "type"            : "linear",
            "time_ms"         : 200,
            "updateFrequency" : 20.0000,
            "updateDelay"     : 0
        }
    },

    "framegrabber" :
    {
        "width" : 128,
        "height" : 128,
        "frequency_Hz" : 10.0,
        "priority" : 890
    },

    "blackborderdetector" :
    {
        "enable" : true,
        "threshold" : 0.0,
        "mode" : "default"
    },

    "initialEffect" :
    {
                "background-effect" :  "Full color mood blobs",
                "background-effect-args" : {},
                "foreground-effect" : "Rainbow swirl fast",
                "foreground-effect-args" : {},
                "foreground-duration_ms" : 3000
    },

    "forwarder" :
    {
        "json" : ["127.0.0.1:19446"],
        "proto" : ["127.0.0.1:19447"]
    },

    "jsonServer" :
    {
        "port" : 19444
    },

    "protoServer" :
    {
        "port" : 19445
    },

    "webConfig" :
    {
            "enable" : false,
            "document_root" : "/usr/share/hyperion/webconfig",
            "port" : 8099
    },

    "effects" :
    {
        "paths" :
        [
            "/storage/hyperion/effects",
            "/usr/share/hyperion/effects"
        ]
    },

    "leds" :
    [
        {
            "index" : 0,
            "hscan" : { "minimum" : 0.1111, "maximum" : 0.2222 },
            "vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
        },
        {
            "index" : 1,
            "hscan" : { "minimum" : 0.0000, "maximum" : 0.1111 },
            "vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
        },
        {
            "index" : 2,
            "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
            "vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
        },
        {
            "index" : 3,
            "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
            "vscan" : { "minimum" : 0.7500, "maximum" : 1.0000 }
        },
        {
            "index" : 4,
            "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
            "vscan" : { "minimum" : 0.5000, "maximum" : 0.7500 }
        },
        {
            "index" : 5,
            "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
            "vscan" : { "minimum" : 0.2500, "maximum" : 0.5000 }
        },
        {
            "index" : 6,
            "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.2500 }
        },
        {
            "index" : 7,
            "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 8,
            "hscan" : { "minimum" : 0.0000, "maximum" : 0.1111 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 9,
            "hscan" : { "minimum" : 0.1111, "maximum" : 0.2222 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 10,
            "hscan" : { "minimum" : 0.2222, "maximum" : 0.3333 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 11,
            "hscan" : { "minimum" : 0.3333, "maximum" : 0.4444 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 12,
            "hscan" : { "minimum" : 0.4444, "maximum" : 0.5556 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 13,
            "hscan" : { "minimum" : 0.5556, "maximum" : 0.6667 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 14,
            "hscan" : { "minimum" : 0.6667, "maximum" : 0.7778 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 15,
            "hscan" : { "minimum" : 0.7778, "maximum" : 0.8889 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 16,
            "hscan" : { "minimum" : 0.8889, "maximum" : 1.0000 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 17,
            "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
        },
        {
            "index" : 18,
            "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
            "vscan" : { "minimum" : 0.0000, "maximum" : 0.2500 }
        },
        {
            "index" : 19,
            "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
            "vscan" : { "minimum" : 0.2500, "maximum" : 0.5000 }
        },
        {
            "index" : 20,
            "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
            "vscan" : { "minimum" : 0.5000, "maximum" : 0.7500 }
        },
        {
            "index" : 21,
            "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
            "vscan" : { "minimum" : 0.7500, "maximum" : 1.0000 }
        },
        {
            "index" : 22,
            "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
            "vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
        },
        {
            "index" : 23,
            "hscan" : { "minimum" : 0.8889, "maximum" : 1.0000 },
            "vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
        },
        {
            "index" : 24,
            "hscan" : { "minimum" : 0.7778, "maximum" : 0.8889 },
            "vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
        }
    ],

    "endOfJson" : "endOfJson"
}
[alarm@alarmpi ~]$ hyperiond /etc/hyperion/hyperion.config.json --debug
[HYPERIOND MAIN] <INFO> Selected configuration file: /etc/hyperion/hyperion.config.json
[HYPERIOND Core] <INFO> ColorTransform 'default' => [0; 24]
[HYPERIOND Core] <INFO> ColorTemperature 'default' => [0; 24]
[HYPERIOND Core] <INFO> ColorAdjustment 'default' => [0; 24]
[HYPERIOND LedDevice] <INFO> configuration: 
{
    "PID" : "0x8036",
    "VID" : "0x2341",
    "colorOrder" : "rgb",
    "name" : "DefaultHyperionConfig",
    "output" : "/dev/ttyACM0",
    "rate" : 115200,
    "type" : "adalight"
}

[HYPERIOND LedDevice] <INFO> Opening UART: /dev/ttyACM0
[HYPERIOND Core] <INFO> Json forward to 127.0.0.1:19446
[HYPERIOND Core] <INFO> Proto forward to 127.0.0.1:19447
INFO: Creating linear smoothing
HYPERION (CS) INFO: Created linear-smoothing(interval_ms=50;settlingTime_ms=200;updateDelay=0
[HYPERIOND EFFECTENGINE] <INFO> 27 effects loaded from directory /usr/share/hyperion/effects
[HYPERIOND EFFECTENGINE] <DEBUG> <EffectEngine.cpp:63:EffectEngine()> Initializing Python interpreter
[HYPERIOND Core] <DEBUG> <Hyperion.cpp:599:Hyperion()> configured leds: 25 hw leds: 25
[HYPERIOND LOGGER] <WARNING> Logger settings overriden by command line argument
[HYPERIOND MAIN] <INFO> Hyperion started and initialised
[HYPERIOND EFFECTENGINE] <INFO> run effect Rainbow swirl fast on channel 0
BLACKBORDER INFO: threshold set to 0 (0)
BLACKBORDER INFO: mode:default
[HYPERIOND MAIN] <INFO> Inital foreground effect 'Rainbow swirl fast' started
[HYPERIOND EFFECTENGINE] <INFO> run effect Full color mood blobs on channel 2147483646
BLACKBORDER INFO: threshold set to 0 (0)
BLACKBORDER INFO: mode:default
[HYPERIOND MAIN] <INFO> Inital background effect 'Full color mood blobs' started
[HYPERIOND MAIN] <INFO> Json server created and started on port 19444
PROTOCONNECTION INFO: Connecting to Hyperion: 127.0.0.1:19447
[HYPERIOND MAIN] <INFO> Proto server created and started on port 19445
[HYPERIOND MAIN] <INFO> Json mDNS responder started
[HYPERIOND MAIN] <INFO> Proto mDNS responder started
DISPMANXGRABBER INFO: Display opened with resolution: 1920x1080
BLACKBORDER INFO: threshold set to 0 (0)
BLACKBORDER INFO: mode:default
[HYPERIOND MAIN] <INFO> Frame grabber created and started
Segmentation fault (core dumped)
redPanther commented 8 years ago

Than compile it in debug, start with gdb and rhen we know exactly whats crashing

NicoHood commented 8 years ago
(gdb) run hidold --debug
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/bin/hyperiond hidold --debug
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[HYPERIOND MAIN] <INFO> Selected configuration file: hidold
[HYPERIOND Core] <INFO> ColorTransform 'default' => [0; 24]
[HYPERIOND Core] <INFO> ColorTemperature 'default' => [0; 24]
[HYPERIOND Core] <INFO> ColorAdjustment 'default' => [0; 24]
[HYPERIOND LedDevice] <INFO> configuration: 
{
    "PID" : "0x8036",
    "VID" : "0x2341",
    "colorOrder" : "rgb",
    "name" : "MyHyperionConfig",
    "output" : "/dev/ttyACM0",
    "rate" : 115200,
    "type" : "adalight"
}

[HYPERIOND LedDevice] <INFO> Opening UART: /dev/ttyACM0
[HYPERIOND Core] <INFO> Creating linear smoothing
[HYPERIOND Smoothing] <INFO> Created linear-smoothing with interval_ms: 50, settlingTime_ms: 100, updateDelay: 0
[HYPERIOND EFFECTENGINE] <ERROR> no effects found, check your effect directories
[HYPERIOND EFFECTENGINE] <DEBUG> <EffectEngine.cpp:63:EffectEngine()> Initializing Python interpreter
[HYPERIOND Core] <DEBUG> <Hyperion.cpp:605:Hyperion()> configured leds: 25 hw leds: 25
[HYPERIOND MAIN] <INFO> Hyperion started and initialised
[HYPERIOND MAIN] <DEBUG> <hyperiond.cpp:212:createKODIVideoChecker()> KODI checker created 
[HYPERIOND MAIN] <INFO> Json server created and started on port 19444
[HYPERIOND MAIN] <INFO> Proto server created and started on port 19445
[New Thread 0x7ffff051f700 (LWP 12790)]
[Thread 0x7ffff051f700 (LWP 12790) exited]
[HYPERIOND MAIN] <DEBUG> <hyperiond.cpp:311:startNetworkServices()> Json mDNS responder started
[New Thread 0x7ffff051f700 (LWP 12791)]
[HYPERIOND MAIN] <DEBUG> <hyperiond.cpp:319:startNetworkServices()> Proto mDNS responder started
[Thread 0x7ffff051f700 (LWP 12791) exited]
[HYPERIOND WEBSERVER] <INFO> started on port 8099 name "Qt Static HTTP File Server"
[HYPERIOND LedDevice] <DEBUG> <LedRs232Device.cpp:74:writeBytes()> write 81 
[HYPERIOND LedDevice] <DEBUG> <LedRs232Device.cpp:74:writeBytes()> write 81 

Thread 1 "hyperiond" received signal SIGSEGV, Segmentation fault.
0x00007ffff6d7c00a in QRingBuffer::reserve(long long) () from /usr/lib/libQt5Core.so.5
redPanther commented 8 years ago

thx for starting it in gdb. btw. to start it without the restart: gdb /usr/bin/hyperiond --args /usr/bin/hyperiond --debug hidold then gdb command: run

what I need is, after segfault is thrown call the gdb command "bt" to retrieve the backtrace.

It looks like segfault is happend in serial device, but I need the bt to be sure.

NicoHood commented 8 years ago
Thread 1 "hyperiond" received signal SIGSEGV, Segmentation fault.
0x00007ffff6d7c00a in QRingBuffer::reserve(long long) () from /usr/lib/libQt5Core.so.5
(gdb) bt
#0  0x00007ffff6d7c00a in QRingBuffer::reserve(long long) () from /usr/lib/libQt5Core.so.5
#1  0x00007ffff7330c8c in ?? () from /usr/lib/libQt5SerialPort.so.5
#2  0x00007ffff733156b in ?? () from /usr/lib/libQt5SerialPort.so.5
#3  0x0000000000490af7 in LedRs232Device::writeBytes (this=0x7171a0, size=<optimized out>, data=0x80a840 "Ada")
    at /home/arch/hackallthethings/Arch-Scripts/AUR/hyperion-ng/src/hyperion-ng/libsrc/leddevice/LedRs232Device.cpp:73
#4  0x00007ffff6f014e9 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
#5  0x00007ffff6f0e568 in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/libQt5Core.so.5
#6  0x00007ffff6f02303 in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5
#7  0x00007ffff6ed5c6b in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#8  0x00007ffff6f2951e in QTimerInfoList::activateTimers() () from /usr/lib/libQt5Core.so.5
#9  0x00007ffff6f29a79 in ?? () from /usr/lib/libQt5Core.so.5
#10 0x00007ffff3622dd7 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#11 0x00007ffff3623040 in ?? () from /usr/lib/libglib-2.0.so.0
#12 0x00007ffff36230ec in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#13 0x00007ffff6f2a57f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#14 0x00007ffff6ed40da in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#15 0x00007ffff6edc5cc in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#16 0x000000000043706c in main (argc=<optimized out>, argv=<optimized out>) at /home/arch/hackallthethings/Arch-Scripts/AUR/hyperion-ng/src/hyperion-ng/src/hyperiond/main.cpp:159
redPanther commented 8 years ago

the crash happens in a qt function: _rs232Port.waitForBytesWritten(100);

I don't know why. I have a adalight testseup available. I will investigate that, but don't expect a fix soon - it's fixed when it's fixed ...

penfold42 commented 8 years ago

I wonder if the device is appearing and then disappearing.

what is the USB hardware ? arduino/atmega328 ? arduino/atmega32u4 ?

penfold42 commented 8 years ago

Looking at the USB vid and pod I'm guessing Leonardo or clones.

Can you give me a link the the exact sketch you are using ?

Some of them are really crap and not robust. I want to replicate your issue so we can fix Hyperion 1st

redPanther commented 8 years ago

For arduino I always use delayafterconnect, because the reset when serial device is opened. Perhaps @nicohood can try that. I would change the default to 1 second. Because usage of arduino is quite common

redPanther commented 8 years ago

And the leo's disconnects the serial dev during reset, because they havn't a dedicated mcu for usb serial. This could bring the software in serious trouble ...

penfold42 commented 8 years ago

Yep - my thoughts exactly

I'll look into fixing the Hyperion rs233 to be more robust tho - we should never sengfsult

redPanther commented 8 years ago

You can check existens of device with qfile on every write. That should prevent most, problems

redPanther commented 8 years ago

latest master contains a default value for delayAfterConnect. This is set to 1 second. Perhaps this is not enough, but better than no delay. @NicoHood can you test your settings with delayAfterConnect : 5000 if that works decrease the value to it's optimum

NicoHood commented 8 years ago

I am using the Arduino Leonardo. My sketch is quite huge, but I will try to reduce it. I've coded everything myself. But the USB Serial module might be slower than other implementations, true. Especially because if you do not call read() the bank is not emptied.

NicoHood commented 8 years ago

I tried again with the value set to 5000. It still crashes. What I noticed is, that it crashes every 2nd time. And I started with an old fork of the ng project which was 40 commits behind which seemed to work, but I might be wrong with that. I guess the usb device is in an unexpected state (because it was not closed properly before etc) and then the function fails.

redPanther commented 8 years ago

Can you give an exact point in repo ... 40 commits behind is not usefull. I hope you noticed we changed serialport implementation to qtserialport.

I tried with default adalight sketch on my x86 desktop and it worked like a charm. Also provoking decice absent during write (pull the plug) and usage of arduino uno, leonaredo and diecemila doesnt make any difference. in no point I got a segfault. I tried nearly everything, but I cant reproduce. If you have s suspection, then try to proof it. Make some cout where the close is called. Then you will see if your suspection is correct .... in the meantime ... it's summer :-) hope everybody can enjoy it

penfold42 commented 8 years ago

Is it possible your sketch has crashed and taken out the USB code ?

This would be different to a removal event from the host perspective

redPanther commented 8 years ago

I prepare a PR with a firmware folder with "known as working", so we can shorten such bug search with "test with our sketch ..."

penfold42 commented 8 years ago

I'll add some of my stuff to it from penfold42/stuff

NicoHood commented 8 years ago

I reuploaded the sketch to my Arduino and it seems to not appear anymore. There was possibly something wrong with the usb device which made hyperion to crash. Too bad I cannot reproduce the bug. However we should not worry to much about this then. If the bug reappears, I will reopen this issue.