Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

malloc() issue #142

Closed
tavalin opened this issue Nov 3, 2021 · 23 comments
Closed

malloc() issue #142

tavalin opened this issue Nov 3, 2021 · 23 comments

Comments

@tavalin
Copy link

tavalin commented Nov 3, 2021

Bug report, debug log and your config file (FULL LOGS ARE MANDATORY)

Steps to reproduce

Turn off the source and after a period of time HyperHDR crashes due to SIGABRT

What is expected?

No crashes or exceptions in HyperHDR

What is actually happening?

HyperHDR crashes and becomes unresponsive until the container is restarted

2021-11-03T12:31:13.744 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T12:32:13.749 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T12:33:13.753 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T12:34:13.757 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.01,15)
2021-11-03T12:35:13.764 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T12:36:13.769 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T12:37:13.775 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.01,15)
2021-11-03T12:38:13.781 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.01,15)
2021-11-03T12:39:13.783 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.05, av. delay: 3ms, good: 7143, bad: 0 (60.00,15)
2021-11-03T12:40:13.787 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T12:41:13.791 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T12:42:13.795 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 118.98, av. delay: 3ms, good: 7139, bad: 0 (60.00,15)
2021-11-03T12:43:13.796 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.00,15)
2021-11-03T12:44:13.798 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 118.98, av. delay: 3ms, good: 7139, bad: 0 (60.00,15)
2021-11-03T12:45:13.798 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.05, av. delay: 3ms, good: 7143, bad: 0 (60.00,15)
2021-11-03T12:46:13.801 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T12:47:13.801 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T12:48:13.806 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 118.97, av. delay: 3ms, good: 7138, bad: 0 (60.01,15)
2021-11-03T12:49:13.811 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T12:50:13.811 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T12:51:13.812 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T12:52:13.814 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T12:53:13.822 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.01,15)
2021-11-03T12:54:13.828 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.01,15)
2021-11-03T12:55:13.833 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T12:56:13.837 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.00,15)
2021-11-03T12:57:13.843 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T12:58:13.845 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T12:59:13.852 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:00:13.854 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:01:13.855 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:02:13.859 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.00,15)
2021-11-03T13:03:13.867 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.01,15)
2021-11-03T13:04:13.875 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.01,15)
2021-11-03T13:05:13.877 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:06:13.879 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T13:07:13.882 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.00,15)
2021-11-03T13:08:13.882 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T13:09:13.887 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:10:13.889 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:11:13.896 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.01,15)
2021-11-03T13:12:13.903 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:13:13.908 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.05, av. delay: 3ms, good: 7143, bad: 0 (60.01,15)
2021-11-03T13:14:13.915 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.01,15)
2021-11-03T13:15:13.915 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T13:16:13.916 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:17:13.917 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T13:18:13.923 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.01,15)
2021-11-03T13:19:13.928 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.01,15)
2021-11-03T13:20:13.930 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.05, av. delay: 3ms, good: 7143, bad: 0 (60.00,15)
2021-11-03T13:21:13.936 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.05, av. delay: 3ms, good: 7143, bad: 0 (60.01,15)
2021-11-03T13:22:13.941 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:23:13.941 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.00,15)
2021-11-03T13:24:13.941 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:25:13.949 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.05, av. delay: 3ms, good: 7143, bad: 0 (60.01,15)
2021-11-03T13:26:13.954 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:27:13.954 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.00,15)
2021-11-03T13:28:13.962 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:29:13.966 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.05, av. delay: 3ms, good: 7143, bad: 0 (60.00,15)
2021-11-03T13:30:13.967 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T13:31:13.975 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:32:13.976 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:33:13.976 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T13:34:13.980 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:35:13.982 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:36:13.988 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:37:13.994 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 118.98, av. delay: 3ms, good: 7139, bad: 0 (60.01,15)
2021-11-03T13:38:14.000 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.01,15)
2021-11-03T13:39:14.004 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T13:40:14.009 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:41:14.015 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.01,15)
2021-11-03T13:42:14.015 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:43:14.020 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.01,15)
2021-11-03T13:44:14.025 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.05, av. delay: 3ms, good: 7143, bad: 0 (60.01,15)
2021-11-03T13:45:14.026 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 118.98, av. delay: 3ms, good: 7139, bad: 0 (60.00,15)
2021-11-03T13:46:14.026 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:47:14.028 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T13:48:14.031 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:49:14.034 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.00,15)
2021-11-03T13:50:14.036 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:51:14.041 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:52:14.046 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.01,15)
2021-11-03T13:53:14.047 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T13:54:14.052 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:55:14.052 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T13:56:14.054 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.00,15)
2021-11-03T13:57:14.060 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
2021-11-03T13:58:14.063 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.00,15)
2021-11-03T13:59:14.069 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.01,15)
2021-11-03T14:00:14.073 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T14:01:14.076 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.00,15)
2021-11-03T14:02:14.081 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.03, av. delay: 3ms, good: 7142, bad: 0 (60.01,15)
2021-11-03T14:03:14.084 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T14:04:14.085 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.00, av. delay: 3ms, good: 7140, bad: 0 (60.00,15)
2021-11-03T14:05:14.093 V4L2:USB3.0 4K VIDE    : <INFO> Video FPS: 119.02, av. delay: 3ms, good: 7141, bad: 0 (60.01,15)
malloc(): unaligned fastbin chunk detected

