Kodi Community Forum

Full Version: atv-linux crystalhd-156 crashing Out of Memory
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am having repeatable crashes with August 30th (r33324) build of XBMC on my pin78 imaged atv-linux with CrystalHD-156 drivers.

dmesg: http://pastebin.com/1a0guLgq

xbmc.log: http://pastebin.com/r74skLdm

Curious what all of these lines in dmesg are for
Code:
[ 6111.905276] Invalid Line Number[10101010]

but this is the part where things fall apart I'm guessing -

Code:
[14597.626180] xbmc.bin invoked oom-killer: gfp_mask=0x1201d2, order=0, oomkilladj=0
[14597.626193] Pid: 7266, comm: xbmc.bin Tainted: P        2.6.24-28-generic #1
[14597.626217]  [<c0170caa>] oom_kill_process+0x10a/0x120
[14597.626239]  [<c01710f7>] out_of_memory+0x167/0x1a0
[14597.626252]  [<c017355c>] __alloc_pages+0x36c/0x3a0
[14597.626271]  [<c01756cd>] __do_page_cache_readahead+0x11d/0x250
[14597.626278]  [<c0122d94>] find_busiest_group+0x1c4/0x780
[14597.626296]  [<c0175bec>] do_page_cache_readahead+0x4c/0x70
[14597.626307]  [<c01701e4>] filemap_fault+0x2f4/0x420
[14597.626323]  [<c017b6a1>] __do_fault+0x61/0x420
[14597.626340]  [<c012111d>] kunmap_atomic+0x3d/0xb0
[14597.626349]  [<c017df55>] handle_mm_fault+0x435/0x730
[14597.626357]  [<c01442fe>] hrtimer_cancel+0xe/0x20
[14597.626366]  [<c031c9f9>] do_nanosleep+0x59/0x70
[14597.626399]  [<c031f51f>] do_page_fault+0x13f/0x730
[14597.626408]  [<c031c9e6>] do_nanosleep+0x46/0x70
[14597.626420]  [<c0144578>] sys_nanosleep+0x58/0x60
[14597.626428]  [<c031f3e0>] do_page_fault+0x0/0x730
[14597.626435]  [<c031dbb2>] error_code+0x72/0x80
[14597.626453]  =======================
[14597.626456] Mem-info:
[14597.626459] DMA per-cpu:
[14597.626463] CPU    0: Hot: hi:    0, btch:   1 usd:   0   Cold: hi:    0, btch:   1 usd:   0
[14597.626467] Normal per-cpu:
[14597.626471] CPU    0: Hot: hi:   90, btch:  15 usd:  61   Cold: hi:   30, btch:   7 usd:   6
[14597.626479] Active:51604 inactive:128 dirty:0 writeback:0 unstable:0
[14597.626481]  free:742 slab:1708 mapped:2798 pagetables:235 bounce:0
[14597.626488] DMA free:1072kB min:124kB low:152kB high:184kB active:10424kB inactive:0kB present:16256kB pages_scanned:17134 all_unreclaimable? yes
[14597.626494] lowmem_reserve[]: 0 237 237 237
[14597.626502] Normal free:1896kB min:1904kB low:2380kB high:2856kB active:195992kB inactive:512kB present:242824kB pages_scanned:402159 all_unreclaimable? yes
[14597.626508] lowmem_reserve[]: 0 0 0 0
[14597.626514] DMA: 2*4kB 1*8kB 0*16kB 1*32kB 0*64kB 0*128kB 0*256kB 0*512kB 1*1024kB 0*2048kB 0*4096kB = 1072kB
[14597.626528] Normal: 54*4kB 0*8kB 0*16kB 0*32kB 0*64kB 1*128kB 0*256kB 1*512kB 1*1024kB 0*2048kB 0*4096kB = 1880kB
[14597.626543] Swap cache: add 0, delete 0, find 0/0, race 0+0
[14597.626547] Free swap  = 0kB
[14597.626549] Total swap = 0kB
[14597.626551] Free swap:            0kB
[14597.628650] 65280 pages of RAM
[14597.628653] 0 pages of HIGHMEM
[14597.628656] 6963 reserved pages
[14597.628658] 12195 pages shared
[14597.628661] 0 pages swap cached
[14597.628663] 0 pages dirty
[14597.628665] 0 pages writeback
[14597.628668] 2798 pages mapped
[14597.628670] 1708 pages slab
[14597.628673] 235 pages pagetables
[14597.628678] Out of memory: kill process 7237 (xbmc) score 1280205 or a child
[14597.628713] Killed process 7249 (xbmc.bin)
[14598.078470] crystalhd 0000:02:00.0: Entering chd_dec_close
[14598.078481] crystalhd 0000:02:00.0: Closing user[0] handle
[14598.188162] no element found
[14607.283557] crystalhd 0000:02:00.0: Entering chd_dec_open
[14607.283566] crystalhd 0000:02:00.0: Opening new user[0] handle
[14607.477367] NVRM: Xid (0001:00): 16, Head 00000000 Count 00000001
[14608.644111] crystalhd 0000:02:00.0: Firmware Downloaded Successfully

