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

libcamera-jpeg SIGABRT @libcamera::CameraConfiguration::at #90

Closed
kbingham opened this issue Sep 28, 2021 · 10 comments
Closed

libcamera-jpeg SIGABRT @libcamera::CameraConfiguration::at #90

kbingham opened this issue Sep 28, 2021 · 10 comments

Comments

@kbingham
Copy link

kbingham commented Sep 28, 2021

From: @dwrobel Damian Wrobel 2021-09-21 19:01:03 CEST : https://bugs.libcamera.org/show_bug.cgi?id=78

I'm observing a SIGABRT @libcamera::CameraConfiguration::at when using libcamera-jpeg application as follows:

$ libcamera-jpeg -o test.jpg
Preview window unavailable
[144:40:33.264346482] [28470] INFO Camera camera_manager.cpp:294 libcamera v0.0.0+1-dab03790
[144:40:33.335326696] [28470] INFO Camera camera.cpp:937 configuring streams: (0) 1640x1232-YUV420
[144:40:33.335481490] [28474] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt RG10 Score: 2218 (best 2218)
[144:40:33.335544174] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RG10 Score: 2041.48 (best 2041.48)
[144:40:33.335579655] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt RG10 Score: 1500 (best 1500)
[144:40:33.335612118] [28474] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt RG10 Score: 5004.81 (best 1500)
[144:40:33.335666376] [28474] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt pRAA Score: 1718 (best 1500)
[144:40:33.335696728] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pRAA Score: 1541.48 (best 1500)
[144:40:33.335728542] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt pRAA Score: 1000 (best 1000)
[144:40:33.335768856] [28474] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt pRAA Score: 4504.81 (best 1000)
[144:40:33.335805430] [28474] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt RGGB Score: 3218 (best 1000)
[144:40:33.335834615] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RGGB Score: 3041.48 (best 1000)
[144:40:33.335877725] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt RGGB Score: 2500 (best 1000)
[144:40:33.336105166] [28474] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt RGGB Score: 6004.81 (best 1000)
[144:40:33.336404236] [28474] INFO RPI raspberrypi.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected mode: 1640x1232-pRAA
[144:40:33.367341751] [28474] INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[144:40:33.367382084] [28474] INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[144:40:33.367407139] [28474] INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[144:40:33.478414460] [28474] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (6 left)
[144:40:33.509496510] [28474] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (5 left)
[144:40:33.544003622] [28474] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (4 left)
[144:40:33.578627770] [28474] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (3 left)
[144:40:33.609094866] [28474] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (2 left)
[144:40:33.642823804] [28474] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (1 left)
[144:40:33.675786142] [28474] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (0 left)
[144:40:38.517760186] [28470] INFO Camera camera.cpp:937 configuring streams: (0) 3280x2464-YUV420
[144:40:38.517915609] [28474] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt BG10 Score: 1500 (best 1500)
[144:40:38.517977572] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt BG10 Score: 7155.48 (best 1500)
[144:40:38.518018478] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt BG10 Score: 7244 (best 1500)
[144:40:38.518054182] [28474] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt BG10 Score: 10748.8 (best 1500)
[144:40:38.518114921] [28474] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt BA81 Score: 2500 (best 1500)
[144:40:38.518153069] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt BA81 Score: 8155.48 (best 1500)
[144:40:38.518202383] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt BA81 Score: 8244 (best 1500)
[144:40:38.518238383] [28474] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt BA81 Score: 11748.8 (best 1500)
[144:40:38.518275401] [28474] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt pBAA Score: 1000 (best 1000)
[144:40:38.518321196] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pBAA Score: 6655.48 (best 1000)
[144:40:38.518600914] [28474] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt pBAA Score: 6744 (best 1000)
[144:40:38.518732801] [28474] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt pBAA Score: 10248.8 (best 1000)
[144:40:38.518926521] [28474] INFO RPI raspberrypi.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected mode: 3280x2464-pBAA
/usr/include/c++/11/bits/stl_vector.h:1045: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = libcamera::StreamConfiguration; _Alloc = std::allocatorlibcamera::StreamConfiguration; std::vector<_Tp, _Alloc>::reference = libcamera::StreamConfiguration&; std::vector<_Tp, _Alloc>::size_type = unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)