HyperHDR caught signal :SIGABRT
2021-11-03T14:07:24.544 WEBSOCKET              : <DEBUG> WebSocketClient.cpp:30:WebSocketClient() | New connection from ::ffff:192.168.0.41
2021-11-03T14:07:24.545 WEBSOCKET              : <DEBUG> JsonAPI.cpp:89:handleInstanceSwitch() | Client '::ffff:192.168.0.41' switch to HyperHDR instance 0

System

HyperHDR Server: 
- Build:           (HEAD detached at dec81c0) (Awawa-2a2ed8d/dec81c0-1631541363)
- Build time:      Sep 15 2021 16:21:00
- Git Remote:      https://github.com/awawa-dev/HyperHDR
- Version:         17.0.0.0
- UI Lang:         auto (BrowserLang: en-US)
- UI Access:       default
- Avail Capt:      Linux (V4L2)
- Database:        read/write

HyperHDR Server OS: 
- Distribution:   Ubuntu 21.10
- Architecture:   arm64
- CPU Type:       Raspberry Pi 4 Model B Rev 1.1
- CPU Revision:   c03111
- CPU Hardware:   BCM2835
- Kernel:         linux (5.13.0-1009-raspi (WS: 64))
- Qt Version:     5.11.3
- Browser:        Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
@awawa-dev
Copy link
Owner

awawa-dev commented Nov 3, 2021

Container? Unfortunately since I use that version for a long time and can not reproduce them and since problems with SIGABRT if exists always happens on custom system/devices I would require to run HyperHDR debug version using gdb and reporting the stack during the crash also. Otherwise can't help and the report will be closed due time: too many components or lack of memory can play a role. It's just a realistic approach.

@tavalin
Copy link
Author

tavalin commented Nov 3, 2021

Container?

Yes I run HyperHDR in a docker container using an Ubuntu base image.

Can you advise how to install the debug version please and I will update my image to run the debug version.

@awawa-dev
Copy link
Owner

awawa-dev commented Nov 3, 2021

It needs to be compile https://github.com/awawa-dev/HyperHDR/wiki/Compiling-HyperHDR with one change: instead of release, debug keyword should be used. For example cmake --build . --target package --config Debug builds the debug installer. Since you are using very high framerate I wonder what's the resolution and could you monitor memory usage inside container during, for example: 5-10 minutes of HyperHDR running first?
Rpi Debug version is not recommended for every day usage only for debugging, because it's much slower than regular Release version.

@tavalin
Copy link
Author

tavalin commented Nov 4, 2021

Since you are using very high framerate I wonder what's the resolution

I'm capturing 1920 x 1080p 120hz in nv12 format and everything is fine when there is a signal. When I turn off my sources and try and turn it back on the next day is usually when I find HyperHDR has crashed.

could you monitor memory usage inside container during, for example: 5-10 minutes of HyperHDR running first?

The system is usually around 400-500mb RAM total when running the HyperHDR container.

I've built the debug version and installed and built a new docker image with it. Where would the additional debug information be found?

@awawa-dev
Copy link
Owner

OK, great. Did you check 'quarter of frame' mode in the grabber properties? It's neutral for colors as nv12 delivers only 1/4 of saturation/hue information anyway.
For debugging process hyperhdr must be run not as service (disable it) but using gdb. For example I use for testing gdb /usr/bin/hyperhdr
Then run from gdb console, when it crash run bt to see ans save logs. It should show path that leads to the exception and part of the code related to it (if the problem is in the hyperhdr).

