Repository: opencv
Issue: opencv_test_videoio appears to hang on aarch64-linux
Labels: bug,test,category: videoio,category: photo,category: 3rdparty

### System Information

OpenCV version: 4.7.0
Operating System / Platform: Guix System
Compiler & compiler version: GCC 11.3.0


### Detailed description

When attempting to build OpenCV 4.7.0 on a Rasbperry Pi 4 (4 cores with 4 GiB of RAM), it proceeds until the test suite, and appears to hang on the opencv_test_vid (running for more than 200 CPU minutes, and strace shows nothing but waiting on some process.  The CPU is peak for one core (100%) and uses about 177 MiB of resident memory.

```
$ cat /proc/10890/cmdline | xargs -0
/tmp/guix-build-opencv-4.7.0.drv-0/build/bin/opencv_test_videoio --gtest_output=xml:opencv_test_videoio.xml
```
```
# strace -f -p10890 -s400
strace: Process 10890 attached with 11 threads
[pid 11287] futex(0x5a6334, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 11286] futex(0x5a61c4, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 11284] futex(0x5a64a0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 10897] futex(0x5b3f94, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 10896] futex(0x5b6b34, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 10895] futex(0x5b3900, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 10894] futex(0x7ff58f6168, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 10893] futex(0x7ff58f60e8, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 10892] futex(0x7ff58f6068, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 10890] futex(0x5a61f0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY^Cstrace: Process 10890 detached
 <detached ...>
```

```
# lsof -p 10890
COMMAND     PID          USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
opencv_te 10890 guixbuilder01  cwd    DIR  179,2     4096 205587 /tmp/guix-build-opencv-4.7.0.drv-0/build/test-reports/accuracy
opencv_te 10890 guixbuilder01  rtd    DIR  179,2     4096 570021 /
opencv_te 10890 guixbuilder01  txt    REG  179,2  8494000 277914 /tmp/guix-build-opencv-4.7.0.drv-0/build/bin/opencv_test_videoio
opencv_te 10890 guixbuilder01  mem    REG  179,2  1963472 568158 /gnu/store/i2f7farzqaxwc18fav9s9702c0lyxb9l-x265-3.5/lib/libx265_main10.so.199
opencv_te 10890 guixbuilder01  mem    REG  179,2  1963472 568160 /gnu/store/i2f7farzqaxwc18fav9s9702c0lyxb9l-x265-3.5/lib/libx265_main12.so.199
opencv_te 10890 guixbuilder01  mem    REG  179,2   170040 411125 /gnu/store/3ka1dh05dc244ffp3z8rchs7a5gmyh97-expat-2.5.0/lib/libexpat.so.1.8.10
opencv_te 10890 guixbuilder01  mem    REG  179,2   249136 410919 /gnu/store/vwkiblwq7y8xiflg51cnk2a3x1wwiysj-gcc-11.3.0-lib/lib/libgomp.so.1.0.0
opencv_te 10890 guixbuilder01  mem    REG  179,2    22552 413808 /gnu/store/rlgxm87dv49h762iqr70k42iw1dgkija-libxdmcp-1.1.3/lib/libXdmcp.so.6.0.0
opencv_te 10890 guixbuilder01  mem    REG  179,2    14352 413641 /gnu/store/9l32gcq0kif58vsn8dh9402h86r5ynn7-libxau-1.0.10/lib/libXau.so.6.0.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   150320 413962 /gnu/store/r53ki4dlvbgvxdhkxh5iy2a4cffldmrk-libxcb-1.15/lib/libxcb.so.1.1.0
opencv_te 10890 guixbuilder01  mem    REG  179,2    77280 512194 /gnu/store/1g3q3vzfswvgf17yhvimkl7gfhrwyxap-libxext-1.3.4/lib/libXext.so.6.4.0
opencv_te 10890 guixbuilder01  mem    REG  179,2  4328704 417611 /gnu/store/2hr7w64zhr6jjznidyc2xi40d5ynhj9c-openssl-3.0.8/lib/libcrypto.so.3
opencv_te 10890 guixbuilder01  mem    REG  179,2   675688 417613 /gnu/store/2hr7w64zhr6jjznidyc2xi40d5ynhj9c-openssl-3.0.8/lib/libssl.so.3
opencv_te 10890 guixbuilder01  mem    REG  179,2   455496 411220 /gnu/store/r27hbc5b5mnfkfnprqqacpa6xvk1ndid-gmp-6.2.1/lib/libgmp.so.10.4.1
opencv_te 10890 guixbuilder01  mem    REG  179,2   294832 417450 /gnu/store/f0bbds3l2crk7rqwwccpssagjp81a3dr-nettle-3.8.1/lib/libhogweed.so.6.6
opencv_te 10890 guixbuilder01  mem    REG  179,2   298728 417453 /gnu/store/f0bbds3l2crk7rqwwccpssagjp81a3dr-nettle-3.8.1/lib/libnettle.so.8.6
opencv_te 10890 guixbuilder01  mem    REG  179,2    76120 413518 /gnu/store/zaz5y4qgc8y3rs3rqaq2f8sy3wb01ywr-libtasn1-4.19.0/lib/libtasn1.so.6.6.3
opencv_te 10890 guixbuilder01  mem    REG  179,2  1720288 413601 /gnu/store/lhr13y0zvd5k9x822rw0gi3wp33bil3z-libunistring-1.0/lib/libunistring.so.2.2.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   326072 413670 /gnu/store/dbsrchh9qa53x9v6l8g02z5p8zfx051q-libidn2-2.3.4/lib/libidn2.so.0.3.8
opencv_te 10890 guixbuilder01  mem    REG  179,2    92680 413112 /gnu/store/21wjvkvapcw47i4xmqb401jq5gg6r5v3-libffi-3.4.4/lib/libffi.so.8.1.2
opencv_te 10890 guixbuilder01  mem    REG  179,2  1282720 417653 /gnu/store/z8dyjqpjr8xnzss046ks59iyd8jga6a8-p11-kit-0.24.1/lib/libp11-kit.so.0.3.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   687200 426769 /gnu/store/8qnw76kg8r8jabajzvx7syj1npn7drxq-freetype-2.13.0/lib/libfreetype.so.6.19.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   306000 426968 /gnu/store/8vy461vmh99ppg0wbkz5b063mxyj4m2w-fontconfig-minimal-2.14.0/lib/libfontconfig.so.1.12.0
opencv_te 10890 guixbuilder01  mem    REG  179,2  1468664 426894 /gnu/store/q4nm8mm3xags3h8gw7mp9fm5kh57vb2g-libxml2-2.9.14/lib/libxml2.so.2.9.14
opencv_te 10890 guixbuilder01  mem    REG  179,2    34888 448139 /gnu/store/zpiz58g8zigdfxqs05kg9j8y1aclvyfg-libogg-1.3.5/lib/libogg.so.0.8.5
opencv_te 10890 guixbuilder01  mem    REG  179,2   129712 565273 /gnu/store/41ms0wr118s7yk2lixcc7bqyhwh0g117-soxr-0.1.3/lib/libsoxr.so.0.1.2
opencv_te 10890 guixbuilder01  mem    REG  179,2  1411776 444522 /gnu/store/001qlsszv4z8cbyb3h92yn1x4xmqcw85-gfortran-11.3.0-lib/lib/libgfortran.so.5.0.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   574152 562093 /gnu/store/qj2pyi9vjmq3gahiyi3zrjfyv9294am0-openexr-3.1.3/lib/libIex-3_1.so.30.3.0
opencv_te 10890 guixbuilder01  mem    REG  179,2    31144 562097 /gnu/store/qj2pyi9vjmq3gahiyi3zrjfyv9294am0-openexr-3.1.3/lib/libIlmThread-3_1.so.30.3.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   300992 541646 /gnu/store/5azsqg5clqwp30q39vffd85r72i97w2l-imath-3.1.3/lib/libImath-3_1.so.29.2.0
opencv_te 10890 guixbuilder01  mem    REG  179,2    80616 447906 /gnu/store/fyxmnrhbxcmgqzvmczj2wq03c7108xxz-libdrm-2.4.114/lib/libdrm.so.2.4.0
opencv_te 10890 guixbuilder01  mem    REG  179,2  1284464 414035 /gnu/store/l2ydpr0r82rjmjpcavgw207h0w1n6r39-libx11-1.8.1/lib/libX11.so.6.4.0
opencv_te 10890 guixbuilder01  mem    REG  179,2    14416 543036 /gnu/store/hg8m4mz5g2gzv7f38kwpplwp7yvx8yml-libvdpau-1.5/lib/libvdpau.so.1.0.0
opencv_te 10890 guixbuilder01  mem    REG  179,2    10256 453111 /gnu/store/immf3yra7wqmx1cvsmvyc4jgsrri353k-libva-2.18.0/lib/libva-drm.so.2.1800.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   771080 565347 /gnu/store/0ap3fnvqxv9xph4f9alzs972wr24a7fd-srt-1.4.4/lib/libsrt.so.1.4.4
opencv_te 10890 guixbuilder01  mem    REG  179,2  2156024 423774 /gnu/store/vvvpn9263maw9pqx1cdicg9y7sp0hz3w-gnutls-3.7.7/lib/libgnutls.so.30.34.1
opencv_te 10890 guixbuilder01  mem    REG  179,2   293648 541901 /gnu/store/fwzq780dzzc3hfdvn99mfkzv3dravygv-libbluray-1.0.2/lib/libbluray.so.2.0.2
opencv_te 10890 guixbuilder01  mem    REG  179,2    70864 411091 /gnu/store/nbalv23p48cdwf9m651s4yagcacsay2l-bzip2-1.0.8/lib/libbz2.so.1.0.8
opencv_te 10890 guixbuilder01  mem    REG  179,2   186736 453127 /gnu/store/immf3yra7wqmx1cvsmvyc4jgsrri353k-libva-2.18.0/lib/libva.so.2.1800.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   416704 568780 /gnu/store/pj4cc5fhi468fcigphf62imh6435g2hy-xvid-1.3.7/lib/libxvidcore.so.4.3
opencv_te 10890 guixbuilder01  mem    REG  179,2  1140072 568156 /gnu/store/i2f7farzqaxwc18fav9s9702c0lyxb9l-x265-3.5/lib/libx265.so.199
opencv_te 10890 guixbuilder01  mem    REG  179,2  1658024 543074 /gnu/store/bwr1gg8rh14jxpp6mb4pfdcpxyldx2q5-libx264-164-0.b093bbe/lib/libx264.so.164
opencv_te 10890 guixbuilder01  mem    REG  179,2   665608 512022 /gnu/store/3rwdcni245vs5hrfbhrl81wrfvddlf85-libvorbis-1.3.7/lib/libvorbisenc.so.2.0.12
opencv_te 10890 guixbuilder01  mem    REG  179,2   207440 512018 /gnu/store/3rwdcni245vs5hrfbhrl81wrfvddlf85-libvorbis-1.3.7/lib/libvorbis.so.0.4.9
opencv_te 10890 guixbuilder01  mem    REG  179,2   125528 565535 /gnu/store/w0iny9dgwc2a78yxi71094dfk6wk4q6r-twolame-0.4.0/lib/libtwolame.so.0.0.0
opencv_te 10890 guixbuilder01  mem    REG  179,2    88256 448945 /gnu/store/a6xmi5kgq7igm86ylliz2d21m2firr0i-libtheora-1.1.1/lib/libtheoradec.so.1.1.4
opencv_te 10890 guixbuilder01  mem    REG  179,2   202944 448949 /gnu/store/a6xmi5kgq7igm86ylliz2d21m2firr0i-libtheora-1.1.1/lib/libtheoraenc.so.1.1.2
opencv_te 10890 guixbuilder01  mem    REG  179,2    92288 565314 /gnu/store/336wvfy3zzbg996pa63h0fl410ig1ish-speex-1.2.1/lib/libspeex.so.1.5.2
opencv_te 10890 guixbuilder01  mem    REG  179,2   317688 450511 /gnu/store/q3d8r3wl1jjlc25x30v2bzh5l78nd066-opus-1.3.1/lib/libopus.so.0.8.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   412424 541767 /gnu/store/pwn38m8mh0pzmlpjvlcfc0gl1kq9p0dc-lame-3.100/lib/libmp3lame.so.0.0.0
opencv_te 10890 guixbuilder01  mem    REG  179,2  2649856 447526 /gnu/store/wq59kj7qx2dhasl95hfsbimc6qykgd84-libaom-3.5.0/lib/libaom.so.3.5.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   741656 443803 /gnu/store/k40l83dzivsswhz61qad8i72m0xsq130-dav1d-1.0.0/lib/libdav1d.so.6.6.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   154160 422629 /gnu/store/qbhy2zzqzzfqbr7s59y513bxd1w22wzb-xz-5.2.8/lib/liblzma.so.5.2.8
opencv_te 10890 guixbuilder01  mem    REG  179,2    34960 533824 /gnu/store/bp4w7cjzrm5aa1fxznn9zmvnqwwj1mr9-libwebp-1.2.4/lib/libwebpmux.so.3.0.10
opencv_te 10890 guixbuilder01  mem    REG  179,2  1628576 543061 /gnu/store/9w0fbf6cy9jq5nysjmy9v39x9pqbwj8q-libvpx-1.12.0/lib/libvpx.so.7.1.0
opencv_te 10890 guixbuilder01  mem    REG  179,2    88440 568965 /gnu/store/1ic8l8j9vapxhikcfi00pbvw1zpb70cv-ffmpeg-4.4.2/lib/libswresample.so.3.9.100
opencv_te 10890 guixbuilder01  mem    REG  179,2 22871280 450485 /gnu/store/1z09dpfxyv8qc8dkg66khiqp907gprps-openblas-0.3.20/lib/libopenblasp-r0.3.20.so
opencv_te 10890 guixbuilder01  mem    REG  179,2   108864 422981 /gnu/store/mk1db7g5shryr5q5l9xny4a506krmaw2-zlib-1.2.13/lib/libz.so.1.2.13
opencv_te 10890 guixbuilder01  mem    REG  179,2  3037248 562101 /gnu/store/qj2pyi9vjmq3gahiyi3zrjfyv9294am0-openexr-3.1.3/lib/libOpenEXR-3_1.so.30.3.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   356008 515384 /gnu/store/kh6acd922yi2f8vnak7b5rq1ckrk8yxl-openjpeg-2.5.0/lib/libopenjp2.so.2.5.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   511576 449067 /gnu/store/b51zhxq9icwngf0vvd66kjr6499lkjnj-libtiff-4.4.0/lib/libtiff.so.5.8.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   203760 426580 /gnu/store/zhiqm2c1jqqwsnj3rfkf794z3yxbm5z0-libpng-1.6.37/lib/libpng16.so.16.37.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   330224 533812 /gnu/store/bp4w7cjzrm5aa1fxznn9zmvnqwwj1mr9-libwebp-1.2.4/lib/libwebp.so.7.1.5
opencv_te 10890 guixbuilder01  mem    REG  179,2   412304 448045 /gnu/store/xg0p7nn8x1rpcain91wb749mxqxfm3j5-libjpeg-turbo-2.1.4/lib/libjpeg.so.62.3.0
opencv_te 10890 guixbuilder01  mem    REG  179,2   407832 568968 /gnu/store/1ic8l8j9vapxhikcfi00pbvw1zpb70cv-ffmpeg-4.4.2/lib/libswscale.so.5.9.100
opencv_te 10890 guixbuilder01  mem    REG  179,2   540464 568959 /gnu/store/1ic8l8j9vapxhikcfi00pbvw1zpb70cv-ffmpeg-4.4.2/lib/libavutil.so.56.70.100
opencv_te 10890 guixbuilder01  mem    REG  179,2  2458152 568953 /gnu/store/1ic8l8j9vapxhikcfi00pbvw1zpb70cv-ffmpeg-4.4.2/lib/libavformat.so.58.76.100
opencv_te 10890 guixbuilder01  mem    REG  179,2 11584392 568944 /gnu/store/1ic8l8j9vapxhikcfi00pbvw1zpb70cv-ffmpeg-4.4.2/lib/libavcodec.so.58.134.100
opencv_te 10890 guixbuilder01  mem    REG  179,2  1978960 409496 /gnu/store/a19xbynxc3sg25xpkwmx7g0mdl7g31hx-glibc-2.35/lib/libc.so.6
opencv_te 10890 guixbuilder01  mem    REG  179,2    84240 410914 /gnu/store/vwkiblwq7y8xiflg51cnk2a3x1wwiysj-gcc-11.3.0-lib/lib/libgcc_s.so.1
opencv_te 10890 guixbuilder01  mem    REG  179,2  2100072 410950 /gnu/store/vwkiblwq7y8xiflg51cnk2a3x1wwiysj-gcc-11.3.0-lib/lib/libstdc++.so.6.0.29
opencv_te 10890 guixbuilder01  mem    REG  179,2   646560 409505 /gnu/store/a19xbynxc3sg25xpkwmx7g0mdl7g31hx-glibc-2.35/lib/libm.so.6
opencv_te 10890 guixbuilder01  mem    REG  179,2          276325 /tmp/guix-build-opencv-4.7.0.drv-0/build/lib/libopencv_core.so.4.7.0 (stat: No such file or directory)
opencv_te 10890 guixbuilder01  mem    REG  179,2          276521 /tmp/guix-build-opencv-4.7.0.drv-0/build/lib/libopencv_imgproc.so.4.7.0 (stat: No such file or directory)
opencv_te 10890 guixbuilder01  mem    REG  179,2          276680 /tmp/guix-build-opencv-4.7.0.drv-0/build/lib/libopencv_imgcodecs.so.4.7.0 (stat: No such file or directory)
opencv_te 10890 guixbuilder01  mem    REG  179,2          276922 /tmp/guix-build-opencv-4.7.0.drv-0/build/lib/libopencv_videoio.so.4.7.0 (stat: No such file or directory)
opencv_te 10890 guixbuilder01  mem    REG  179,2   211440 409489 /gnu/store/a19xbynxc3sg25xpkwmx7g0mdl7g31hx-glibc-2.35/lib/ld-linux-aarch64.so.1
opencv_te 10890 guixbuilder01    0u   CHR    1,3      0t0      5 /null
opencv_te 10890 guixbuilder01    1w  FIFO   0,12      0t0  56451 pipe
opencv_te 10890 guixbuilder01    2w  FIFO   0,12      0t0  56451 pipe
opencv_te 10890 guixbuilder01    3w   REG  179,2  1743831 205830 /tmp/guix-build-opencv-4.7.0.drv-0/build/Testing/Temporary/LastTest.log.tmp
opencv_te 10890 guixbuilder01    4r   CHR    1,9      0t0     10 /dev/urandom
opencv_te 10890 guixbuilder01    5r   REG  179,2    37328 268774 /tmp/guix-build-opencv-4.7.0.drv-0/opencv-extra/testdata/highgui/video/sample_322x242_15frames.yuv420p.libx265.mp4
```

### Steps to reproduce

```
# Install Guix on an aarch64-linux machine, such as the Raspberry Pi 4
wget -O- guix-install.sh https://guix-install.sh && yes | sudo ./guix-install.sh

# Have it on the same commit used to test:
guix pull --commit=deda3cc9057f20b1e3d34d63a64da0bdd6ca1998

# Logout, then back in.

# Run the test
guix build opencv --keep-failed

# If you are on aarch64, the test should hang at some point.
```

The build is known to be healthy on x86_64 according to the Guix build farm, e.g.: https://ci.guix.gnu.org/build/1398638/log/raw.

### Issue submission checklist

- [X] I report the issue, it's not a question
- [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [X] I updated to the latest OpenCV version and the issue is still there
- [X] There is reproducer code and related data files (videos, images, onnx, etc)