Environment:

Backtrace:

$ gdb --args libcamera-jpeg -o test.jpg
GNU gdb (GDB) Fedora 10.2-3.fc34
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 "armv7hl-redhat-linux-gnueabi".
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 libcamera-jpeg...
Reading symbols from /usr/lib/debug/usr/bin/libcamera-jpeg-0.0.0-0.2.20210915git4868f69.fc34.arm.debug...
(gdb) r
Starting program: /usr/bin/libcamera-jpeg -o test.jpg
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
[New Thread 0xb2388020 (LWP 28517)]
[New Thread 0xb1b87020 (LWP 28518)]
[New Thread 0xb1386020 (LWP 28519)]
Preview window unavailable
[144:42:10.221183137] [28514] INFO Camera camera_manager.cpp:294 libcamera v0.0.0+1-dab03790
[New Thread 0xb0b85020 (LWP 28520)]
[Detaching after fork from child process 28521]
[144:42:10.287882247] [28514] INFO Camera camera.cpp:937 configuring streams: (0) 1640x1232-YUV420
[144:42:10.288022707] [28520] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt RG10 Score: 2218 (best 2218)
[144:42:10.288088818] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RG10 Score: 2041.48 (best 2041.48)
[144:42:10.288122336] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt RG10 Score: 1500 (best 1500)
[144:42:10.288152872] [28520] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt RG10 Score: 5004.81 (best 1500)
[144:42:10.288184464] [28520] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt pRAA Score: 1718 (best 1500)
[144:42:10.288215760] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pRAA Score: 1541.48 (best 1500)
[144:42:10.288246389] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt pRAA Score: 1000 (best 1000)
[144:42:10.288275408] [28520] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt pRAA Score: 4504.81 (best 1000)
[144:42:10.288307963] [28520] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt RGGB Score: 3218 (best 1000)
[144:42:10.288337647] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RGGB Score: 3041.48 (best 1000)
[144:42:10.288368943] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt RGGB Score: 2500 (best 1000)
[144:42:10.288397813] [28520] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt RGGB Score: 6004.81 (best 1000)
[144:42:10.288547700] [28520] INFO RPI raspberrypi.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected mode: 1640x1232-pRAA
[New Thread 0xaf643020 (LWP 28526)]
[144:42:10.372182490] [28520] INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[144:42:10.372261878] [28520] INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[144:42:10.372319118] [28520] INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[144:42:10.481474576] [28520] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (6 left)
[144:42:10.514625912] [28520] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (5 left)
[144:42:10.549098802] [28520] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (4 left)
[144:42:10.581125339] [28520] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (3 left)
[144:42:10.615585118] [28520] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (2 left)
[144:42:10.648002557] [28520] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (1 left)
[144:42:10.680982617] [28520] INFO RPI raspberrypi.cpp:1635 Dropping frame at the request of the IPA (0 left)
[Thread 0xaf643020 (LWP 28526) exited]
[144:42:15.518805054] [28514] INFO Camera camera.cpp:937 configuring streams: (0) 3280x2464-YUV420
[144:42:15.518967736] [28520] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt BG10 Score: 1500 (best 1500)
[144:42:15.519031624] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt BG10 Score: 7155.48 (best 1500)
[144:42:15.519071031] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt BG10 Score: 7244 (best 1500)
[144:42:15.519110364] [28520] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt BG10 Score: 10748.8 (best 1500)
[144:42:15.519152104] [28520] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt BA81 Score: 2500 (best 1500)
[144:42:15.519191418] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt BA81 Score: 8155.48 (best 1500)
[144:42:15.519230473] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt BA81 Score: 8244 (best 1500)
[144:42:15.519267362] [28520] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt BA81 Score: 11748.8 (best 1500)
[144:42:15.519307213] [28520] INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt pBAA Score: 1000 (best 1000)
[144:42:15.519345583] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pBAA Score: 6655.48 (best 1000)
[144:42:15.519384804] [28520] INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt pBAA Score: 6744 (best 1000)
[144:42:15.519422767] [28520] INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt pBAA Score: 10248.8 (best 1000)
[144:42:15.519609486] [28520] INFO RPI raspberrypi.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected mode: 3280x2464-pBAA
/usr/include/c++/11/bits/stl_vector.h:1045: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = libcamera::StreamConfiguration; _Alloc = std::allocatorlibcamera::StreamConfiguration; std::vector<_Tp, _Alloc>::reference = libcamera::StreamConfiguration&; std::vector<_Tp, _Alloc>::size_type = unsigned int]: Assertion '__n < this->size()' failed.