@tavalin
Copy link
Author

tavalin commented Nov 4, 2021

Sorry to be a pain... running the debug version from the command i.e. ./hyperhdr works OK but when I use ubuntu@ubuntu:~/hyperhdr/build/bin$ gdb ./hyperhdr I get the following

ubuntu@ubuntu:~/hyperhdr/build/bin$ gdb ./hyperhdr
GNU gdb (Ubuntu 11.1-0ubuntu2) 11.1
Copyright (C) 2021 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 "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 hyperhdr...
(gdb)

Any idea what I'm doing wrong?

@awawa-dev
Copy link
Owner

You are almost there...just type 'run'

@awawa-dev
Copy link
Owner

awawa-dev commented Nov 4, 2021

BTW if won't work because it can't find its resources run the command directly from build folder (you are in bin currently) gdb bin/hyperhdr relative paths could matter

@awawa-dev
Copy link
Owner

As I dug deeper that error could be glibc thing, there are a lot of similar reports lately. The cause is not sure, maybe there are multiple reasons. One suggestion is hardware related: RAM overheating which make sense for high speed 1080p capturing & processing. malloc in hyperhdr in used almost purely for creating the image buffers (for the software reason: maybe the memory is too fragmented at some point?).

@tavalin
Copy link
Author

tavalin commented Nov 4, 2021

I left it running through gdb and came back several hours later and found the following in the console:

Please answer y or n.
The program being debugged has been started already.
Start it from the beginning? (y or n) 
Display all 196 possibilities? (y or n)
The program being debugged has been started already.
Start it from the beginning? (y or n) 
Please answer y or n.
The program being debugged has been started already.
Start it from the beginning? (y or n) 
Please answer y or n.
The program being debugged has been started already.
Start it from the beginning? (y or n) 
Please answer y or n.
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) bt
#0  0x0000aaaaab1c56ac in __aarch64_ldadd4_acq_rel ()
#1  0x0000aaaaaae016d0 in std::__atomic_base<int>::operator-- (this=0xffffbc0034bf) at /usr/include/c++/11/bits/atomic_base.h:386
#2  0x0000aaaaaae01618 in QAtomicOps<int>::deref<int> (_q_value=...) at /usr/include/aarch64-linux-gnu/qt5/QtCore/qatomic_cxx11.h:289
#3  0x0000aaaaaae014d4 in QBasicAtomicInteger<int>::deref (this=0xffffbc0034bf) at /usr/include/aarch64-linux-gnu/qt5/QtCore/qbasicatomic.h:119
#4  0x0000aaaaaae0910c in QExplicitlySharedDataPointer<ImageData>::~QExplicitlySharedDataPointer (this=0xffffbc003950, __in_chrg=<optimized out>) at /usr/include/aarch64-linux-gnu/qt5/QtCore/qshareddata.h:184
#5  0x0000aaaaaae07170 in Image<ColorRgb>::~Image (this=0xffffbc003950, __in_chrg=<optimized out>) at /home/ubuntu/hyperhdr/include/utils/Image.h:8
#6  0x0000aaaaaae07190 in QtMetaTypePrivate::QMetaTypeFunctionHelper<Image<ColorRgb>, true>::Destruct (t=0xffffbc003950) at /usr/include/aarch64-linux-gnu/qt5/QtCore/qmetatype.h:819
#7  0x0000fffff6cc09dc in QMetaType::destroy(int, void*) () from /lib/aarch64-linux-gnu/libQt5Core.so.5
#8  0x0000fffff6cd586c in QMetaCallEvent::~QMetaCallEvent() () from /lib/aarch64-linux-gnu/libQt5Core.so.5
#9  0x0000fffff6cd5904 in QMetaCallEvent::~QMetaCallEvent() () from /lib/aarch64-linux-gnu/libQt5Core.so.5
#10 0x0000fffff6cac168 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /lib/aarch64-linux-gnu/libQt5Core.so.5
#11 0x0000fffff6d08288 in ?? () from /lib/aarch64-linux-gnu/libQt5Core.so.5
#12 0x0000fffff59d82b0 in g_main_context_dispatch () from /lib/aarch64-linux-gnu/libglib-2.0.so.0
#13 0x0000fffff5a2ccdc in ?? () from /lib/aarch64-linux-gnu/libglib-2.0.so.0
#14 0x0000fffff59d57c4 in g_main_context_iteration () from /lib/aarch64-linux-gnu/libglib-2.0.so.0
#15 0x0000fffff6d07754 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/aarch64-linux-gnu/libQt5Core.so.5
#16 0x0000fffff6ca720c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/aarch64-linux-gnu/libQt5Core.so.5
#17 0x0000fffff6ab5d6c in QThread::exec() () from /lib/aarch64-linux-gnu/libQt5Core.so.5
#18 0x0000fffff6ab721c in ?? () from /lib/aarch64-linux-gnu/libQt5Core.so.5
#19 0x0000fffff64fe41c in start_thread (arg=<optimized out>) at pthread_create.c:435
#20 0x0000fffff6566a5c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:79

