R35's dmabuf uses too many fds (starting from less than 1024) in decoding

Hi,

I’m developing a video streaming application, which needs to decode and encode many video streams concurrently, and I use live555 as the RTSP server. When client connects to the server, the TCP connection can be established, but there are no RTSP messages. The socket’s fd, accepted by live555 RTSP server, was greater than FD_SETSIZE (1024), so the select function didn’t work.

Then I used command lsof -p pid to list the opened files by my application, I found there were too many fds (about 2400) with name dmabuf.

My device is: AGX Xavier
And Jetpack version is: R35 (release), REVISION: 1.0, GCID: 31250864, BOARD: t186ref, EABI: aarch64, DATE: Thu Aug 11 03:40:29 UTC 2022

I tested on R32, all dmabuf’s fds were greater than 1024, so socket’s fd could be less than 1024.

The R32’s behavior is what I expect!

I wonder why the new version R35doesn’t have the same behavior with R32? Is it a R35’s bug?

Thanks!

R35 lsof result (Some repeated information was removed):

  COMMAND    PID USER   FD      TYPE             DEVICE  SIZE/OFF    NODE NAME
  MyApp 3399 root    0u      CHR              136,0       0t0       3 /dev/pts/0
  MyApp 3399 root    1u      CHR              136,0       0t0       3 /dev/pts/0
  MyApp 3399 root    2u      CHR              136,0       0t0       3 /dev/pts/0
  MyApp 3399 root    3u      CHR              10,54       0t0     386 /dev/nvmap
  MyApp 3399 root    4u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root    5u      CHR              507,1       0t0     194 /dev/nvhost-vic
  MyApp 3399 root    6u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root    7u     0000                0,9     32768   53492 /dmabuf:
  MyApp 3399 root    8u     0000                0,9     32768   53493 /dmabuf:
  MyApp 3399 root    9u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root   10u      CHR             505,13       0t0    1113 /dev/nvgpu/igpu0/ctrl
  MyApp 3399 root   11u      CHR             505,16       0t0    1117 /dev/nvgpu/igpu0/prof
  MyApp 3399 root   12u  a_inode               0,12         0    9053 nvhost-gv11b-fd12
  MyApp 3399 root   13u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root   14u      CHR              507,1       0t0     194 /dev/nvhost-vic
  MyApp 3399 root   15u  a_inode               0,12         0    9053 nvhost-syncpt
  MyApp 3399 root   16u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root   17u     0000                0,9     32768   53503 /dmabuf:
  MyApp 3399 root   18u     0000                0,9     32768   53504 /dmabuf:
  MyApp 3399 root   19u     0000                0,9      4096   53505 /dmabuf:
  MyApp 3399 root   20u     0000                0,9     49152   53506 /dmabuf:
  MyApp 3399 root   21u     0000                0,9     12288   53507 /dmabuf:
  MyApp 3399 root   22u     0000                0,9     12288   53508 /dmabuf:
  MyApp 3399 root   23u     0000                0,9   3702784   53509 /dmabuf:
  MyApp 3399 root   24w      REG              179,1   2848562  786482 /home/xxx.log
  MyApp 3399 root   25w      REG              179,1         0  786483 /home/xxx.log
  MyApp 3399 root   26u  a_inode               0,12         0    9053 [eventfd]
  MyApp 3399 root   27u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg27
  MyApp 3399 root   28u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd28
  MyApp 3399 root   29u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd29
  MyApp 3399 root   30u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd30
  MyApp 3399 root   31u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd31
  MyApp 3399 root   32u  a_inode               0,12         0    9053 nvhost-event-poll-fd
  MyApp 3399 root   33u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg33
  MyApp 3399 root   34u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd34
  MyApp 3399 root   35u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd35
  MyApp 3399 root   36u  a_inode               0,12         0    9053 nvhost-event-poll-fd
  MyApp 3399 root   37u  a_inode               0,12         0    9053 [eventfd]
  MyApp 3399 root   38u  a_inode               0,12         0    9053 nvgpu-event1-fd38
  MyApp 3399 root   39u  a_inode               0,12         0    9053 nvgpu-event4-fd39
  MyApp 3399 root   40u  a_inode               0,12         0    9053 nvgpu-event3-fd40
  MyApp 3399 root   41u  a_inode               0,12         0    9053 nvgpu-event0-fd41
  MyApp 3399 root   42r     FIFO               0,11       0t0   52681 pipe
  MyApp 3399 root   43w     FIFO               0,11       0t0   52681 pipe
  MyApp 3399 root   44u  a_inode               0,12         0    9053 [eventfd]
  MyApp 3399 root   45u  a_inode               0,12         0    9053 [eventpoll]
  MyApp 3399 root   46u  a_inode               0,12         0    9053 [timerfd]
  MyApp 3399 root   47u  a_inode               0,12         0    9053 [eventfd]
  MyApp 3399 root   48u  a_inode               0,12         0    9053 [eventpoll]
  MyApp 3399 root   49u  a_inode               0,12         0    9053 [timerfd]
  MyApp 3399 root   50w      REG              179,1      2184  786484 /home/xxx.log
  MyApp 3399 root   51u  a_inode               0,12         0    9053 [eventfd]
  MyApp 3399 root   52u  a_inode               0,12         0    9053 [eventpoll]
  MyApp 3399 root   53u  a_inode               0,12         0    9053 [timerfd]
  MyApp 3399 root   54u     IPv4              55737       0t0     TCP *:amandaidx (LISTEN)
  MyApp 3399 root   55u     IPv4              55739       0t0     TCP *:1554 (LISTEN)
  MyApp 3399 root   56w      REG              179,1  12054528  786495 /home/xxx.log
  MyApp 3399 root   57u  a_inode               0,12         0    9053 [eventfd]
  MyApp 3399 root   58u  a_inode               0,12         0    9053 [eventpoll]
  MyApp 3399 root   59u  a_inode               0,12         0    9053 [timerfd]
  MyApp 3399 root   60u     IPv4              55742       0t0     TCP *:28081 (LISTEN)
  MyApp 3399 root   61u      CHR             505,13       0t0    1113 /dev/nvgpu/igpu0/ctrl
  MyApp 3399 root   62u  a_inode               0,12         0    9053 nvhost-gv11b-fd62
  MyApp 3399 root   63u  a_inode               0,12         0    9053 nvhost-gv11b-fd63
  MyApp 3399 root   64u     unix 0xffff540740c8d800       0t0   55753 type=STREAM
  MyApp 3399 root   65u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg65
  MyApp 3399 root   66u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd66
  MyApp 3399 root   67u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root   68uw     REG              179,1       968 1739359 /root/.cache/nvidia/GLCache/62d87071b347f8ee90f0c8b196f56c13/bac77cb44ab724ce/a9f27d39260b4978.toc
  MyApp 3399 root   69uw     REG              179,1     96107 1739360 /root/.cache/nvidia/GLCache/62d87071b347f8ee90f0c8b196f56c13/bac77cb44ab724ce/a9f27d39260b4978.bin
  MyApp 3399 root   70u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg70
  MyApp 3399 root   71u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd71
  MyApp 3399 root   72u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg72
  MyApp 3399 root   73u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd73
  MyApp 3399 root   74u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg74
  MyApp 3399 root   75u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd75
  MyApp 3399 root   76u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd76
  MyApp 3399 root   77u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg77
  MyApp 3399 root   78u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd78
  MyApp 3399 root   79u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd79
  MyApp 3399 root   80u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg80
  MyApp 3399 root   81u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd81
  MyApp 3399 root   82u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd82
  MyApp 3399 root   83u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg83
  MyApp 3399 root   84u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd84
  MyApp 3399 root   85u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd85
  MyApp 3399 root   86u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg86
  MyApp 3399 root   87u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd87
  MyApp 3399 root   88u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd88
  MyApp 3399 root   89u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg89
  MyApp 3399 root   90u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd90
  MyApp 3399 root   91u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd91
  MyApp 3399 root   92u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg92
  MyApp 3399 root   93u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd93
  MyApp 3399 root   94u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd94
  MyApp 3399 root   95u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg95
  MyApp 3399 root   96u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd96
  MyApp 3399 root   97u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd97
  MyApp 3399 root   98u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg98
  MyApp 3399 root   99u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd99
  MyApp 3399 root  100u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd100
  MyApp 3399 root  101u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg101
  MyApp 3399 root  102u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd102
  MyApp 3399 root  103u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd103
  MyApp 3399 root  104u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg104
  MyApp 3399 root  105u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd105
  MyApp 3399 root  106u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd106
  MyApp 3399 root  107u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg107
  MyApp 3399 root  108u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd108
  MyApp 3399 root  109u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd109
  MyApp 3399 root  110u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg110
  MyApp 3399 root  111u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd111
  MyApp 3399 root  112u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd112
  MyApp 3399 root  113u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg113
  MyApp 3399 root  114u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd114
  MyApp 3399 root  115u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd115
  MyApp 3399 root  116u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg116
  MyApp 3399 root  117u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd117
  MyApp 3399 root  118u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd118
  MyApp 3399 root  119u  a_inode               0,12         0    9053 nvgpu-gv11b-tsg119
  MyApp 3399 root  120u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd120
  MyApp 3399 root  121u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd121
  MyApp 3399 root  122u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd122
  MyApp 3399 root  123u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd123
  MyApp 3399 root  124u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd124
  MyApp 3399 root  125u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd125
  MyApp 3399 root  126u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd126
  MyApp 3399 root  127u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd127
  MyApp 3399 root  128u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd128
  MyApp 3399 root  129u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd129
  MyApp 3399 root  130u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd130
  MyApp 3399 root  131u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd131
  MyApp 3399 root  132u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd132
  MyApp 3399 root  133u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd133
  MyApp 3399 root  134u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd134
  MyApp 3399 root  135u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd135
  MyApp 3399 root  136u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd136
  MyApp 3399 root  137u  a_inode               0,12         0    9053 nvhost-17000000.gv11b-fd137
  MyApp 3399 root  138u      CHR              507,9       0t0     196 /dev/nvhost-msenc
  MyApp 3399 root  139w      REG              179,1  45220333  786480 /home/xxx.log
  MyApp 3399 root  140u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root  141u      CHR              507,9       0t0     196 /dev/nvhost-msenc
  MyApp 3399 root  142u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root  143u      CHR             507,13       0t0     197 /dev/nvhost-nvenc1
  MyApp 3399 root  144u     0000                0,9  12845056   52683 /dmabuf:
  MyApp 3399 root  145u     0000                0,9  12845056   52684 /dmabuf:
  MyApp 3399 root  146u     0000                0,9  12845056   52685 /dmabuf:
  MyApp 3399 root  147u     0000                0,9  12845056   52686 /dmabuf:
  MyApp 3399 root  148u     0000                0,9  12845056   52687 /dmabuf:
  MyApp 3399 root  149u     0000                0,9  12845056   52688 /dmabuf:
  MyApp 3399 root  150u     0000                0,9  12845056   52689 /dmabuf:
  MyApp 3399 root  151u     0000                0,9  12845056   52690 /dmabuf:
  MyApp 3399 root  152u     0000                0,9  12845056   52691 /dmabuf:
  MyApp 3399 root  153u     0000                0,9  12845056   52692 /dmabuf:
  MyApp 3399 root  154u     0000                0,9  12443648   52693 /dmabuf:
  MyApp 3399 root  155u     0000                0,9  12443648   52694 /dmabuf:
  MyApp 3399 root  156u     0000                0,9  12443648   52695 /dmabuf:
  MyApp 3399 root  157u     0000                0,9  12443648   52696 /dmabuf:
  MyApp 3399 root  158u     0000                0,9  12443648   52697 /dmabuf:
  MyApp 3399 root  159u     0000                0,9  12443648   52698 /dmabuf:
  MyApp 3399 root  160u     0000                0,9  12443648   52699 /dmabuf:
  MyApp 3399 root  161u     0000                0,9  12443648   52700 /dmabuf:
  MyApp 3399 root  162u     0000                0,9  12443648   52701 /dmabuf:
  MyApp 3399 root  163u     0000                0,9  12443648   52702 /dmabuf:
  MyApp 3399 root  164u     0000                0,9  12443648   52703 /dmabuf:
  MyApp 3399 root  165u     0000                0,9  12443648   52704 /dmabuf:
  MyApp 3399 root  166u     0000                0,9  12443648   52705 /dmabuf:
  MyApp 3399 root  167u     0000                0,9  12443648   52706 /dmabuf:
  MyApp 3399 root  168u     0000                0,9  12443648   52707 /dmabuf:
  MyApp 3399 root  169u     0000                0,9  12443648   52708 /dmabuf:
  MyApp 3399 root  170u     0000                0,9  12443648   52709 /dmabuf:
  MyApp 3399 root  171u     0000                0,9  12443648   52710 /dmabuf:
  MyApp 3399 root  172u     0000                0,9  12443648   52711 /dmabuf:
  MyApp 3399 root  173u     0000                0,9  12443648   52712 /dmabuf:
  MyApp 3399 root  174u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root  175u     0000                0,9   8388608   55768 /dmabuf:
  MyApp 3399 root  176u      CHR              507,9       0t0     196 /dev/nvhost-msenc
  MyApp 3399 root  177u  a_inode               0,12         0    9053 nvhost-syncpt
  MyApp 3399 root  178u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root  179u     0000                0,9     32768   55758 /dmabuf:
  MyApp 3399 root  180u     0000                0,9     32768   55759 /dmabuf:
  MyApp 3399 root  181u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root  182u      CHR             507,13       0t0     197 /dev/nvhost-nvenc1
  MyApp 3399 root  183u  a_inode               0,12         0    9053 nvhost-syncpt
  MyApp 3399 root  184u      CHR              507,0       0t0     193 /dev/nvhost-ctrl
  MyApp 3399 root  185u     0000                0,9     32768   55760 /dmabuf:
  MyApp 3399 root  186u     0000                0,9     32768   55761 /dmabuf:
  MyApp 3399 root  187u     0000                0,9   8388608   55762 /dmabuf:
  MyApp 3399 root  188u     0000                0,9   8388608   55762 /dmabuf:
  MyApp 3399 root  189u     0000                0,9   4194304   55763 /dmabuf:
  MyApp 3399 root  190u     0000                0,9   4194304   55763 /dmabuf:
  MyApp 3399 root  191u     0000                0,9   8388608   55764 /dmabuf:
  MyApp 3399 root  192u     0000                0,9   8388608   55764 /dmabuf:
  MyApp 3399 root  193u     0000                0,9   4194304   55765 /dmabuf:
  MyApp 3399 root  194u     0000                0,9   4194304   55765 /dmabuf:
  MyApp 3399 root  195u     0000                0,9   8388608   55766 /dmabuf:
  MyApp 3399 root  196u     0000                0,9   8388608   55766 /dmabuf:
  MyApp 3399 root  197u     0000                0,9   4194304   55767 /dmabuf:
  MyApp 3399 root  198u     0000                0,9   4194304   55767 /dmabuf:
  MyApp 3399 root  199u     0000                0,9   8388608   55768 /dmabuf:
  MyApp 3399 root  200u     0000                0,9   4194304   55769 /dmabuf:
  MyApp 3399 root  201u     0000                0,9   4194304   55769 /dmabuf:
  ... ...
  ... ...abount 2000 /dmabuf
  ... ...
  MyApp 3399 root 2236u     0000                0,9  12845056   52841 /dmabuf:
  MyApp 3399 root 2237u     0000                0,9  12845056   52841 /dmabuf:
  MyApp 3399 root 2238u     0000                0,9  12845056   52841 /dmabuf:
  MyApp 3399 root 2239u  unknown                                      /proc/3399/fd/2239 (readlink: No such file or directory)
  MyApp 3399 root 2240u     0000                0,9  12845056   52883 /dmabuf:
  MyApp 3399 root 2241u     0000                0,9  12845056   52883 /dmabuf:
  MyApp 3399 root 2242u     0000                0,9  12845056   52883 /dmabuf:
  MyApp 3399 root 2243u     0000                0,9  12845056   52883 /dmabuf:
  MyApp 3399 root 2244u     0000                0,9  12845056   52884 /dmabuf:
  MyApp 3399 root 2245u     0000                0,9  12845056   52884 /dmabuf:
  MyApp 3399 root 2246u     0000                0,9  12845056   52884 /dmabuf:
  MyApp 3399 root 2249u     sock                0,7       0t0   58595 protocol: TCP

