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

videobuf2_common Driver bug on Raspberry Pi Zero W causes non-recoverable camera timeout on streaming application #4824

Open
topeolufe opened this issue Jan 12, 2022 · 0 comments

Comments

@topeolufe
Copy link

Describe the bug

I have a gocv server application streaming video frames from the onboard camera to clients over a websocket. After a few frames (about 5 frames), I begin to see a select timeout on the device as follows:

global /home/pi/opencv-4.5.3/modules/videoio/src/cap_v4l.cpp (1001) tryIoctl VIDEOIO(V4L2:/dev/video2): select() timeout.

I also notice that the following in dmesg

[ 2930.549872] ------------[ cut here ]------------
[ 2930.550003] WARNING: CPU: 0 PID: 11721 at drivers/media/common/videobuf2/videobuf2-core.c:1956 __vb2_queue_cancel+0x214/0x294 [videobuf2_common]
[ 2930.550016] Modules linked in: bnep ov5647 hci_uart btbcm bluetooth ecdh_generic snd_soc_hdmi_codec ecc libaes 8021q garp stp llc snd_usb_audio snd_hwdep snd_usbmidi_lib snd_rawmidi snd_seq_device uvcvideo br
cmfmac brcmutil vc4 sha256_generic libsha256 cec drm_kms_helper cfg80211 raspberrypi_hwmon snd_soc_core rfkill snd_compress snd_pcm_dmaengine syscopyarea sysfillrect i2c_mux_pinctrl sysimgblt i2c_mux fb_sys_fops
bcm2835_unicam v4l2_dv_timings v4l2_fwnode i2c_bcm2835 bcm2835_codec(C) bcm2835_isp(C) bcm2835_v4l2(C) v4l2_mem2mem bcm2835_mmal_vchiq(C) videobuf2_vmalloc videobuf2_dma_contig snd_bcm2835(C) videobuf2_memops v
ideobuf2_v4l2 videobuf2_common snd_pcm snd_timer snd videodev mc vc_sm_cma(C) fixed uio_pdrv_genirq uio i2c_dev drm fuse drm_panel_orientation_quirks backlight ip_tables x_tables ipv6
[ 2930.550563] CPU: 0 PID: 11721 Comm: streamer Tainted: G WC 5.10.63+ #1488
[ 2930.550574] Hardware name: BCM2835
[ 2930.550583] Backtrace:
[ 2930.550634] [] (dump_backtrace) from [] (show_stack+0x20/0x24)
[ 2930.550652] r7:000007a4 r6:00000009 r5:bf34a688 r4:c0a70ae0
[ 2930.550674] [] (show_stack) from [] (dump_stack+0x28/0x30)
[ 2930.550701] [] (dump_stack) from [] (__warn+0xe8/0x110)
[ 2930.550715] r5:bf34a688 r4:bf34ff78
[ 2930.550736] [] (__warn) from [] (warn_slowpath_fmt+0x68/0xd8)
[ 2930.550753] r7:00000009 r6:bf34a688 r5:000007a4 r4:bf34ff78
[ 2930.550817] [] (warn_slowpath_fmt) from [] (__vb2_queue_cancel+0x214/0x294 [videobuf2_common])
[ 2930.550838] r9:c0bb302c r8:00000001 r7:c3485220 r6:c18f6390 r5:c18f6390 r4:c18f6390
[ 2930.550921] [] (__vb2_queue_cancel [videobuf2_common]) from [] (vb2_core_streamoff+0x28/0xc0 [videobuf2_common])
[ 2930.550942] r10:00000004 r9:c0bb302c r8:00000001 r7:c3485220 r6:c18f64e8 r5:c18f6390
[ 2930.550952] r4:c18f6390
[ 2930.551028] [] (vb2_core_streamoff [videobuf2_common]) from [] (__vb2_cleanup_fileio+0x2c/0x84 [videobuf2_common])
[ 2930.551043] r5:c18f6390 r4:c1a0f000
[ 2930.551119] [] (__vb2_cleanup_fileio [videobuf2_common]) from [] (vb2_core_queue_release+0x20/0x48 [videobuf2_common])
[ 2930.551134] r5:c18f63f0 r4:c18f6390
[ 2930.551232] [] (vb2_core_queue_release [videobuf2_common]) from [] (_vb2_fop_release+0x74/0x94 [videobuf2_v4l2])
[ 2930.551247] r5:cef6b300 r4:00000000
[ 2930.551317] [] (_vb2_fop_release [videobuf2_v4l2]) from [] (unicam_v4l2_release+0x4c/0xd8 [bcm2835_unicam])
[ 2930.551335] r7:c3485220 r6:cef6b300 r5:c18f64dc r4:c18f6278
[ 2930.551732] [] (unicam_v4l2_release [bcm2835_unicam]) from [] (v4l2_release+0xd4/0xe8 [videodev])
[ 2930.551755] r9:c0bb302c r8:c804c088 r7:c11f86d0 r6:000a001d r5:cef6b300 r4:c18f64e8
[ 2930.551975] [] (v4l2_release [videodev]) from [] (__fput+0x90/0x250)
[ 2930.551992] r5:c518bc58 r4:cef6b300
[ 2930.552012] [] (__fput) from [] (____fput+0x18/0x1c)
[ 2930.552031] r9:c0bb302c r8:c00083e4 r7:c0cfcb80 r6:c5f2d640 r5:c5f2dac4 r4:00000000
[ 2930.552063] [] (____fput) from [] (task_work_run+0x9c/0xe8)
[ 2930.552086] [] (task_work_run) from [] (do_work_pending+0x4b4/0x558)
[ 2930.552101] r7:c0bb3028 r6:c2861fb0 r5:00000000 r4:ffffe000
[ 2930.552119] [] (do_work_pending) from [] (slow_work_pending+0xc/0x20)
[ 2930.552131] Exception stack(0xc2861fb0 to 0xc2861ff8)
[ 2930.552146] 1fa0: 00000000 9c6fef80 00000000 00000003
[ 2930.552163] 1fc0: 9bd01650 9c6fef80 9c6fdf0c 00000006 9bd00cac 9c6fdf68 01000780 00000000
[ 2930.552178] 1fe0: 00000000 9c6fded8 00000000 b5f7a018 80000010 00000003
[ 2930.552196] r10:00000000 r9:c2860000 r8:c00083e4 r7:00000006 r6:9c6fdf0c r5:9c6fef80
[ 2930.552207] r4:9bd01650
[ 2930.552218] ---[ end trace a00f58a46d33813b ]---
[ 2930.552237] videobuf2_common: driver bug: stop_streaming operation is leaving buf 31a490c6 in active state