FIrst time I saw this and have been able to easily repeat it is after updating to latest xbmc and new drivers/firmware for the bcm70012 chip. Hard for me to pinpoint which is the change that made it broke.

To repeat, I can simply take the freshly rebooted atv running pin87's image, but updated as stated above, and try to play a 1080i live tv feed from my hdhomerun device. This will kill it just about every time on the first time. Oddly some channels play fine, but some cause xbmc.bin to either restart or just freeze, and then lock me out of ssh and everything, requiring a hard reboot.

I can also repeat this playing 720p MKV movies. Doesn't matter which one that I can tell, but it takes about 2 or 3 to get it to drop. I can then reboot and go back and play the last attempted video file and it plays fine for the whole movie. Then try and play 1 or 2 more and it will crash again.

Sound like a mem leak issue to me, but that's a guess at best.
Seems you have no swap mounted. Do a swapon -a, and edit your /etc/fstab accordingly. Of course I am assuming you have a linux-swap partition created.
After a fresh reboot, under System Info, I'm showing 97MB free memory and CPU usage around 20% at idle.

I then start a 720p mkv movie and codec info shows CPU between 35 - 52% usage. (h264, yuv420p, 1280x704)

After stopping the movie and going back to System Info, I show Free Memory: 49MB, CPU still around 20%, again at idle after playing a movie for 60 seconds or so and stopping it.

I then go start another 720p MKV movie, and codec info shows CPU around 37 - 55%. (h264, yuv420p, 1280x544)

After stopping this second movie, I go back to System info and see 39MB free memory. CPU usage still at 20%.

Start up a 3rd movie, and I get a black screen, brief "X" in the middle of the screen, blue "no signal" screen, then black, then back to the XBMC home screen. SSH connection to the box was not lost and it didn't freeze this time (first crash after reboot.

Under System Info, my Free Memory shows back up to 99MB. So, perhaps not a mem leak, but something isnt' freeing up the memory after stopping playback.

Here is xbmc.log after this test:

http://pastebin.com/G53Yi1eh
Solaris Wrote:Seems you have no swap mounted. Do a swapon -a, and edit your /etc/fstab accordingly. Of course I am assuming you have a linux-swap partition created.

Hmm, quite possible I jacked something up while trying to figure out how to make the internal drive accessible by the linux os, because I was running out of space due to thumbnails and whatnot on the 4GB flash drive where pin's image is loaded.

Code:
xbmc@AppleTV:~$ swapon -a
(returns nothing)