R32 lsof result(Some repeated information was removed)

COMMAND    PID USER   FD      TYPE             DEVICE  SIZE/OFF     NODE NAME
COMMAND    PID USER   FD      TYPE             DEVICE  SIZE/OFF     NODE NAME
DecoderDemo 10688 root    0r      CHR                1,3       0t0     1185 /dev/null
DecoderDemo 10688 root    1w      CHR                1,3       0t0     1185 /dev/null
DecoderDemo 10688 root    2w      CHR                1,3       0t0     1185 /dev/null
DecoderDemo 10688 root    5u     unix 0xffffffc1b869b400       0t0 66143493 type=DGRAM
DecoderDemo 10688 root    6u     sock                0,8       0t0 66144292 protocol: UDP
DecoderDemo 10688 root    7u     IPv4           66144293       0t0      TCP *:20086 (LISTEN)
DecoderDemo 10688 root    8u      REG              179,1         0    28841 /mnt/vion/start_va_flock
DecoderDemo 10688 root   11u      CHR              242,0       0t0     1259 /dev/nvhost-ctrl
DecoderDemo 10688 root   12u      CHR             242,17       0t0     1277 /dev/nvhost-vic
DecoderDemo 10688 root   13u      CHR              10,61       0t0     1136 /dev/nvmap
DecoderDemo 10688 root   14u      CHR              506,2       0t0    12655 /dev/nvhost-ctrl-gpu
DecoderDemo 10688 root   15u  a_inode               0,11         0     8365 nvhost-gv11b-fd15
DecoderDemo 10688 root   16u  a_inode               0,11         0     8365 [eventfd]
DecoderDemo 10688 root   17u      CHR              239,0       0t0    12296 /dev/tegra_dc_ctrl
DecoderDemo 10688 root   18u      CHR              239,1       0t0    10245 /dev/tegra_dc_0
DecoderDemo 10688 root   19u      CHR               29,0       0t0    10387 /dev/fb0
DecoderDemo 10688 root   20u      CHR              239,2       0t0     9226 /dev/tegra_dc_1
DecoderDemo 10688 root   21u      CHR               29,1       0t0     9227 /dev/fb1
DecoderDemo 10688 root   22u     IPv4           66142774       0t0      TCP *:10087 (LISTEN)
DecoderDemo 10688 root   23u     sock                0,8       0t0 66142777 protocol: UDP
DecoderDemo 10688 root   24u     IPv4           66138979       0t0      TCP localhost.localdomain:54956->192.168.5.2:9999 (ESTABLISHED)
DecoderDemo 10688 root   34u     IPv4           66143520       0t0      TCP *:10088 (LISTEN)
DecoderDemo 10688 root   35u      CHR             242,17       0t0     1277 /dev/nvhost-vic
DecoderDemo 10688 root   36r  unknown                                       anon_inode (stat: No such file or directory)
DecoderDemo 10688 root   42u      CHR              506,2       0t0    12655 /dev/nvhost-ctrl-gpu
DecoderDemo 10688 root   43u      CHR              506,4       0t0    12657 /dev/nvhost-prof-gpu
DecoderDemo 10688 root   44u  a_inode               0,11         0     8365 nvhost-gv11b-fd44
DecoderDemo 10688 root   45r     FIFO               0,10       0t0 66141944 pipe
DecoderDemo 10688 root   46w     FIFO               0,10       0t0 66141944 pipe
DecoderDemo 10688 root   47u  a_inode               0,11         0     8365 nvgpu-gv11b-tsg47
DecoderDemo 10688 root   48u  a_inode               0,11         0     8365 nvhost-17000000.gv11b-fd48
DecoderDemo 10688 root   49u  a_inode               0,11         0     8365 nvhost-17000000.gv11b-fd49
DecoderDemo 10688 root   50u  a_inode               0,11         0     8365 nvhost-17000000.gv11b-fd50
DecoderDemo 10688 root   51u  a_inode               0,11         0     8365 nvhost-17000000.gv11b-fd51
DecoderDemo 10688 root   52u  a_inode               0,11         0     8365 nvhost-event-poll-fd
DecoderDemo 10688 root   53u  a_inode               0,11         0     8365 nvgpu-gv11b-tsg53
DecoderDemo 10688 root   54u  a_inode               0,11         0     8365 nvhost-17000000.gv11b-fd54
DecoderDemo 10688 root   55u  a_inode               0,11         0     8365 nvhost-event-poll-fd
DecoderDemo 10688 root   56r     FIFO               0,10       0t0 66141947 pipe
DecoderDemo 10688 root   57w     FIFO               0,10       0t0 66141947 pipe
DecoderDemo 10688 root   58u  a_inode               0,11         0     8365 nvgpu-event1-fd58
DecoderDemo 10688 root   59u  a_inode               0,11         0     8365 nvgpu-event4-fd59
DecoderDemo 10688 root   60u  a_inode               0,11         0     8365 nvgpu-event3-fd60
DecoderDemo 10688 root   61u  a_inode               0,11         0     8365 nvgpu-event0-fd61
DecoderDemo 10688 root   62r     FIFO               0,10       0t0 66141948 pipe
DecoderDemo 10688 root   63w     FIFO               0,10       0t0 66141948 pipe
DecoderDemo 10688 root   64u      REG              179,1         0    29394 /mnt/vion/create_decoder_flock
DecoderDemo 10688 root   65u      CHR              242,9       0t0    11266 /dev/nvhost-nvdec
DecoderDemo 10688 root   67u      CHR              242,9       0t0    11266 /dev/nvhost-nvdec
DecoderDemo 10688 root   68u      CHR             242,13       0t0    11268 /dev/nvhost-nvdec1
DecoderDemo 10688 root   69u      REG              179,1         0    29394 /mnt/vion/create_decoder_flock
DecoderDemo 10688 root   70u      CHR              242,9       0t0    11266 /dev/nvhost-nvdec
DecoderDemo 10688 root   71u      CHR             242,17       0t0     1277 /dev/nvhost-vic
DecoderDemo 10688 root   72u      CHR              242,9       0t0    11266 /dev/nvhost-nvdec
DecoderDemo 10688 root   73u      CHR             242,13       0t0    11268 /dev/nvhost-nvdec1
DecoderDemo 10688 root   74u      CHR              242,9       0t0    11266 /dev/nvhost-nvdec
DecoderDemo 10688 root   75u      CHR             242,13       0t0    11268 /dev/nvhost-nvdec1
DecoderDemo 10688 root   76u      CHR             242,25       0t0     1287 /dev/nvhost-msenc
DecoderDemo 10688 root   83u      CHR              242,9       0t0    11266 /dev/nvhost-nvdec
DecoderDemo 10688 root   84u      CHR             242,13       0t0    11268 /dev/nvhost-nvdec1
DecoderDemo 10688 root   85u  unknown                                       /proc/10688/fd/85 (readlink: No such file or directory)
DecoderDemo 10688 root   86r      REG             179,11  15323200     1455 /root/simsun.ttc
DecoderDemo 10688 root   87r      REG             179,11  15323200     1455 /root/simsun.ttc
DecoderDemo 10688 root   88u      CHR             242,25       0t0     1287 /dev/nvhost-msenc
DecoderDemo 10688 root   89u      CHR             242,25       0t0     1287 /dev/nvhost-msenc
DecoderDemo 10688 root   90u      CHR             242,17       0t0     1277 /dev/nvhost-vic
DecoderDemo 10688 root   91u      CHR             242,29       0t0    11269 /dev/nvhost-nvenc1
DecoderDemo 10688 root   92u      CHR             242,25       0t0     1287 /dev/nvhost-msenc
DecoderDemo 10688 root   93u      CHR             242,29       0t0    11269 /dev/nvhost-nvenc1
DecoderDemo 10688 root   94u      CHR             242,17       0t0     1277 /dev/nvhost-vic
DecoderDemo 10688 root   95u      CHR             242,25       0t0     1287 /dev/nvhost-msenc
DecoderDemo 10688 root   96u      CHR             242,29       0t0    11269 /dev/nvhost-nvenc1
DecoderDemo 10688 root   97r  a_inode               0,11         0     8365 sync_fence
DecoderDemo 10688 root   98u      CHR             242,17       0t0     1277 /dev/nvhost-vic
DecoderDemo 10688 root   99r      DIR             179,11      4096      840 /root/UserApp/vioncfg/NDR
DecoderDemo 10688 root  100u      CHR             242,17       0t0     1277 /dev/nvhost-vic
DecoderDemo 10688 root  101u      CHR             242,25       0t0     1287 /dev/nvhost-msenc
DecoderDemo 10688 root  102u      CHR             242,29       0t0    11269 /dev/nvhost-nvenc1
DecoderDemo 10688 root  104u     IPv4           66144600       0t0      TCP *:2526 (LISTEN)
DecoderDemo 10688 root  105r  a_inode               0,11         0     8365 sync_fence
DecoderDemo 10688 root  106u     IPv4           67555500       0t0      TCP localhost.localdomain:40872->localhost.localdomain:1935 (ESTABLISHED)
DecoderDemo 10688 root  108u     IPv4           66143084       0t0      UDP *:51732 
DecoderDemo 10688 root  109u  unknown                                       /proc/10688/fd/109 (readlink: No such file or directory)
DecoderDemo 10688 root  110u     sock                0,8       0t0 66144601 protocol: UDP
DecoderDemo 10688 root  112u     IPv4           66144602       0t0      TCP *:10101 (LISTEN)
DecoderDemo 10688 root  113r  a_inode               0,11         0     8365 sync_fence
DecoderDemo 10688 root 1024u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1025u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1026u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1027u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1028u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1029u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1030u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1031u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1032u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1033u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1034u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1035u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1036u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1037u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1038u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1039u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1040u  a_inode               0,11         0     8365 dmabuf
DecoderDemo 10688 root 1041u  a_inode               0,11         0     8365 dmabuf
......
......
......

