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

mmal_port_disable() hangs up #687

Open
vzhukovskyy opened this issue Mar 24, 2021 · 0 comments
Open

mmal_port_disable() hangs up #687

vzhukovskyy opened this issue Mar 24, 2021 · 0 comments

Comments

@vzhukovskyy
Copy link

Closing decoder-encoder connection hangs up in mmal_port_disable(). On 2 raspberries it constantly works fine, on 2 always hangs up.

#0  0x76efa088 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=1, futex_word=0x768e51a8 <client+36>) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x768e51a8 <client+36>, abstime=0x0) at sem_waitcommon.c:115
#2  0x76efa1f4 in __new_sem_wait_slow (sem=0x768e51a8 <client+36>, abstime=0x0) at sem_waitcommon.c:282
#3  0x768cf9c0 in mmal_vc_sendwait_message () from /opt/vc/lib/libmmal_vc_client.so
#4  0x768d2854 in mmal_vc_port_disable () from /opt/vc/lib/libmmal_vc_client.so
#5  0x76d977d8 in mmal_port_disable_internal () from /opt/vc/lib/libmmal_core.so
#6  0x76d983d8 in mmal_port_disable () from /opt/vc/lib/libmmal_core.so
#7  0x00014fd0 in video_transcode (arg=0x0) at video_transcode.c:236
#8  0x76ef0494 in start_thread (arg=0x683fa440) at pthread_create.c:486
#9  0x76b21578 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/arm-linux-gnueabihf/libc.so.6

I close the connection like this:

    MMAL_CHECK(mmal_port_disable(decoder->input[0]));
    MMAL_CHECK(mmal_port_disable(encoder->output[0]));
    mmal_port_pool_destroy(decoder->input[0], decoder_pool_in);
    mmal_port_pool_destroy(encoder->output[0], encoder_pool_out);
    MMAL_CHECK(mmal_connection_disable(conn));
    MMAL_CHECK(mmal_connection_destroy(conn));
    MMAL_CHECK(mmal_component_destroy(decoder));
    MMAL_CHECK(mmal_component_destroy(encoder));

This code works OK on

PI3 1.2GHz

cat /etc/rpi-issue
Raspberry Pi reference 2020-02-13
vcgencmd version
Feb 12 2020 12:38:08 
uname -a
Linux r3 4.19.97-v7+ #1294 SMP Thu Jan 30 13:15:58 GMT 2020 armv7l GNU/Linux

PI3 1.2GHz

cat /etc/rpi-issue
Raspberry Pi reference 2019-09-26
vcgencmd version
Sep 24 2019 17:37:19
uname -a
Linux r4 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux

Does not work on

PI3 1.4GHz

cat /etc/rpi-issue
Raspberry Pi reference 2021-01-11
vcgencmd version
Jan  8 2021 14:33:35
uname -a
Linux r2 5.4.83-v7+ #1379 SMP Mon Dec 14 13:08:57 GMT 2020 armv7l GNU/Linux  

PI4

cat /etc/rpi-issue
Raspberry Pi reference 2020-05-27
vcgencmd version
Jan 27 2021 22:20:57
uname -a
Linux r5 5.10.11-v7l+ #1399 SMP Thu Jan 28 12:09:48 GMT 2021 armv7l GNU/Linux

The reason why I explicitly destroy pools is that my program starts and stops encoding periodically, and if I don't destroy pools, vc.ril.video_de and vc.ril.video_en threads do not exit and stack up, in mmal logs there is a "delayed destruction" message because of unreleased reference.

Before disabling the ports I send EOS and wait until I receive it back, if it matters.

The only line that appears in the logs enabled with export VC_LOGLEVEL=mmal:trace is this
mmal: mmal_port_disable: vc.ril.video_decode(2:0) port 0x67a00ea0

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

1 participant