Thread 1 "libcamera-jpeg" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
49 return ret;
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
#1 0xb6a76ffc in __GI_abort () at abort.c:79
#2 0xb6e763d4 in std::__replacement_assert (__condition=0xb6f17e9c "__n < this->size()",
__function=0xb6f17d24 "std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = libcamera::StreamConfiguration; _Alloc = std::allocator<libcamera::StreamConfi"...,
__line=1045, __file=0xb6f17e74 "/usr/include/c++/11/bits/stl_vector.h") at /usr/include/c++/11/armv7hl-redhat-linux-gnueabi/bits/c++config.h:514
#3 std::vector<libcamera::StreamConfiguration, std::allocatorlibcamera::StreamConfiguration >::operator[] (this=, __n=1) at /usr/include/c++/11/bits/stl_vector.h:1045
#4 std::vector<libcamera::StreamConfiguration, std::allocatorlibcamera::StreamConfiguration >::operator[] (this=, this=, __n=1) at /usr/include/c++/11/bits/stl_vector.h:1043
#5 libcamera::CameraConfiguration::at (this=, index=index@entry=1) at ../src/libcamera/camera.cpp:215
#6 0xb6f82824 in LibcameraApp::ConfigureStill (this=0xb238b010, flags=) at /usr/include/c++/11/bits/unique_ptr.h:173
#7 0x00407d6c in event_loop (app=...) at /usr/src/debug/libcamera-apps-0.0.0-0.2.20210915git4868f69.fc34.arm/apps/libcamera_jpeg.cpp:63
#8 main (argc=, argv=) at /usr/src/debug/libcamera-apps-0.0.0-0.2.20210915git4868f69.fc34.arm/apps/libcamera_jpeg.cpp:103

@kbingham
Copy link
Author

@naushir @davidplowman, This has been reported on our issue tracker but a quick glance shows that it may be the libcamera-jpeg app accessing an invalid StreamConfiguration offset.

Is this an issue you're aware of or can replicate?
It may be that we need to add some more defensive support in the libcamera StreamConfiguration API here of course ...

@davidplowman
Copy link
Collaborator

@kbingham Hi Kieran, thanks for this. I wasn't aware of it (or it would have been fixed!) but there does seem to be an obvious clanger in ConfigureStill. Let me fix that and then we'll see how things are.

@kbingham
Copy link
Author

@dwrobel Could you retest this with the latest code please?

@dwrobel
Copy link
Contributor

dwrobel commented Oct 1, 2021

I updated to the following versions:

and libcamera-jpeg seems to get stuck as follows:

$  libcamera-jpeg -o test.jpg
Preview window unavailable
[0:01:20.210404229] [867]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+1-24db7f96
[0:01:20.310786412] [867]  INFO Camera camera.cpp:937 configuring streams: (0) 1640x1232-YUV420
[0:01:20.311015649] [879]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt RG10 Score: 2218 (best 2218)
[0:01:20.311120444] [879]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RG10 Score: 2041.48 (best 2041.48)
[0:01:20.311158314] [879]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt RG10 Score: 1500 (best 1500)
[0:01:20.311189943] [879]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt RG10 Score: 5004.81 (best 1500)
[0:01:20.311222627] [879]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt pRAA Score: 1718 (best 1500)
[0:01:20.311252386] [879]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pRAA Score: 1541.48 (best 1500)
[0:01:20.311283034] [879]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt pRAA Score: 1000 (best 1000)
[0:01:20.311312700] [879]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt pRAA Score: 4504.81 (best 1000)
[0:01:20.311350681] [879]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt RGGB Score: 3218 (best 1000)
[0:01:20.311382051] [879]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RGGB Score: 3041.48 (best 1000)
[0:01:20.311413736] [879]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt RGGB Score: 2500 (best 1000)
[0:01:20.311444198] [879]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt RGGB Score: 6004.81 (best 1000)
[0:01:20.311606677] [879]  INFO RPI raspberrypi.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected mode: 1640x1232-pRAA
[0:01:22.385439814] [879] ERROR IPCPipe ipc_pipe_unixsocket.cpp:132 Call timeout!
[0:01:22.385505924] [879] ERROR IPCPipe ipc_pipe_unixsocket.cpp:64 Failed to call sync
[0:01:22.385530349] [879] ERROR IPAProxy raspberrypi_ipa_proxy.cpp:234 Failed to call start