Hi,
We try the command on Xavier r32.7.2 and r35.1:

$ gst-launch-1.0 -v rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 ! rtph264depay ! h264parse ! nvv4l2decoder ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=1

The number of dmabuf is

[r35.1]
$ lsof -p pid | grep dmabuf | wc -l
106

[r32.7.2]
$ lsof -p pid | grep dmabuf | wc -l
68

It is more on r35.1 but does not exceed 1024. And the value is stable. Are you able to try gstreamer command? Maybe the issue is specific to using live555.

Thanks for your reply.

Maybe I didn’t express myself clearly.

My question was not about the fd’s count, but about the fd’s value.

On R32, the value of fd starts from 1024.

While on R35, the value of fd starts from a number less than 1024.

The two versions don’t have the same behavior. I think R32’s behavior is friendly to all applications which use select.

hi, any idea?

Hi,
Would need your help to share a test sample so that we can reproduce the error and check with our teams. In each release we have test cases and no issue is observed. This looks to be specific to this use-case. We would need to reproduce the error first and check further.

multivideo_decode_main.cpp (71.4 KB)

Hi, I wrote a test sample based R35’s /usr/src/jetson_multimedia_api/samples/14_multivideo_decode

Please replace the .cpp file and make on R35 environment , ( The video source file should be longer than 30 seconds)