@awawa-dev
Copy link
Owner

awawa-dev commented Nov 4, 2021

Thank you. As I suspected it's a Image object that contains captured frame. It's a bit complicated because it uses QExplicitlySharedDataPointer for better performance and its destructor should be called when the frame is disposed (in fact when all copies of that frame are not referenced anymore). As it's done automatically and by book using QT library mechanism can't see why it fails in some condition under stress inside the container. Maybe creating full copy of the frame each time could work as workaround but don't want to do it unless serious reason because it brings higher CPU and RAM usage and it's uncertain if it helps if the problems is in glibc or it's specific for running hyperhdr from inside the container on RPi.

@tavalin
Copy link
Author

tavalin commented Nov 5, 2021

Just as added info, I ended up running HyperHDR natively on the Pi4 (no Docker) for that debug session to eliminate any issues caused by using a container.

It always seems to crash after a period of no signal. Do you think this could be caused by the grabber going into sleep mode or something?

@awawa-dev
Copy link
Owner

awawa-dev commented Nov 5, 2021

But in logs you attached earlier the processing is always happening (probably grabber is sending its no signal board I guess) so attaching the source could only have a hardware effect on the system (the voltage jump/drop when the grabbers start the real capturing). The grabber is directly not related to that exception, but selecting 1080p and very high frame-rate could play a factor because it's a lot of stress for the memory rather than CPU.

@awawa-dev
Copy link
Owner

I'll try to set my ezcap 320 for full frame 1080p@120@nv capturing for the weekend session. Then I could tell at least if I can reproduce it after few hours of usage. I'm using 64OS Raspberry Pi OS upgraded to Bulls Eye so different QT(5.15) and other key system libraries.

@tavalin
Copy link
Author

tavalin commented Nov 5, 2021

Thank you - let me know if you need any further information or to try any further testing.

@awawa-dev
Copy link
Owner

If you could try to enable 'quarter of frame' mode in the grabber and to reduce framerate (if not possible then lower resolution) and check if it has any positive effect. I know it is not a fix but want to check if there is any correlation . Do you have signal detection enabled?

@awawa-dev
Copy link
Owner

awawa-dev commented Nov 5, 2021

Ok, tested it using 1080p 120Hz nv. There are problems related to the environmental memory management: RAM usage increases steadily to over 90% then "garbage collector" kicks in and steadily reduces it to 20%...but sometimes it is not fast enough and out of memory exception happens (I have 2GB model). For now I'm ready to exclude 1080p120 from supported modes for Rpi, similar as I did for 1080p60 MJPEG that is blacklisted for MS2109 under Windows as the whole system can't handle it. 1080p60 works fine without that race for RAM, valgrind can't find serious memory problem in hyperhdr either.

@tavalin
Copy link
Author

tavalin commented Nov 5, 2021

If you could try to enable 'quarter of frame' mode in the grabber

I'm already using quarter frame mode as I think 1080p at 120hz without quarter mode would be too optimistic 🙂 However my grabber only supports 120hz at 1080p so I can't reduce the resolution further.

The reason I went with 120hz mode is that it, in my opinion, provided a more responsive ambilighting than at 60hz but as a test I will run it without a source in 1080p 60hz mode for a few hours and see if it crashes.

Edit: actually before I test at 1080p 60hz, I am going to test again at 120hz but recalibrate the signal detection and see if it crashes. So far with the recalibrated signal detection HyperHDR has dropped the captured framerate down so I will see if this is easier on the memory.