Code:
xbmc@AppleTV:~$ more /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda3
UUID=c50fbc74-3297-456b-bbc4-68f2a85c3f43 /               ext3    relatime,errors=remount-ro 0       1
# /dev/sda4
#UUID=3ecb3176-9deb-46a4-9565-0acc0c13fdd2 none            swap    sw              0       0
UUID=3ecb3176-9deb-46a4-9565-0acc0c13fdd2 /media    hfsplus    rw    0    0

I see what I did -- commented out my swap, and tried to re-use for a mountpoint.. I'm sure I followed (halfway at least) someones guide to do that --- cause I wouldn't have tried that on my own Smile

I've uncommented the swap line and commented the one below it.. let's see if that resovles it -- good eye by the way!
Your logs do point to the swap issue. How proficient are you with Linux ? Do you know your way around parted ?
Yep, that seems to have been it. Unable the repeat the crashing so far. And free memory is returning back to 99MB after quitting playback of MKVs again. I guess I need to spend some more time figuring out how to give myself more space for thumbs and not do it halfway again Wink

Thanks
Solaris Wrote:Your logs do point to the swap issue. How proficient are you with Linux ? Do you know your way around parted ?

Never used it outside of following a tutorial. I do general bash scripting work and sed / awk stuff, but sysadmin stuff is a little vague for me.

My goal is to have the internal drive be accessible to the linux os so that my library is saved internally. I still want to be able to boot to the stock atv OS by removingt he flash drive if I need to so don't want to completely take over the drive, but having room for a good size library (no media) would be nice.
Glad I could help. You should just move the image to internal HD, performance will improve, and you will reclaim all your space.
Oops I posted after, you said you wanted to maintain ATV OS. You should be able to mount your ATV drive by adding an entry to fstab.
Solaris Wrote:Glad I could help. You should just move the image to internal HD, performance will improve, and you will reclaim all your space.

Would I lose the original functionality? I occasionally use the AirTunes functionality of the original OS.


Solaris Wrote:Oops I posted after, you said you wanted to maintain ATV OS. You should be able to mount your ATV drive by adding an entry to fstab.

Ah, ok.. I think that is what I had attempted, but failed at.
Quote:Invalid Line Number[10101010]

Ignore it, It's a quirk of how the crystalhd card is trying to find something. This will depend heavily on exactly how the video was encoded. That log line will go away in a future version, it's there for driver development.

Swap: if you don't have swap, you will die fast Smile You don't need a partition swap, a file based swap works just as well.

Mount the ATV Media Partition: both OSBoot and Media are HFSPlus journaled. Linux will always default mount this read only. There are ways to get it mounted read/write.
You would definitely lose the Airtunes. I replace that with Airport Express at my house Smile. Running Linux only on ATV has proved a blessing, running smooth as butter. Also got rid of pesky SMB shares, in favor of nfs. 1080p goodness in the bedroom = Wifey very happy. Thank you Davilla and XBMC Smile
I'm open to recommendations in editing my fstab further. If I can make /dev/sda4 be used for library storage and incorporate some sort of file based swap (if that is better than a parition swap) I'm all for it.
If booting from the USB is what you want, I say leave sda4 alone. Disk space seems to be an issue. If you search the original crystalbuntu thread, you will find howtos on how to use the hard drive.
Solaris Wrote:You would definitely lose the Airtunes. I replace that with Airport Express at my house Smile. Running Linux only on ATV has proved a blessing, running smooth as butter. Also got rid of pesky SMB shares, in favor of nfs. 1080p goodness in the bedroom = Wifey very happy. Thank you Davilla and XBMC Smile

I hear you, and I also have 2 AEs in the house. I've straigtened out any SMB issues, for now at least, and funny your username being Solaris, (off topic) I've recently ditched opensolaris on my mediaserver in favor of freebsd. I get to keep my zfs and it is running so much more stable for me. I just never could get SMB shares reliable on OSOL between my Mac, win7 and atv mounting them, and NFS wasn't as fast in my tests. Freebsd has been superb.