When you run it use this command

./multivideo_decode num_files 6 \
	/home/liuhang/100.hevc H265 -o /dev/null \
	/home/liuhang/100.hevc H265 -o /dev/null \
	/home/liuhang/100.hevc H265 -o /dev/null \
	/home/liuhang/100.hevc H265 -o /dev/null \
	/home/liuhang/100.hevc H265 -o /dev/null \
	/home/liuhang/100.hevc H265 -o /dev/null \
	--disable-rendering -s 10 -fps 1

It work fine, because the file descriptor count < 1024 , the logs:

 liuhang: the dmabuf file descriptor count:971

 select function return : -1
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/124/gvfs
      Output information may be incomplete.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1002/gvfs
      Output information may be incomplete.
 liuhang: the dmabuf fd start at :7u

 select function return : -1
Accepted a new connection with fd: 714
[client]The Socket is now connected, send something
Accepted a new connection with fd: 722
[client]The Socket is now connected, send something
[server]Returned fd is 722 [index, i: 1]
[server]Received data (len 50 bytes, fd: 722):  hi, send/recv content, the server work fine!!! 1
Accepted a new connection with fd: 729
[server]Returned fd is 722 [index, i: 1]
[server]Closing connection for fd:722
[client]The Socket is now connected, send something
[server]Returned fd is 729 [index, i: 2]
[server]Received data (len 50 bytes, fd: 729):  hi, send/recv content, the server work fine!!! 2
Accepted a new connection with fd: 725
[server]Returned fd is 729 [index, i: 2]
[server]Closing connection for fd:729
[client]The Socket is now connected, send something
[server]Returned fd is 725 [index, i: 1]
[server]Received data (len 50 bytes, fd: 725):  hi, send/recv content, the server work fine!!! 3
Accepted a new connection with fd: 722
[server]Returned fd is 725 [index, i: 1]
[server]Closing connection for fd:725
[client]The Socket is now connected, send something
[server]Returned fd is 722 [index, i: 2]
[server]Received data (len 50 bytes, fd: 722):  hi, send/recv content, the server work fine!!! 4
[server]Returned fd is 722 [index, i: 2]
[server]Closing connection for fd:722
Accepted a new connection with fd: 727
[client]The Socket is now connected, send something
[server]Returned fd is 727 [index, i: 1]
[server]Received data (len 50 bytes, fd: 727):  hi, send/recv content, the server work fine!!! 5