Steps to reproduce the behaviour

  1. Start the server streamer in the terminal.
  2. Connect a browser client to the server and begin getting streams from the camera over the websocket.
  3. After a few frames, a non-recoverable timeout occurs on the camera.

Device (s)

Raspberry Pi Zero W / WH

System

Output of /etc/rpi-issue

Raspberry Pi reference 2021-10-30
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 288b21fc27e128ea6b330777aca68e0061ebf4fe, stage4

Output of vcgencmd version

Nov 18 2021 16:18:09
Copyright (c) 2012 Broadcom
version d9b293558b4cef6aabedcc53c178e7604de90788 (clean) (release) (start)

Output of uname -a

Linux raspberrypi 5.10.63+ #1488 Thu Nov 18 16:14:04 GMT 2021 armv6l GNU/Linux

Logs

[ 2930.549872] ------------[ cut here ]------------
[ 2930.550003] WARNING: CPU: 0 PID: 11721 at drivers/media/common/videobuf2/videobuf2-core.c:1956 __vb2_queue_cancel+0x214/0x294 [videobuf2_common]
[ 2930.550016] Modules linked in: bnep ov5647 hci_uart btbcm bluetooth ecdh_generic snd_soc_hdmi_codec ecc libaes 8021q garp stp llc snd_usb_audio snd_hwdep snd_usbmidi_lib snd_rawmidi snd_seq_device uvcvideo br
cmfmac brcmutil vc4 sha256_generic libsha256 cec drm_kms_helper cfg80211 raspberrypi_hwmon snd_soc_core rfkill snd_compress snd_pcm_dmaengine syscopyarea sysfillrect i2c_mux_pinctrl sysimgblt i2c_mux fb_sys_fops
bcm2835_unicam v4l2_dv_timings v4l2_fwnode i2c_bcm2835 bcm2835_codec(C) bcm2835_isp(C) bcm2835_v4l2(C) v4l2_mem2mem bcm2835_mmal_vchiq(C) videobuf2_vmalloc videobuf2_dma_contig snd_bcm2835(C) videobuf2_memops v
ideobuf2_v4l2 videobuf2_common snd_pcm snd_timer snd videodev mc vc_sm_cma(C) fixed uio_pdrv_genirq uio i2c_dev drm fuse drm_panel_orientation_quirks backlight ip_tables x_tables ipv6
[ 2930.550563] CPU: 0 PID: 11721 Comm: streamer Tainted: G WC 5.10.63+ #1488
[ 2930.550574] Hardware name: BCM2835
[ 2930.550583] Backtrace:
[ 2930.550634] [] (dump_backtrace) from [] (show_stack+0x20/0x24)
[ 2930.550652] r7:000007a4 r6:00000009 r5:bf34a688 r4:c0a70ae0
[ 2930.550674] [] (show_stack) from [] (dump_stack+0x28/0x30)
[ 2930.550701] [] (dump_stack) from [] (__warn+0xe8/0x110)
[ 2930.550715] r5:bf34a688 r4:bf34ff78
[ 2930.550736] [] (__warn) from [] (warn_slowpath_fmt+0x68/0xd8)
[ 2930.550753] r7:00000009 r6:bf34a688 r5:000007a4 r4:bf34ff78
[ 2930.550817] [] (warn_slowpath_fmt) from [] (__vb2_queue_cancel+0x214/0x294 [videobuf2_common])
[ 2930.550838] r9:c0bb302c r8:00000001 r7:c3485220 r6:c18f6390 r5:c18f6390 r4:c18f6390
[ 2930.550921] [] (__vb2_queue_cancel [videobuf2_common]) from [] (vb2_core_streamoff+0x28/0xc0 [videobuf2_common])
[ 2930.550942] r10:00000004 r9:c0bb302c r8:00000001 r7:c3485220 r6:c18f64e8 r5:c18f6390
[ 2930.550952] r4:c18f6390
[ 2930.551028] [] (vb2_core_streamoff [videobuf2_common]) from [] (__vb2_cleanup_fileio+0x2c/0x84 [videobuf2_common])
[ 2930.551043] r5:c18f6390 r4:c1a0f000
[ 2930.551119] [] (__vb2_cleanup_fileio [videobuf2_common]) from [] (vb2_core_queue_release+0x20/0x48 [videobuf2_common])
[ 2930.551134] r5:c18f63f0 r4:c18f6390
[ 2930.551232] [] (vb2_core_queue_release [videobuf2_common]) from [] (_vb2_fop_release+0x74/0x94 [videobuf2_v4l2])
[ 2930.551247] r5:cef6b300 r4:00000000
[ 2930.551317] [] (_vb2_fop_release [videobuf2_v4l2]) from [] (unicam_v4l2_release+0x4c/0xd8 [bcm2835_unicam])
[ 2930.551335] r7:c3485220 r6:cef6b300 r5:c18f64dc r4:c18f6278
[ 2930.551732] [] (unicam_v4l2_release [bcm2835_unicam]) from [] (v4l2_release+0xd4/0xe8 [videodev])
[ 2930.551755] r9:c0bb302c r8:c804c088 r7:c11f86d0 r6:000a001d r5:cef6b300 r4:c18f64e8
[ 2930.551975] [] (v4l2_release [videodev]) from [] (__fput+0x90/0x250)
[ 2930.551992] r5:c518bc58 r4:cef6b300
[ 2930.552012] [] (__fput) from [] (____fput+0x18/0x1c)
[ 2930.552031] r9:c0bb302c r8:c00083e4 r7:c0cfcb80 r6:c5f2d640 r5:c5f2dac4 r4:00000000
[ 2930.552063] [] (____fput) from [] (task_work_run+0x9c/0xe8)
[ 2930.552086] [] (task_work_run) from [] (do_work_pending+0x4b4/0x558)
[ 2930.552101] r7:c0bb3028 r6:c2861fb0 r5:00000000 r4:ffffe000
[ 2930.552119] [] (do_work_pending) from [] (slow_work_pending+0xc/0x20)
[ 2930.552131] Exception stack(0xc2861fb0 to 0xc2861ff8)
[ 2930.552146] 1fa0: 00000000 9c6fef80 00000000 00000003
[ 2930.552163] 1fc0: 9bd01650 9c6fef80 9c6fdf0c 00000006 9bd00cac 9c6fdf68 01000780 00000000
[ 2930.552178] 1fe0: 00000000 9c6fded8 00000000 b5f7a018 80000010 00000003
[ 2930.552196] r10:00000000 r9:c2860000 r8:c00083e4 r7:00000006 r6:9c6fdf0c r5:9c6fef80
[ 2930.552207] r4:9bd01650
[ 2930.552218] ---[ end trace a00f58a46d33813b ]---
[ 2930.552237] videobuf2_common: driver bug: stop_streaming operation is leaving buf 31a490c6 in active state

Additional context

No response

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