backtrace:

$ gdb --args  libcamera-jpeg -o test.jpg
GNU gdb (GDB) Fedora 10.2-3.fc34
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 "armv7hl-redhat-linux-gnueabi".
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 libcamera-jpeg...
Reading symbols from /usr/lib/debug/usr/bin/libcamera-jpeg-0.0.0-0.4.20210930git8b232ca.fc34.arm.debug...
(gdb) r
Starting program: /usr/bin/libcamera-jpeg -o test.jpg
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
[New Thread 0xb2386020 (LWP 1494)]
[New Thread 0xb1b85020 (LWP 1495)]
[New Thread 0xb1384020 (LWP 1496)]
Preview window unavailable
[0:04:56.343366707] [1491]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+1-24db7f96
[New Thread 0xb0b83020 (LWP 1497)]
[Detaching after fork from child process 1498]
[0:04:56.417113659] [1491]  INFO Camera camera.cpp:937 configuring streams: (0) 1640x1232-YUV420
[0:04:56.417261138] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt RG10 Score: 2218 (best 2218)
[0:04:56.417332396] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RG10 Score: 2041.48 (best 2041.48)
[0:04:56.417367581] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt RG10 Score: 1500 (best 1500)
[0:04:56.417400025] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt RG10 Score: 5004.81 (best 1500)
[0:04:56.417433043] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt pRAA Score: 1718 (best 1500)
[0:04:56.417464932] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pRAA Score: 1541.48 (best 1500)
[0:04:56.417497505] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt pRAA Score: 1000 (best 1000)
[0:04:56.417528486] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt pRAA Score: 4504.81 (best 1000)
[0:04:56.417563449] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt RGGB Score: 3218 (best 1000)
[0:04:56.417594115] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RGGB Score: 3041.48 (best 1000)
[0:04:56.417625911] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt RGGB Score: 2500 (best 1000)
[0:04:56.417657447] [1497]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt RGGB Score: 6004.81 (best 1000)
[0:04:56.417801019] [1497]  INFO RPI raspberrypi.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected mode: 1640x1232-pRAA
[New Thread 0xaf643020 (LWP 1503)]
[0:04:58.517327622] [1497] ERROR IPCPipe ipc_pipe_unixsocket.cpp:132 Call timeout!
[0:04:58.517436528] [1497] ERROR IPCPipe ipc_pipe_unixsocket.cpp:64 Failed to call sync
[0:04:58.517498564] [1497] ERROR IPAProxy raspberrypi_ipa_proxy.cpp:234 Failed to call start
^C
Thread 1 "libcamera-jpeg" received signal SIGINT, Interrupt.
0xb6a47f88 in __futex_abstimed_wait_common64 (futex_word=futex_word@entry=0xbeffed00, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=0, private@entry=-1090524344, cancel=cancel@entry=true)
    at ../sysdeps/nptl/futex-internal.c:74