And run command , socket server would not work, because client’s fd > 1024

FILE_NAME=/home/liuhang/100.hevc
./multivideo_decode num_files 12 \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        --disable-rendering -s 100 -fps 1

logs:

liuhang: the dmabuf file descriptor count:1869

 select function return : -1
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/124/gvfs
      Output information may be incomplete.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1002/gvfs
      Output information may be incomplete.
 liuhang: the dmabuf fd start at :7u
9

 select function return : -1
Accepted a new connection with fd: 1468
[client]The Socket is now connected, send something
Accepted a new connection with fd: 1478
[client]The Socket is now connected, send something
Accepted a new connection with fd: 1469
[client]The Socket is now connected, send something
Accepted a new connection with fd: 1471
[client]The Socket is now connected, send something
Accepted a new connection with fd: 1472
[client]The Socket is now connected, send something
Accepted a new connection with fd: 1473
[client]The Socket is now connected, send something

there is no “Received data (len 50 bytes, fd: 722): hi, send/recv content, the server work”

I also wrote the test based r32, it work fine, because the dmabuf’fd start at 1024 on R32.

command:

FILE_NAME=/home/liuhang/100.hevc
./multivideo_decode num_files 16 \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        ${FILE_NAME} H265 -o /dev/null \
        --disable-rendering -s 100 -fps 1