2021-11-05T17:00:01.001Z [SIGNAL_AUTO] THE SIGNAL IS LOST
2021-11-05T17:00:03.912Z [MUXER0] Priority 100 is now inactive
2021-11-05T17:00:03.913Z [MUXER0] Set visible priority to 255
2021-11-05T17:00:03.913Z [HYPERHDR0] New priority[255], previous [100]
2021-11-05T17:00:03.913Z [HYPERHDR0] No source left -> switch LED-Device off
2021-11-05T17:00:03.914Z [IMAGETOLED0] (ImageProcessor.cpp:180) set hard led mapping to multicolor_mean
2021-11-05T17:00:03.914Z [V4L2:USB3.0 4K VIDE] The video control requested for the grabber restart due to signal lost, but it's caused by signal detection. No restart.
2021-11-05T17:00:31.010Z [V4L2:USB3.0 4K VIDE] Video FPS: 20.15, av. delay: 16ms, good: 1209, bad: 0 (60.07,15)
2021-11-05T17:01:31.034Z [V4L2:USB3.0 4K VIDE] Video FPS: 7.92, av. delay: 14ms, good: 475, bad: 0 (60.02,11)
2021-11-05T17:02:31.069Z [V4L2:USB3.0 4K VIDE] Video FPS: 7.92, av. delay: 14ms, good: 475, bad: 0 (60.03,11)
2021-11-05T17:03:17.215Z [WEBSOCKET] (JsonAPI.cpp:1342) log streaming activated for client ::ffff:10.8.0.2
2021-11-05T17:03:31.096Z [V4L2:USB3.0 4K VIDE] Video FPS: 7.92, av. delay: 14ms, good: 475, bad: 0 (60.03,11)
2021-11-05T17:04:31.117Z [V4L2:USB3.0 4K VIDE] Video FPS: 7.92, av. delay: 14ms, good: 475, bad: 0 (60.02,11)
2021-11-05T17:05:31.136Z [V4L2:USB3.0 4K VIDE] Video FPS: 7.92, av. delay: 14ms, good: 475, bad: 0 (60.02,11)

@awawa-dev
Copy link
Owner

'Save resource' is working only when the signal lost id detected: it simply enables 'software frame-rate decimation' for the grabber since we don't need high frame processing for the grabber 'no-signal' board . That's why you get ~8Hz framerate. But it won't help when then signals is back and 120Hz capturing returns. In fact your system is more stable than mine on 1080p@120.

Unfortunately all the Image frame processing is based on automatic object management and we do not control it's lifetime directly: the environmental does it for us. And it works unless it reaches its performance limit.

120Hz could make some sense if the source has similar frame-rate. Most video content are at 23-24Hz, some TV series at 50-60Hz so I guess it leaves only gaming for capturing range over 60Hz. If not, the hyperhdr smoothing configuration handles main aspect of the smooth transition between frames. You can set it well over 100Hz with minimal delay if your LED driver has such high output capability (but you have already done it for the grabber).

@awawa-dev
Copy link
Owner

I have an idea how to optimize memory management especially for large frames at high framerate (for Rpi's at least because PC/macOS platforms can handle it in a standard way) so will investigate the possible solution.

awawa-dev added a commit that referenced this issue Nov 6, 2021
@awawa-dev
Copy link
Owner

awawa-dev commented Nov 6, 2021

I want you to install the installer from newest commit: https://github.com/awawa-dev/HyperHDR/actions/runs/1429545255 https://github.com/awawa-dev/HyperHDR/actions/runs/1430022506 (with new gui option to make cache enable, must be selected to work)
I managed to fix crash at 1080p120 nv full frame processing (Rpi is not capable to process at such high rate anyway, got ~80 full frames with quarter of frame disabled). For 1080p60 nv full frame capturing it brings almost 20% performance increase also. It direct addresses the issue that you managed to capture using gdb, reduces a lot of stress for memory allocation and reduces RAM fragmentation also. Let me know the result.
All systems should benefit from the new fix.

@tavalin
Copy link
Author

tavalin commented Nov 7, 2021

I want you to install the installer from newest commit: https://github.com/awawa-dev/HyperHDR/actions/runs/1429545255

I had already deployed this version and so far after about 12 hours (3-4 hours using last night and then no signal throughout the night) it hasn't crashed yet 😀

@awawa-dev
Copy link
Owner

After changes malloc invoke number is usually reduced from few thousands per minute to zero (cache provides own buffers after they are created) which increases performance, reduces memory fragmentation and solve that problem by the way (which could be related to lack of resources or their fragmentation). Hope it still works problematic free.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants