Kernel crash when closing the camera

  • Hello 😊

    did anyone else encounter any similar issues when testing?
  • Hello, when we use the "simple_xx" command for testing and invoke RK_MPI_SYS_Exit();, this has not happened before. However, we haven't encountered a similar situation at present. We suggest you check if there is a CORE DUMP file in the /mnt/sdcard directory to determine the software issue.
    On the hardware side, we recommend checking the stability of the power supply to determine the ripple of the 5V input power supply and checking if the voltages at the 77 (1.8V), 78 (3.3V), and 79 (5V) pins of CORE1106 are normal.
  • This very same issue is killing me, too. I noticed that sometimes (rarely), closing rkipc (via RkLunch-stop.sh) simply hangs. Sometimes it happens after three or four start/ stop sequences. Sometimes after 50. But it does happen.

    I also tried using the SDK to integrate the VPU in my C application. The issue persists. Sometimes the application crashes entirely, sometimes it crashes the whole system - but only on exit.

    If you wish to reproduce the issue, you can use a script along the lines of (untested, but should work):

    Code: Select all

    
    #!/bin/sh
    
    PIDFILE=/var/run/rklunch.pid
    
    run_loop() {
        interval=$1
        [ -z "$interval" ] && interval=10   # default to 10 if not provided
        trap "exit 0" TERM INT              # exit cleanly if killed
        while true; do
            RkLunch.sh
            sleep "$interval"
            RkLunch-stop.sh
        done
    }
    
    case "$1" in
      start)
        shift   # drop "start"
        interval=$1
    
        if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then
            echo "Servcie is already running (PID $(cat "$PIDFILE"))"
            exit 1
        fi
    
        echo "Starting RkLunch service with interval=${interval:-10}s..."
        # Make sure rkipc is closed before starting the loop
        RkLunch-sh.stop
        run_loop "$interval" &
        echo $! > "$PIDFILE"
        ;;
      stop)
        echo "Stopping RkLunch service..."
        if [ -f "$PIDFILE" ]; then
          if kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then
            kill "$(cat "$PIDFILE")"
          fi
          rm -f "$PIDFILE"
        else
          echo "No PID file, not running?"
        fi
        ;;
      restart)
        $0 stop
        sleep 1
        $0 start "$2"
        ;;
      status)
        if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then
          echo "RkLunch is running (PID $(cat "$PIDFILE"))"
        else
          echo "RkLunch is not running"
        fi
        ;;
      *)
        echo "Usage: $0 {start [interval]|stop|restart [interval]|status}"
        exit 1
        ;;
    esac
    
    exit 0
    
    
    It can take a while, but it will crash. I've only seen this happen on RV1106, though I haven't tested on RV1103 thoroughly.

    EDIT:

    The board booted, the very fist command I ran was rklunch stop.

    Code: Select all

    
    [video.c][rkipc_ivs_get_results]:get chn 0 fail -1609269234
    [  494.161519] vepu_pp_destroy_chn 0
    RTDeviceV4L2     18:17:01-481 {ispStreamOff      :521} do ispStreamOff start
    RTDeviceV4L2     18:17:01-508 {ispStreamOff      :532} do ispStreamOff done
    [  494.161844] rockit isp stream off
    RTDeviceV4L2     18:17:01-508 {close             :374} do RTDeviceV4L2 close
    [  494.190090] mpp_vcodec: 162: destroy chan 0 hnd f9954f56 online 0 combo -1 mst -1
    [osd.c][osd_time_server]:exit
    [  494.206724] mpp_vcodec: 188: destroy chan 0 done
    MpiAdapterEncode 18:17:01-527 {ma_encode_destroy :2347} unmap ptr: 0xa4252000
    RTDeviceV4L2     18:17:01-527 {ispStreamOff      :521} do ispStreamOff start
    [  494.207451] rockit isp stream off
    RTDeviceV4L2     18:17:01-548 {ispStreamOff      :532} do ispStreamOff done
    [  494.229672] mpp_vcodec: 162: destroy chan 1 hnd 837fab3f online 0 combo -1 mst -1
    RTDeviceV4L2     18:17:01-548 {close             :374} do RTDeviceV4L2 close
    [  494.229929] mpp_vcodec: 188: destroy chan 1 done
    MpiAdapterEncode 18:17:01-550 {ma_encode_destroy :2347} unmap ptr: 0xa35a8000
    [  494.230287] rockit isp stream off
    RTDeviceV4L2     18:17:01-550 {ispStreamOff      :521} do ispStreamOff start
    [  494.267068] rkcif-mipi-lvds: stream[0] start stopping, total mode 0x2, cur 0x2
    [  494.305801] rockchip-mipi-csi2 mipi0-csi2: stream off, src_sd: 6f87ec3d, sd_name:rockchip-csi2-dphy0
    CAMHW:K:camId:0, notify_isp_stream_status off
    [  494.305826] rockchip-mipi-csi2 mipi0-csi2: stream OFF
    RTDeviceV4L2     18:17:01-627 {ispStreamOff      :532} do ispStreamOff done
    [  494.305855] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream_stop stream stop, dphy0
    RTDeviceV4L2     18:17:01-627 {close             :374} do RTDeviceV4L2 close
    [  494.305876] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:0, dphy0, ret 0
    [video.c][rkipc_pipe_jpeg_deinit]:RK_MPI_VENC_DestroyChn success
    [  494.306079] rkcif-mipi-lvds: stream[0] stopping finished, dma_en 0x0
    [DEBUG rtsp_demo.c:645:rtsp_del_session] del session path: /live/0
    [  494.306092] rkcif-mipi-lvds: stream[0] start stopping, total mode 0x0, cur 0x2
    [DEBUG rtsp_demo.c:645:rtsp_del_session] del session path: /live/1
    [  494.306100] rkcif-mipi-lvds: stream[0] stopping finished, dma_en 0x0
    [isp.c][rk_isp_deinit]:cam_id is 0
    [  494.307508] mpp_vcodec: 162: destroy chan 4 hnd 15eeba9e online 0 combo -1 mst -1
    [isp.c][rk_isp_deinit]:rk_aiq_uapi2_sysctl_stop enter
    [  494.307745] mpp_vcodec: 188: destroy chan 4 done
    XCORE:K:cid[0] rk_aiq_uapi_sysctl_stop success.
    [  494.313814] stream_cif_mipi_id1: close video, entity use_count 0
    [isp.c][rk_isp_deinit]:rk_aiq_uapi2_sysctl_deinit enter
    [  494.313861] stream_cif_mipi_id0: close video, entity use_count 1
    MessageParser process loop exit!
    [  494.314268] stream_cif_mipi_id0: s_power 0, entity use_count 0
    IPCSERVER:K:cid[0] Deinit success
    [  494.317167] vsys_release, 27
    XCORE:K:cid[0] rk_aiq_uapi_sysctl_deinit_locked success.
    [  494.317181] vrgn_release, 123
    [isp.c][rk_isp_deinit]:rk_aiq_uapi2_sysctl_deinit exit
    [  494.317219] vi_release 99
    RKSockServer     18:17:02-151 {start             :162} accept failed
    (null)           18:17:03-152 {monitor_log_level :190} monitor_log_level quit
    [ntp.c][rkipc_ntp_update]:connect error
    [param.c][rk_param_deinit]:rk_param_deinit
    [  494.317282] venc_release 51
    [  497.445273] sdio_err:<aicwf_sdio_tx_msg,1964>: aicwf_sdio_send_pkt fail-110
    [  500.965243] cmd timed-out
    [  500.965328] wlan error reset flow.
    [  500.965338] send event.
    [  500.965408] wlan error event send.
    [  500.965424] tkn[852]  flags:0032  result: -4  cmd:4103-SCANU_VENDOR_IE_REQ      - reqcfm(4104-SCANU_VENDOR_IE_CFM)
    [  500.965438] cmd queue crashed
    [  504.008368] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
    [  504.023705] mmc_host mmc0: Bus speed (slot 0) = 49500000Hz (slot req 52000000Hz, actual 49500000HZ div = 0)
    [  507.045330] blk_update_request: I/O error, dev mmcblk0, sector 1135362 op 0x1:(WRITE) flags 0x0 phys_seg 6 prio class 0
    [  507.045364] EXT4-fs warning (device mmcblk0p6): ext4_end_bio:351: I/O error 10 writing to inode 13 starting block 567705)
    [  507.045383] Buffer I/O error on device mmcblk0p6, logical block 9825
    [  507.045392] Buffer I/O error on device mmcblk0p6, logical block 9826
    [  507.045399] Buffer I/O error on device mmcblk0p6, logical block 9827
    [  507.045409] Buffer I/O error on device mmcblk0p6, logical block 9828
    [  507.045428] Buffer I/O error on device mmcblk0p6, logical block 9829
    [  507.045437] Buffer I/O error on device mmcblk0p6, logical block 9830
    [  507.045444] Buffer I/O error on device mmcblk0p6, logical block 9831
    [  507.045452] Buffer I/O error on device mmcblk0p6, logical block 9832
    [  507.045462] Buffer I/O error on device mmcblk0p6, logical block 9833
    [  507.045470] Buffer I/O error on device mmcblk0p6, logical block 9834
    [  507.147194] JBD2: Detected IO errors while flushing file data on mmcblk0p6-8
    [  515.928870] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
    [  515.944205] mmc_host mmc0: Bus speed (slot 0) = 49500000Hz (slot req 52000000Hz, actual 49500000HZ div = 0)
    [  518.965334] blk_update_request: I/O error, dev mmcblk0, sector 67400 op 0x1:(WRITE) flags 0x103000 phys_seg 1 prio class 0
    [  518.965364] Buffer I/O error on dev mmcblk0p5, logical block 33, lost async page write
    
    
    EDIT 2: It's not a kernel crash, i can still talk to my sbc via serial console. No core dump. Wifi stops working, emmc stops working, usb stops working. I set the log level to 8.

    Code: Select all

    MpiHwInterface   21:19:18-120 {reset             :356} reset
    RTAllocatorDma   21:19:18-120 {freeDmaBuffer     :263} free buffer(ptr=0xc89a8, handle=000, fd=053, data=(nil), size=0)
    MpiHwInterface   21:19:18-120 {destroy           :115} destroy
    MpiAdapterEncode 21:19:18-123 {ma_encode_destroy :2347} unmap ptr: 0xa48db000
    MpiHwInterface   21:19:18-123 {~MpiHwInterface   :038} ~MpiHwInterface
    MpiHwInterface   21:19:18-124 {destroy           :115} destroy
    cmpi             21:19:18-124 {venc_destroy_chn  :212} VENC_IOCTL_NODE_DELETE
    

    RK_MPI_VI_DisableChn(...) gets called and that's it.

    Code: Select all

    cmpi             21:19:19-125 {stopRuntime       :1113} VVI_IOCTL_NODE_STOP:  dev:0, chn:0
    cmpi             21:19:19-126 {streamOff         :1215} start dev:0 chn:0 stream off
    RTDeviceV4L2     21:19:19-126 {ispStreamOff      :521} do ispStreamOff start
    
    It's a real bummer.
    Last edited by Paulm on 2025-08-19 21:41, edited 3 times in total.