logs:

liuhang: the dmabuf file descriptor count:1140

lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/120/gvfs
      Output information may be incomplete.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
  liuhang: the dmabuf fd start at :1024u

 select function return : -1
select function return : -1
Accepted a new connection with fd: 144
[client]The Socket is now connected, send something
Accepted a new connection with fd: 150
[client]The Socket is now connected, send something
[server]Returned fd is 150 [index, i: 1]
[server]Received data (len 50 bytes, fd: 150):  hi, send/recv content, the server work fine!!! 1
[server]Returned fd is 150 [index, i: 1]
[server]Closing connection for fd:150
Accepted a new connection with fd: 152
[client]The Socket is now connected, send something
[server]Returned fd is 152 [index, i: 1]
[server]Received data (len 50 bytes, fd: 152):  hi, send/recv content, the server work fine!!! 2
[server]Returned fd is 152 [index, i: 1]
[server]Closing connection for fd:152
Accepted a new connection with fd: 150
[client]The Socket is now connected, send something
[server]Returned fd is 150 [index, i: 1]
[server]Received data (len 50 bytes, fd: 150):  hi, send/recv content, the server work fine!!! 3

So this issue only exists on R35.
R32_multivideo_decode_main.cpp (83.6 KB)

Hi, have you looked my test code?

Hi,
We have not checked this. Will set up and try.

Hi,
We can observe the issue and check with our teams. It looks fine to have dmabuf_fd from small value. It seems strange it starts > 1024 on r32.

For using r35, does it work if you create unix sockets before initializing decoder? It looks reasonable to create the sockets beforehand.

Hi,
That’s not strange starts > 1024 on R32, It’s a good solution to the issue, isn’t it?

The socket fd is returned by accept, I can’t control when the client connects. So “create the sockets beforehand” can’t solve this issue.

Hi,
Could yo execute ulmit command to set the limit to a large value? Since each NvBufSurface has one fd, the default setting 1024 may be insufficient for multi-decoder/decoding threads.

ulmit? Obviously it doesn’t solve the problem

Hi,
We have further check about this and confirmed for r32/K4.9, there is kernel customization to force dmabuf fd > 1024. For r35, we don’t apply the customization to align with upstream kernel. The possible solution is

  1. Call poll() instead of select()
  2. If must use select(), please create multiple fd_set objects

If above two are not good for you, you can check the code and do customization:

kernel/nvidia/drivers/video/tegra/nvmap/

although this is not suggested.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.