cron / gpu memory discussion

edited November 2019 in Supported devices

@kalkov how do I get a cron to run ? In your demo it rebooted every 4 hours and wonder how you did that.

Tagged:

Comments

  • Why would you want to use cron? In Android, you can just write an app and have it do something periodically.

  • There is no cron in Android. Since have the full control of the system, we can add such tasks on many levels (kernel, android handler notifications, sleep functions, system deamons and more).

    What you need for your application is JobScheduler: https://developer.android.com/topic/performance/scheduling

  • Thanks @kalkov but I went with a easier solution. Since I enabled ssh on the first day I just use a cron on my debian desktop and scheduled a reboot every 4 hours...

    0 0,4,8,12,16,20 * * * ssh root@192.168.0.25 reboot #reboot PIDroid every 4 hours
    
  • @sgrayban, may I ask why you need to reboot your Pi every 4 hours?

  • System hangs if it runs for long time. I haven't been able to figure out why.

  • That shouldn't happen. Which OS version are you using? Do you still have a SSH access after it freezes?

  • Not sure of the version but when it freezes it locks everything. No ssh or a ping.

  • You can check the version in Settings -> Emteria.
    Do you have any application running all the time?

  • I have a few running in the background but Fully Browser Kiosk is running 24/7

  • I'm not at the location the PI is so I can't see it.

  • One of our business clients is running Fully Kiosk 24/7 for several months now without any issues. If it is a problem with our OS, we would be happy to fix it.

    If you have SSH access to it, could you please run "getprop"?

    • [camera.disable_zsl_mode]: [1]
    • [config.disable_consumerir]: [true]
    • [config.disable_samplingprof]: [true]
    • [ctl.stop]: [sendreport]
    • [dalvik.vm.appimageformat]: [lz4]
    • [dalvik.vm.dex2oat-Xms]: [64m]
    • [dalvik.vm.dex2oat-Xmx]: [512m]
    • [dalvik.vm.heapgrowthlimit]: [96m]
    • [dalvik.vm.heapmaxfree]: [8m]
    • [dalvik.vm.heapminfree]: [512k]
    • [dalvik.vm.heapsize]: [256m]
    • [dalvik.vm.heapstartsize]: [8m]
    • [dalvik.vm.heaptargetutilization]: [0.75]
    • [dalvik.vm.image-dex2oat-Xms]: [64m]
    • [dalvik.vm.image-dex2oat-Xmx]: [64m]
    • [dalvik.vm.isa.arm.features]: [default]
    • [dalvik.vm.isa.arm.variant]: [cortex-a53]
    • [dalvik.vm.lockprof.threshold]: [500]
    • [dalvik.vm.stack-trace-file]: [/data/anr/traces.txt]
    • [dalvik.vm.usejit]: [true]
    • [dalvik.vm.usejitprofiles]: [true]
    • [debug.atrace.tags.enableflags]: [0]
    • [debug.force_rtl]: [0]
    • [dev.bootcomplete]: [1]
    • [gsm.current.phone-type]: [1]
    • [gsm.network.type]: [Unknown]
    • [gsm.operator.alpha]: []
    • [gsm.operator.iso-country]: []
    • [gsm.operator.isroaming]: [false]
    • [gsm.operator.numeric]: []
    • [gsm.sim.operator.alpha]: []
    • [gsm.sim.operator.iso-country]: []
    • [gsm.sim.operator.numeric]: []
    • [gsm.sim.state]: [NOT_READY]
    • [init.svc.adbd]: [stopped]
    • [init.svc.audioserver]: [running]
    • [init.svc.bootanim]: [stopped]
    • [init.svc.cameraserver]: [running]
    • [init.svc.console]: [running]
    • [init.svc.debuggerd]: [running]
    • [init.svc.drm]: [running]
    • [init.svc.gatekeeperd]: [running]
    • [init.svc.healthd]: [running]
    • [init.svc.installd]: [running]
    • [init.svc.keystore]: [running]
    • [init.svc.lmkd]: [running]
    • [init.svc.logd]: [running]
    • [init.svc.logd-reinit]: [stopped]
    • [init.svc.media]: [running]
    • [init.svc.mediacodec]: [running]
    • [init.svc.mediadrm]: [running]
    • [init.svc.mediaextractor]: [running]
    • [init.svc.netd]: [running]
    • [init.svc.perfprofd]: [running]
    • [init.svc.servicemanager]: [running]
    • [init.svc.sshd]: [stopped]
    • [init.svc.sudaemon]: [running]
    • [init.svc.surfaceflinger]: [running]
    • [init.svc.ueventd]: [running]
    • [init.svc.vold]: [running]
    • [init.svc.wpa_supplicant]: [running]
    • [init.svc.zygote]: [running]
    • [keyguard.no_require_sim]: [true]
    • [log.tag.WifiHAL]: [D]
    • [logd.logpersistd.enable]: [true]
    • [net.bt.name]: [Android]
    • [net.change]: [net.dns2]
    • [net.dns1]: [192.168.0.1]
    • [net.dns2]: [8.8.8.8]
    • [net.hostname]: [android-fcfb796034f57d72]
    • [net.qtaguid_enabled]: [0]
    • [net.tcp.default_init_rwnd]: [60]
    • [nfc.app_log_level]: [1]
    • [nfc.enable_protocol_log]: [0]
    • [persist.logd.logpersistd]: []
    • [persist.logd.logpersistd.buffer]: []
    • [persist.logd.size]: []
    • [persist.rpi.backlight.full]: [0]
    • [persist.rpi.mode.auto]: [1]
    • [persist.rpi.mode.force]: [1152x864]
    • [persist.rpi.use-fkms]: [0]
    • [persist.service.bdroid.bdaddr]: [22:22:ae:78:8f:a1]
    • [persist.sys.dalvik.vm.lib.2]: [libart.so]
    • [persist.sys.sshd.enabled]: [1]
    • [persist.sys.timezone]: [America/Los_Angeles]
    • [persist.sys.ui.hw]: [false]
    • [persist.sys.usb.config]: [none]
    • [persist.sys.vncd.enabled]: [0]
    • [persist.sys.webview.vmsize]: [104857600]
    • [pm.dexopt.ab-ota]: [speed-profile]
    • [pm.dexopt.bg-dexopt]: [speed-profile]
    • [pm.dexopt.boot]: [verify-profile]
    • [pm.dexopt.core-app]: [speed]
    • [pm.dexopt.first-boot]: [interpret-only]
    • [pm.dexopt.forced-dexopt]: [speed]
    • [pm.dexopt.install]: [interpret-only]
    • [pm.dexopt.nsys-library]: [speed]
    • [pm.dexopt.shared-apk]: [speed]
    • [ro.allow.mock.location]: [0]
    • [ro.baseband]: [unknown]
    • [ro.board.platform]: [bcm2710]
    • [ro.boot.hardware]: [rpi3]
    • [ro.boot.selinux]: [permissive]
    • [ro.boot.serialno]: [000000004396a331]
    • [ro.boot.wificountrycode]: [US]
    • [ro.bootimage.build.date]: [Fr 26. Okt 11:07:05 CEST 2018]
    • [ro.bootimage.build.date.utc]: [1540544825]
    • [ro.bootimage.build.fingerprint]: [emteria/rpi3/rpi3:7.1.2/N2G48H/kalkov10261107:userdebug/test-keys]
    • [ro.bootloader]: [unknown]
    • [ro.bootmode]: [unknown]
    • [ro.build.characteristics]: [tablet,nosdcard,embedded]
    • [ro.build.date]: [Fr 26. Okt 11:07:05 CEST 2018]
    • [ro.build.date.utc]: [1540544825]
    • [ro.build.description]: [rpi3-userdebug 7.1.2 N2G48H eng.kalkov.20181026.110705 release-keys]
    • [ro.build.display.id]: [rpi3-userdebug 7.1.2 N2G48H eng.kalkov.20181026.110705]
    • [ro.build.fingerprint]: [emteria/rpi3/rpi3:7.1.2/N2G48H/kalkov10261107:userdebug/release-keys]
    • [ro.build.flavor]: [rpi3-userdebug]
    • [ro.build.host]: [aachen]
    • [ro.build.id]: [N2G48H]
    • [ro.build.product]: [rpi3]
    • [ro.build.selinux]: [1]
    • [ro.build.tags]: [release-keys]
    • [ro.build.type]: [userdebug]
    • [ro.build.user]: [kalkov]
    • [ro.build.version.all_codenames]: [REL]
    • [ro.build.version.base_os]: []
    • [ro.build.version.codename]: [REL]
    • [ro.build.version.incremental]: [eng.kalkov.20181026.110705]
    • [ro.build.version.preview_sdk]: [0]
    • [ro.build.version.release]: [7.1.2]
    • [ro.build.version.sdk]: [25]
    • [ro.build.version.security_patch]: [2018-01-05]
    • [ro.carrier]: [unknown]
    • [ro.config.alarm_alert]: [Alarm_Classic.ogg]
    • [ro.config.low_ram]: [1]
    • [ro.config.max_starting_bg]: [4]
    • [ro.config.notification_sound]: [pixiedust.ogg]
    • [ro.config.ringtone]: [Ring_Synth_04.ogg]
    • [ro.crypto.state]: [unsupported]
    • [ro.dalvik.vm.native.bridge]: [0]
    • [ro.debuggable]: [1]
    • [ro.device_owner]: [false]
    • [ro.expect.recovery_id]: [0x6d3b63acc8f5dbf1749de99300836255ad20339d000000000000000000000000]
    • [ro.hardware]: [rpi3]
    • [ro.hdmi.device_type]: [4]
    • [ro.hwui.disable_scissor_opt]: [true]
    • [ro.hwui.layer_cache_size]: [12]
    • [ro.hwui.texture_cache_flushrate]: [0.4]
    • [ro.hwui.texture_cache_size]: [16]
    • [ro.kernel.android.gps]: [ttyACM0]
    • [ro.logd.size]: [128K]
    • [ro.opengles.version]: [131072]
    • [ro.product.board]: []
    • [ro.product.brand]: [emteria]
    • [ro.product.cpu.abi]: [armeabi-v7a]
    • [ro.product.cpu.abi2]: [armeabi]
    • [ro.product.cpu.abilist]: [armeabi-v7a,armeabi]
    • [ro.product.cpu.abilist32]: [armeabi-v7a,armeabi]
    • [ro.product.cpu.abilist64]: []
    • [ro.product.device]: [rpi3]
    • [ro.product.locale]: [en-US]
    • [ro.product.manufacturer]: [brcm]
    • [ro.product.model]: [Raspberry Pi 3]
    • [ro.product.name]: [rpi3]
    • [ro.radio.noril]: [1]
    • [ro.release.branch]: [aosp-7.1]
    • [ro.release.target]: [rpi3]
    • [ro.release.version]: [0.6.0]
    • [ro.revision]: [0]
    • [ro.rfkilldisabled]: [1]
    • [ro.runtime.firstboot]: [1544255819907]
    • [ro.secure]: [1]
    • [ro.serialno]: [000000004396a331]
    • [ro.sf.lcd_density]: [213]
    • [ro.sys.sdcardfs]: [true]
    • [ro.wifi.channels]: []
    • [ro.zygote]: [zygote32]
    • [security.perf_harden]: [1]
    • [selinux.reload_policy]: [1]
    • [service.bootanim.exit]: [1]
    • [status.battery.level]: [5]
    • [status.battery.level_raw]: [50]
    • [status.battery.level_scale]: [9]
    • [status.battery.state]: [Slow]
    • [sys.boot_completed]: [1]
    • [sys.logbootcomplete]: [1]
    • [sys.sysctl.extra_free_kbytes]: [11664]
    • [sys.sysctl.tcp_def_init_rwnd]: [60]
    • [sys.usb.config]: [none]
    • [sys.usb.configfs]: [0]
    • [sys.usb.state]: [none]
    • [vold.has_adoptable]: [0]
    • [vold.post_fs_data_done]: [1]
    • [wifi.interface]: [wlan0]
    • [wlan.driver.status]: [ok]
  • You are running the latest version 0.6.0. The only freeze reason I was aware of was the leak of the GPU memory, but that should be fixed since 0.5.X. Just to make sure this problem didn't came back, we could monitor the memory state:

    cat /d/dri/0/bo_stats

    Run this command shortly after reboot and one more time 3 hours later. Do you know the frequency of freezes, if you don't reboot it? It would be great to see the memory state shortly before it happens.

  • It's random... sometimes just a few minutes, 30 minutes or hours later.

    Is there a way to tail a log and keep a running window open so I can capture it at failure time ?

  • current stats are.........

    rpi3:/ # cat /d/dri/0/bo_stats
                            kernel:   5120kb BOs (1)
                        V3D shader:    320kb BOs (80)
                            binner:  16384kb BOs (1)
                          resource:  13864kb BOs (64)
              resource 65536x1@8/0:    448kb BOs (7)
    scanout resource 1152x864@32/0:   7776kb BOs (2)
                        mesa cache:   5012kb BOs (18)
            resource 1048576x1@8/0:   4096kb BOs (4)
            resource 1152x864@32/0:  34992kb BOs (9)
             resource 576x576@32/0:   1296kb BOs (1)
             resource 131072x1@8/0:    512kb BOs (4)
                resource 128x1@8/7:     32kb BOs (4)
            resource 1024x512@8/10:   2052kb BOs (3)
                 resource 1x1@32/0:    148kb BOs (12)
               resource 81x81@32/6:    240kb BOs (4)
               resource 128x20@8/7:      8kb BOs (1)
                resource 96x20@8/6:      8kb BOs (1)
                resource 80x18@8/6:      8kb BOs (1)
                resource 64x20@8/6:      8kb BOs (1)
                resource 64x18@8/6:      8kb BOs (1)
               resource 112x14@8/6:      8kb BOs (1)
                resource 80x14@8/6:      8kb BOs (1)
                resource 64x12@8/6:     16kb BOs (2)
                resource 48x14@8/5:      8kb BOs (1)
               resource 27x27@32/4:     32kb BOs (4)
                resource 14x20@8/4:     16kb BOs (2)
               resource 20x19@32/4:      8kb BOs (1)
               resource 21x19@32/4:      8kb BOs (1)
               resource 19x19@32/4:      8kb BOs (1)
            resource 1280x864@32/0:   4320kb BOs (1)
             resource 1152x54@32/0:    864kb BOs (3)
             resource 1152x27@32/0:    432kb BOs (3)
            resource 1152x810@32/0:   3648kb BOs (1)
             resource 162x162@32/7:    464kb BOs (2)
           resource 1152x896@32/10:  13528kb BOs (2)
            tiling shadow 1152x864:   3888kb BOs (1)
                userspace BO cache:   5012kb BOs (18)
    
  • Well, if I added it all up correctly, there is almost 117 MB allocated (plus 10 MB of cache). Since Raspberry Pi only has 256 MB in total, it should be OK for now.

    I am not aware of a ready-to-use tail command for such cases, but you could run something like

    while true; do cat /d/dri/0/bo_stats; sleep 10; done

  • Just tested it - works :) But a newline would be great:

    while true; do cat /d/dri/0/bo_stats; echo ""; sleep 10; done

  • I'm surprised that android doesn't have a syslog.

  • I modified it

    while true; do cat /d/dri/0/bo_stats;echo "##############NEW STATS###########";echo ""; sleep 10; done

  • Android has "logcat" (or "logcat -d"), which doesn't include kernel information. You could also do "dmesg", but I think there is no continuous output.

  • Hi, as I wrote in another thread about GPU issues, I am experiencing the total system freezes in some graphics applications too. I am using display 800x480 so I think, it cannot be caused by insufficient GPU RAM. Mapfactor navigator switched to software rendering works fine but if I turn on hardware rendering then system hangs. Sometimes after one minute, sometimes after one hour.
  • @Martin Yup I think that's the issue.

    I left the PI running all night with the screen powered off. The minute I turned the screen on the system froze.

    Here is the stats output of the last run.

    ##############NEW STATS###########
                            kernel:   5120kb BOs (1)
                        V3D shader:    272kb BOs (68)
                            binner:  16384kb BOs (1)
                               RCL:      4kb BOs (1)
                               BCL:      4kb BOs (1)
                   kernel BO cache:     32kb BOs (6)
                          resource:  20048kb BOs (76)
              resource 65536x1@8/0:    384kb BOs (6)
    scanout resource 1152x864@32/0:   7776kb BOs (2)
                        mesa cache:  15840kb BOs (114)
            resource 1048576x1@8/0:   3072kb BOs (3)
            resource 1152x864@32/0:  34992kb BOs (9)
             resource 576x576@32/0:   1296kb BOs (1)
             resource 131072x1@8/0:    384kb BOs (3)
                resource 128x1@8/7:     24kb BOs (3)
            resource 1024x512@8/10:   1368kb BOs (2)
                 resource 1x1@32/0:    148kb BOs (12)
           resource 1152x896@32/10:  13528kb BOs (2)
               resource 128x20@8/7:      8kb BOs (1)
                resource 96x20@8/6:      8kb BOs (1)
                resource 80x18@8/6:      8kb BOs (1)
                resource 64x20@8/6:      8kb BOs (1)
                resource 64x18@8/6:      8kb BOs (1)
               resource 112x14@8/6:      8kb BOs (1)
                resource 80x14@8/6:      8kb BOs (1)
                resource 64x12@8/6:     16kb BOs (2)
                resource 48x14@8/5:      8kb BOs (1)
           resource 1024x704@32/10:   4184kb BOs (1)
             resource 512x128@32/0:   1280kb BOs (5)
               resource 176x20@8/7:     12kb BOs (1)
             resource 162x162@32/7:    464kb BOs (2)
            tiling shadow 1152x864:   7776kb BOs (2)
             resource 384x384@32/0:   4032kb BOs (7)
                userspace BO cache:  15840kb BOs (114)
    
    ##############END STATS###########
    
  • @Martin said:
    I think, it cannot be caused by insufficient GPU RAM. Mapfactor navigator switched to software rendering works fine but if I turn on hardware rendering then system hangs.

    This is exactly what GPU memory is used for.

    @sgrayban said:
    Here is the stats output of the last run.

    The allocation size is only around 135 MB, but I see that a lot of objects were created in the meantime. I'm afraid the freeze could be caused by the fragmentation of GPU memory (https://library.softwareverify.com/memory-fragmentation-your-worst-nightmare/).

  • What is the fastest way of reproducing this issue?

  • @kalkov said:
    What is the fastest way of reproducing this issue?

    No idea.... The screen is a Planar PT1985P-BK 19" Touchscreen LCD Monitor

  • I use RPI 3B+ with 7'' touchscreen (https://www.raspberrypi.org/products/raspberry-pi-touch-display) and Navilock USB GPS receiver (u-blox 5 chipset) as navigation device in my car.

    I use two navigation applications. The first one is Mapfactor Navigator using free open street maps. This application is great for testing because it enables switching between software and hardware rendering (menu->settings->advanced settings) and it contains simulation mode (menu->tools->simulation) - so you can simulate X-hours trip on the table in lab.
    This application froze together with whole system every time if I used hardware rendering, but time of freezing is very random. Maybe month ago, system froze immediately after start of Mapfactor. Yesterday, I sent my Raspberry to 6-hours virtual trip (in simulation mode) to another country. Device arrived to virtual destination but couple of minutes after arriving system froze again, in time when content of display was static.

    Second application is Waze. It would be better for reproducing this issue, because it freezes sooner, mostly in one hour, but it happens always in the car if I am driving. I don't know, if issue is reproducible in the lab, maybe some mock location tool could help.
    But Waze has second Emteria-specific issue - map flashing. It is reproducible very easily by zooming out in the map or switching to 3D. It's possible that map flashing and freezing has one common source... maybe.
  • @Martin, thanks for the details. We will start with Mapfactor and perform several tests.

  • My pleasure

  • I switched to software rendering in Fully Kiosk and the system is a lot more stable. Might want to add that to the docs @kalkov

  • @sgrayban, what exactly do you mean by words "lot more stable"? Is it still crashing but after longer time period?

  • edited December 2018

    It still hangs but its so random and far apart that I don't get that upset over it. Nothing like it was doing in the past.

    It hung only twice last week. Before I switched it would crash every hour.

  • Still shouldn't happen. We have the Mapfactor app installed on one of our devices for testing. Waiting for the next crash... :)

  • We have finally got a freeze, unfortunately, it wasn't related to the GPU:

    [ 1572.993859] INFO: rcu_preempt detected stalls on CPUs/tasks:
    [ 1573.006616] 3-...: (0 ticks this GP) idle=c87/1400000000 ...
    [ 1573.022247] (detected by 1, t=29276 jiffies, g=90637, c=90636, q=9)
    [ 1573.035644] Task dump for CPU 3:
    [ 1573.045815] surfaceflinger R running task 0 163 1 0x00000000
    [ 1573.060010] rcu_preempt kthread starved for 29276 jiffies! ...
    [ 1573.077100] rcu_preempt S 0 7 2 0x00000000

    This rather looks like a old known RPi sdcard controller issue :(
    We will repeat the test again to see the GPU performance.

  • Thanks for message @kalkov. Please could you send me some reference to description of "old known sdcard controller issue"?

  • Hi, I found good source of freezing yesterday. If I attach GPS receiver and run Waze on the table (so device is not moving), switch map to 2D (3D is not working) and start navigation to somewhere then whole system froze in 10 minutes. Always. I checked bo_stats and all objects took about 130MB. Logcat showed nothing. @kalkov , please could you verify if it is SD card controller issue or something else?

  • I'll try to reproduce it. We had multiple MapFactor tests, but non of them ever freezed :disappointed:

Sign In or Register to comment.