74	    err = INTERNAL_SYSCALL_CANCEL (futex_time64, futex_word, op, expected,
Missing separate debuginfos, use: dnf debuginfo-install libicu-67.1-7.fc34.armv7hl
(gdb) t a a bt

Thread 6 (Thread 0xaf643020 (LWP 1503) "libcamera-jpeg"):
#0  0xb6a47f88 in __futex_abstimed_wait_common64 (futex_word=futex_word@entry=0xbeffef28, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=0, private@entry=-1352390404, cancel=cancel@entry=true) at ../sysdeps/nptl/futex-internal.c:74
#1  0xb6a48038 in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0xbeffef28, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at ../sysdeps/nptl/futex-internal.c:123
#2  0xb6a40748 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0xbeffeee8, cond=0xbeffef00) at pthread_cond_wait.c:504
#3  __pthread_cond_wait (cond=0xbeffef00, mutex=0xbeffeee8) at pthread_cond_wait.c:619
#4  0xb6c8ec40 in __gthread_cond_wait (__mutex=<optimized out>, __cond=__cond@entry=0xbeffef00) at /usr/src/debug/gcc-11.2.1-1.fc34.arm/obj-armv7hl-redhat-linux-gnueabi/armv7hl-redhat-linux-gnueabi/libstdc++-v3/include/armv7hl-redhat-linux-gnueabi/bits/gthr-default.h:865
#5  std::__condvar::wait (__m=..., this=this@entry=0xbeffef00) at /usr/src/debug/gcc-11.2.1-1.fc34.arm/obj-armv7hl-redhat-linux-gnueabi/armv7hl-redhat-linux-gnueabi/libstdc++-v3/include/bits/std_mutex.h:155
#6  std::condition_variable::wait (this=this@entry=0xbeffef00, __lock=...) at ../../../../../libstdc++-v3/src/c++11/condition_variable.cc:41
#7  0xb6f9910c in std::condition_variable::wait<PostProcessor::outputThread()::<lambda()> > (__p=..., __lock=..., this=0xbeffef00) at /usr/include/c++/11/condition_variable:103
#8  PostProcessor::outputThread (this=0xbeffee70) at /usr/src/debug/libcamera-apps-0.0.0-0.4.20210930git8b232ca.fc34.arm/core/post_processor.cpp:123
#9  0xb6c950e8 in std::execute_native_thread_routine (__p=0x4b34b0) at ../../../../../libstdc++-v3/src/c++11/thread.cc:82
#10 0xb6a38c94 in start_thread (arg=0xaf643020) at pthread_create.c:481
#11 0xb6b3ec38 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 5 (Thread 0xb0b83020 (LWP 1497) "libcamera-jpeg"):
#0  0xb6b337c8 in __GI___ppoll64 (fds=0xb020b8c8, nfds=7, timeout=<optimized out>, sigmask=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:48
#1  0xb6b338c0 in __ppoll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>, sigmask=sigmask@entry=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:88
#2  0xb69f5404 in ppoll (__ss=0x0, __timeout=<optimized out>, __nfds=<optimized out>, __fds=<optimized out>) at /usr/include/bits/poll2.h:79
#3  libcamera::EventDispatcherPoll::poll (this=this@entry=0xb02026b8, pollfds=pollfds@entry=0xb0b82734) at ../src/libcamera/base/event_dispatcher_poll.cpp:223
#4  0xb69f5c54 in libcamera::EventDispatcherPoll::processEvents (this=0xb02026b8) at ../src/libcamera/base/event_dispatcher_poll.cpp:161
#5  0xb69feac0 in libcamera::Thread::exec (this=this@entry=0x4b2c98) at ../src/libcamera/base/thread.cpp:351
#6  0xb6e7d068 in libcamera::CameraManager::Private::run (this=0x4b2c90) at ../src/libcamera/camera_manager.cpp:120
#7  0xb6c950e8 in std::execute_native_thread_routine (__p=0x4b2ec8) at ../../../../../libstdc++-v3/src/c++11/thread.cc:82
#8  0xb6a38c94 in start_thread (arg=0xb0b83020) at pthread_create.c:481
#9  0xb6b3ec38 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 4 (Thread 0xb1384020 (LWP 1496) "libcamera-jpeg"):
#0  0xb6a47f88 in __futex_abstimed_wait_common64 (futex_word=futex_word@entry=0xbeffee08, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=0, private@entry=-1090523828, cancel=cancel@entry=true) at ../sysdeps/nptl/futex-internal.c:74
#1  0xb6a48038 in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0xbeffee08, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at ../sysdeps/nptl/futex-internal.c:123
#2  0xb6a40748 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0xbeffed4c, cond=0xbeffede0) at pthread_cond_wait.c:504
#3  __pthread_cond_wait (cond=0xbeffede0, mutex=0xbeffed4c) at pthread_cond_wait.c:619
#4  0xb6c8ec40 in __gthread_cond_wait (__mutex=<optimized out>, __cond=__cond@entry=0xbeffede0) at /usr/src/debug/gcc-11.2.1-1.fc34.arm/obj-armv7hl-redhat-linux-gnueabi/armv7hl-redhat-linux-gnueabi/libstdc++-v3/include/armv7hl-redhat-linux-gnueabi/bits/gthr-default.h:865
#5  std::__condvar::wait (__m=..., this=this@entry=0xbeffede0) at /usr/src/debug/gcc-11.2.1-1.fc34.arm/obj-armv7hl-redhat-linux-gnueabi/armv7hl-redhat-linux-gnueabi/libstdc++-v3/include/bits/std_mutex.h:155
#6  std::condition_variable::wait (this=this@entry=0xbeffede0, __lock=...) at ../../../../../libstdc++-v3/src/c++11/condition_variable.cc:41
#7  0xb6f7f410 in LibcameraApp::previewThread (this=<optimized out>) at /usr/src/debug/libcamera-apps-0.0.0-0.4.20210930git8b232ca.fc34.arm/core/libcamera_app.cpp:711
#8  0xb6c950e8 in std::execute_native_thread_routine (__p=0x4b1e10) at ../../../../../libstdc++-v3/src/c++11/thread.cc:82
#9  0xb6a38c94 in start_thread (arg=0xb1384020) at pthread_create.c:481
#10 0xb6b3ec38 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 3 (Thread 0xb1b85020 (LWP 1495) "libcamera-jpeg"):
#0  syscall () at ../sysdeps/unix/sysv/linux/arm/syscall.S:37
#1  0xb65a905c in futex (val3=0, uaddr2=0x0, timeout=0x0, val=0, op=0, uaddr=<optimized out>) at /usr/include/urcu/futex.h:94
#2  futex_async (op=0, val=0, timeout=0x0, uaddr2=0x0, val3=0, uaddr=<optimized out>) at /usr/include/urcu/futex.h:99
#3  wait_for_sessiond (sock_info=<optimized out>) at lttng-ust-comm.c:1432
#4  ust_listener_thread (arg=0xb660a024 <local_apps>) at lttng-ust-comm.c:1494
#5  0xb6a38c94 in start_thread (arg=0xb1b85020) at pthread_create.c:481
#6  0xb6b3ec38 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/libc.so.6
--Type <RET> for more, q to quit, c to continue without paging--
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 2 (Thread 0xb2386020 (LWP 1494) "libcamera-jpeg"):
#0  syscall () at ../sysdeps/unix/sysv/linux/arm/syscall.S:37
#1  0xb65a905c in futex (val3=0, uaddr2=0x0, timeout=0x0, val=0, op=0, uaddr=<optimized out>) at /usr/include/urcu/futex.h:94
#2  futex_async (op=0, val=0, timeout=0x0, uaddr2=0x0, val3=0, uaddr=<optimized out>) at /usr/include/urcu/futex.h:99
#3  wait_for_sessiond (sock_info=<optimized out>) at lttng-ust-comm.c:1432
#4  ust_listener_thread (arg=0xb660c068 <global_apps>) at lttng-ust-comm.c:1494
#5  0xb6a38c94 in start_thread (arg=0xb2386020) at pthread_create.c:481
#6  0xb6b3ec38 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0xb2389010 (LWP 1491) "libcamera-jpeg"):
#0  0xb6a47f88 in __futex_abstimed_wait_common64 (futex_word=futex_word@entry=0xbeffed00, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=0, private@entry=-1090524344, cancel=cancel@entry=true) at ../sysdeps/nptl/futex-internal.c:74
#1  0xb6a48038 in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0xbeffed00, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at ../sysdeps/nptl/futex-internal.c:123
#2  0xb6a40748 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0xbeffecc0, cond=0xbeffecd8) at pthread_cond_wait.c:504
#3  __pthread_cond_wait (cond=0xbeffecd8, mutex=0xbeffecc0) at pthread_cond_wait.c:619
#4  0xb6c8ec40 in __gthread_cond_wait (__mutex=<optimized out>, __cond=__cond@entry=0xbeffecd8) at /usr/src/debug/gcc-11.2.1-1.fc34.arm/obj-armv7hl-redhat-linux-gnueabi/armv7hl-redhat-linux-gnueabi/libstdc++-v3/include/armv7hl-redhat-linux-gnueabi/bits/gthr-default.h:865
#5  std::__condvar::wait (__m=..., this=this@entry=0xbeffecd8) at /usr/src/debug/gcc-11.2.1-1.fc34.arm/obj-armv7hl-redhat-linux-gnueabi/armv7hl-redhat-linux-gnueabi/libstdc++-v3/include/bits/std_mutex.h:155
#6  std::condition_variable::wait (this=this@entry=0xbeffecd8, __lock=...) at ../../../../../libstdc++-v3/src/c++11/condition_variable.cc:41
#7  0xb6f7b760 in std::condition_variable::wait<LibcameraApp::MessageQueue<LibcameraApp::Msg>::Wait()::{lambda()#1}>(std::unique_lock<std::mutex>&, LibcameraApp::MessageQueue<LibcameraApp::Msg>::Wait()::{lambda()#1}) (__p=..., __lock=..., this=0xbeffecd8) at /usr/include/c++/11/condition_variable:103
#8  LibcameraApp::MessageQueue<LibcameraApp::Msg>::Wait (this=0xbeffec98) at /usr/src/debug/libcamera-apps-0.0.0-0.4.20210930git8b232ca.fc34.arm/core/libcamera_app.hpp:143
#9  LibcameraApp::Wait (this=0xbeffebc8) at /usr/src/debug/libcamera-apps-0.0.0-0.4.20210930git8b232ca.fc34.arm/core/libcamera_app.cpp:438
#10 0x004078dc in event_loop (app=warning: can't find linker symbol for virtual table for `LibcameraJpegApp' value
warning:   found `libcamera::controls::Brightness' instead
...) at /usr/src/debug/libcamera-apps-0.0.0-0.4.20210930git8b232ca.fc34.arm/apps/libcamera_jpeg.cpp:48
#11 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/libcamera-apps-0.0.0-0.4.20210930git8b232ca.fc34.arm/apps/libcamera_jpeg.cpp:103
(gdb) 

P.S.: Building libcamera-apps produces quite a lot of warnings:

$ curl -s https://download.copr.fedorainfracloud.org/results/dwrobel/libcamera-apps/fedora-rawhide-armhfp/02869106-libcamera-apps/builder-live.log.gz | gzip -d | grep -e '/builddir.*warning:' | wc -l
46

Please consider to look at them and fix some of them e.g.:

frame_info.hpp:45:33: note: use reference type to prevent copying
   45 |                 for (auto const t : tokens)
      |                                 ^
      |                                 &

@davidplowman
Copy link
Collaborator

@dwrobel Thanks for the extra info. Couple of things:

  1. It turns out we thought we were compiling with warnings enabled but weren't. Oops. We'll fix that!

  2. It seems to be trying to run the Raspberry Pi IPA through the IPC sandbox mechanism, which isn't the normal procedure. I guess there's a question as to why it would be trying to do this, and also why it wouldn't "just work" when it's fine without the IPC wrapper. @kbingham Can you help us with any suggestions about this?

@kbingham
Copy link
Author

kbingham commented Oct 1, 2021

Hard to know off the bat why it's running an isolated IPA - but if the modules are not signed, or the libraries aren't available to check the signatrues then it will likely cause it to get isolated.

Check that the packages:
libgnutls28-dev openssl
are installed.

We should add that to the build summary to make it easy to spot if it gets disabled.

That said, things should function with an isolated IPA - but of course it probably hasn't been tested on the RPi.
I'm away on holiday for a week now, so I'm sorry in advance for any delay in further responses.

@davidplowman
Copy link
Collaborator

I've investigated this at fairly great length. It turns out that passing ControlLists across libcamera's pipeine handler / IPA interface is fussier when running in the "isolation" mode. This patch #109 fixes the libcamera-apps end of the problem, but anything that does a camera mode switch will need a patch in libcamera itself too.

@davidplowman
Copy link
Collaborator

The necessary patch seems just to have gone into libcamera as well now, so I believe everything here should be good. Please let us know if it isn't otherwise I'll proceed to close this issue shortly.

@davidplowman
Copy link
Collaborator

We've finally merged a test for the IPA isolation problem into our automatic tests and everything seems fine. Also all the warnings have been sorted out so I'm going to close this. Please open a new issue if any problems reappear. Thanks!

@dwrobel
Copy link
Contributor

dwrobel commented Oct 11, 2021

Updating to:

allowed me to run it successfully:

$ time libcamera-jpeg -o test.jpeg
Preview window unavailable
[251:39:09.394290233] [21629]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+1-c1d703c3
[251:39:09.465335712] [21629]  INFO Camera camera.cpp:937 configuring streams: (0) 1640x1232-YUV420
[251:39:09.465482024] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt RG10 Score: 2218 (best 2218)
[251:39:09.465550245] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RG10 Score: 2041.48 (best 2041.48)
[251:39:09.465585393] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt RG10 Score: 1500 (best 1500)
[251:39:09.465618356] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt RG10 Score: 5004.81 (best 1500)
[251:39:09.465651059] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt pRAA Score: 1718 (best 1500)
[251:39:09.465680762] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pRAA Score: 1541.48 (best 1500)
[251:39:09.465712669] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt pRAA Score: 1000 (best 1000)
[251:39:09.465742446] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt pRAA Score: 4504.81 (best 1000)
[251:39:09.465775927] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt RGGB Score: 3218 (best 1000)
[251:39:09.465806408] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RGGB Score: 3041.48 (best 1000)
[251:39:09.465836482] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt RGGB Score: 2500 (best 1000)
[251:39:09.465865315] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt RGGB Score: 6004.81 (best 1000)
[251:39:09.466009128] [21633]  INFO RPI raspberrypi.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected mode: 1640x1232-pRAA
[251:39:09.497173550] [21633]  INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[251:39:09.497215309] [21633]  INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[251:39:09.497241382] [21633]  INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[251:39:09.602348279] [21633]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (6 left)
[251:39:09.635673448] [21633]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (5 left)
[251:39:09.669937289] [21633]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (4 left)
[251:39:09.701826923] [21633]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (3 left)
[251:39:09.734998298] [21633]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (2 left)
[251:39:09.769024772] [21633]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (1 left)
[251:39:09.800469838] [21633]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (0 left)
[251:39:14.640330266] [21629]  INFO Camera camera.cpp:937 configuring streams: (0) 3280x2464-YUV420
[251:39:14.640495875] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt BG10 Score: 1500 (best 1500)
[251:39:14.640558874] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt BG10 Score: 7155.48 (best 1500)
[251:39:14.640599485] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt BG10 Score: 7244 (best 1500)
[251:39:14.640637225] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt BG10 Score: 10748.8 (best 1500)
[251:39:14.640677298] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt BA81 Score: 2500 (best 1500)
[251:39:14.640716242] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt BA81 Score: 8155.48 (best 1500)
[251:39:14.640756038] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt BA81 Score: 8244 (best 1500)
[251:39:14.640794760] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt BA81 Score: 11748.8 (best 1500)
[251:39:14.640833222] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 3280x2464 fmt pBAA Score: 1000 (best 1000)
[251:39:14.640870221] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pBAA Score: 6655.48 (best 1000)
[251:39:14.640908721] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 1640x1232 fmt pBAA Score: 6744 (best 1000)
[251:39:14.640947294] [21633]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt pBAA Score: 10248.8 (best 1000)
[251:39:14.641135273] [21633]  INFO RPI raspberrypi.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected mode: 3280x2464-pBAA
Still capture image received

real	0m6.122s
user	0m0.385s
sys	0m0.477s

Thank you for fixing it!

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

3 participants