Topic: Chumby webcam server up- Memory leaks?
I have my Chumby 1 set up as a webcam server. It's surprisingly responsive on my local network. I only have 56k DSL service so it appears slowly when accessed over the internet. Please take a look.
http://ahwahnee.dyndns.org:81/
I'm using the webcam as a security cam, so don't expect much activity. Clicking on the archive link will give a list of captured images sorted by date. Clicking on the file name will bring up the image. I found the perl script, list-pics.pl, to run the archive page on the net.(http://www.inwap.com/mybin/list-pics.html). It was nice that it ran without modification on the Chumby although I found that I had to put it in lighty's cgi-bin directory. The author notes, "It is possible to use this program on a web server that only allows CGI scripts to be executed out of the /cgi-bin/ directory. Such usage is deprecated, and not documented here." (I love the way linux people talk.).
Also I was pretty happy that fbwrite and imgtool could put dates on the jpg images after reading all the compaints about how small the print is using fbwrite. It looks fine when viewed on a web browser.
Ok, enough good news. The Chumby stops capturing images after a while (30 min to a couple hours), apparently, unable to allocate memory. I tried being more gentle, slowing the capture rate and decreasing the image resolution. This seemed to make little or no difference. I also tried switching from uvvcapture to ffmpeg also with no difference.
After I added 126 M of swap memory, the time until capturing stopped only increased a little bit.
This seems strange to me because the memory usage doesn't seem to change much while my script is running. The script captures 3 images a minute, displays one image, fbwrites the date, the captures the images back to a file. Here's the memory status after running a the script a few minutes.
chumby:/psp# free
total used free shared buffers
Mem: 59780 33296 26484 0 2424
Swap: 262136 0 262136
Total: 321916 33296 288620
After running 30 minutes and capturing failed (script still running).
chumby:/psp# free
total used free shared buffers
Mem: 59780 37920 21860 0 2900
Swap: 262136 32 262104
Total: 321916 37952 283964
The used memory increases by 5 mb but only a tiny amount of swap is being used.
Here is part of dmesg output (the entire output is on the web archive as dmesg.txt).
.....
[ 8572.260000] ffmpeg: page allocation failure. order:5, mode:0x0
[ 8572.270000] [<c03365a8>] (dump_stack+0x0/0x14) from [<c007bc34>] (__alloc_pages_internal+0x39c/0x3bc)
[ 8572.280000] [<c007b898>] (__alloc_pages_internal+0x0/0x3bc) from [<c002e400>] (__dma_alloc+0x160/0x414)
[ 8572.290000] [<c002e2a0>] (__dma_alloc+0x0/0x414) from [<c002e740>] (dma_alloc_coherent+0x58/0x64)
[ 8572.300000] [<c002e6e8>] (dma_alloc_coherent+0x0/0x64) from [<bf046ba0>] (hcd_buffer_alloc+0x98/0xa0 [usbcore])
[ 8572.310000] r7:0001e000 r6:c395a050 r5:00000001 r4:000000d0
[ 8572.320000] [<bf046b08>] (hcd_buffer_alloc+0x0/0xa0 [usbcore]) from [<bf03b400>] (usb_buffer_alloc+0x24/0x30 [usbcore])
[ 8572.330000] r5:00000001 r4:c395ae68
[ 8572.330000] [<bf03b3dc>] (usb_buffer_alloc+0x0/0x30 [usbcore]) from [<bf131af4>] (uvc_alloc_urb_buffers+0x50/0x88 [uvcvideo])
[ 8572.340000] [<bf131aa4>] (uvc_alloc_urb_buffers+0x0/0x88 [uvcvideo]) from [<bf131c80>] (uvc_init_video+0x154/0x378 [uvcvideo])
[ 8572.350000] r7:c395a050 r6:00000028 r5:00000c00 r4:00000000
[ 8572.360000] [<bf131b2c>] (uvc_init_video+0x0/0x378 [uvcvideo]) from [<bf131f30>] (uvc_video_enable+0x8c/0x90 [uvcvideo])
[ 8572.370000] [<bf131ea4>] (uvc_video_enable+0x0/0x90 [uvcvideo]) from [<bf1314e0>] (__uvc_v4l2_do_ioctl+0xcd0/0xf2c [uvcvideo])
[ 8572.380000] r5:40045612 r4:00000001
[ 8572.390000] [<bf130810>] (__uvc_v4l2_do_ioctl+0x0/0xf2c [uvcvideo]) from [<bf131758>] (uvc_v4l2_do_ioctl+0x1c/0x20 [uvcvideo])
[ 8572.400000] [<bf13173c>] (uvc_v4l2_do_ioctl+0x0/0x20 [uvcvideo]) from [<bf0c8b64>] (video_usercopy+0x1a8/0x2b0 [videodev])
[ 8572.410000] [<bf0c89bc>] (video_usercopy+0x0/0x2b0 [videodev]) from [<bf1304e8>] (uvc_v4l2_ioctl+0x54/0x68 [uvcvideo])
[ 8572.420000] [<bf130494>] (uvc_v4l2_ioctl+0x0/0x68 [uvcvideo]) from [<c00ae9f0>] (vfs_ioctl+0x78/0x94)
[ 8572.430000] r7:00000003 r6:40045612 r5:bef6882c r4:c24fa280
[ 8572.440000] [<c00ae978>] (vfs_ioctl+0x0/0x94) from [<c00aefa8>] (do_vfs_ioctl+0x4a0/0x4f0)
[ 8572.450000] r7:00000003 r6:40045612 r5:c24fa280 r4:00000003
[ 8572.450000] [<c00aeb08>] (do_vfs_ioctl+0x0/0x4f0) from [<c00af050>] (sys_ioctl+0x58/0x7c)
[ 8572.460000] [<c00aeff8>] (sys_ioctl+0x0/0x7c) from [<c0027e40>] (ret_fast_syscall+0x0/0x2c)
[ 8572.470000] r8:c0027fe8 r7:00000036 r6:bef68784 r5:0087e320 r4:00000020
[ 8572.480000] Mem-info:
[ 8572.480000] Normal per-cpu:
[ 8572.480000] CPU 0: hi: 18, btch: 3 usd: 17
[ 8572.490000] Active_anon:207 active_file:2177 inactive_anon:784
[ 8572.490000] inactive_file:2665 unevictable:395 dirty:5 writeback:0 unstable:0
[ 8572.490000] free:794 slab:1420 mapped:6024 pagetables:97 bounce:0
[ 8572.510000] Normal free:3176kB min:1016kB low:1268kB high:1524kB active_anon:828kB inactive_anon:3136kB active_file:8708kB inactive_file:10660kB unevictable:1580kB present:65024kB pages_scanned:0 all_unreclaimable? no
[ 8572.520000] lowmem_reserve[]: 0 0
[ 8572.530000] Normal: 214*4kB 74*8kB 26*16kB 17*32kB 10*64kB 1*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 3176kB
[ 8572.540000] 5410 total pagecache pages
[ 8572.540000] 50 pages in swap cache
[ 8572.550000] Swap cache stats: add 52, delete 2, find 2/2
[ 8572.550000] Free swap = 261936kB
[ 8572.550000] Total swap = 262136kB
[ 8572.560000] 16384 pages of RAM
[ 8572.570000] 932 free pages
[ 8572.570000] 2353 reserved pages
[ 8572.570000] 1027 slab pages
[ 8572.570000] 10587 pages shared
[ 8572.580000] 50 pages swap cached
[ 8572.580000] fsl-ehci fsl-ehci: dma_pool_free buffer-32, ffd72000/40a80000 (bad dma)
[ 8582.970000] fsl-ehci fsl-ehci: dma_pool_free buffer-32, ffd92000/436e0000 (bad dma)
[ 8582.980000] fsl-ehci fsl-ehci: dma_pool_free buffer-32, ffdb0000/437c0000 (bad dma)
[ 8582.980000] fsl-ehci fsl-ehci: dma_pool_free buffer-32, ffdce000/43660000 (bad dma)
I've changed the script to reboot every hour at :59 and not much functionality is lost. I imagine this approach to programing is "depreciated" by the linux experts.