iPhone Unexplained App Exits - FolderEnhancer Icon Caching is cause?

Discussion in 'Jailbreaks and iOS Hacks' started by ckong, May 4, 2013.

  1. ckong macrumors regular

    Joined:
    Nov 12, 2009
    #1
    Even after the last Winterboard v0.9.3911 update in the beginning of March, I was still getting miscellaneous apps exiting. The symptoms were:

    1. An App may immediately drop back to the Springboard right after being launched.
    2. Apps wouldn't stay running in background even though there was plenty of memory in my iPhone5. Normally things would get killed as soon as the memory dropped below 512 Mb or so.
    3. Scrolling down a long list of programs (like in Activator) would cause the program itself and all others to immediately drop back to the springboard.

    In the beginning, the app exits were few in number. Lately, they've become much more common that I was re-springing or rebooting my phone at least 3 times a day.

    Yesterday, it was found that by shutting off FolderEnhancer's "Cache Icon Images", the problems have basically gone away.

    For a comparison, two days ago, I had over 500 app exits:

    ckongs-iPhone:/var/log root# grep "^May 2.*Exited: Killed: 9$" syslog | wc -l
    515

    Today, I barely have 30:

    ckongs-iPhone:/var/log root# grep "^May 4.*Exited: Killed: 9$" syslog | wc -l
    31

    I'm one of those people that have over 500 apps on my phone. So, shutting off the caching is a bother as it takes a few seconds to bring up a really large folder.

    Anybody else seeing similar issues with FolderEnhancer's Icon Caching?
     
  2. BumpyFlatline, May 5, 2013
    Last edited: May 5, 2013

    BumpyFlatline macrumors 68030

    BumpyFlatline

    Joined:
    Apr 11, 2012
    #2
    Interesting. I always use that FE feature myself too but I haven't noticed any apps being shut down in background. The only thing I've noticed is when I have about 5 or more safari tabs opened and when I switch between the tabs, they always quickly refresh. That never used to happen. The page always loads in a blink of an eye so it never bothered me that much to investigate the cause. I do use a few flex patches for safari so I just assumed the flex patches were causing safari to behave this way.

    I just disabled the FE icon cache feature. Ill report back later today if anything changes.
     
  3. BumpyFlatline macrumors 68030

    BumpyFlatline

    Joined:
    Apr 11, 2012
    #3
    I noticed chrome tabs reload quite frequently with FE's cached icons feature turned on. When I turn it off, the tabs stay cached in memory for much longer durations. With the featured turned on, if I use any other app, even temporarily, when I go back to the open chrome tabs, each tab has to reload. For now ill keep cached icons turned off since it seems to be buggy. Hopefully the dev will address it if it is in fact a bug.

    Either way, I haven't run the command to check for app exits yet. Correct me if I'm wrong, but I need to install the syslog package from Cydia in order for the command to work, right? Anyways, I think you're on to something. Ill keep doing some digging and see what I can learn. Ill email the dev too when I have time.
     
  4. ckong thread starter macrumors regular

    Joined:
    Nov 12, 2009
    #4
    Thanks for checking. Yeah. I think the syslog package has to be installed and on for the logging to be written to the /var/log/syslog.

    I was hoping the author would have found something by now as I did report the Activator-list issue a long time ago. But, maybe it's only me since this thread hasn't taken off much.

    This thread was first started with version 1.9.7. Ironically, version 1.9.8-1 was released the same day. It unfortunately didn't fix the problem. Versions 1.9.8.1-1 and 1.9.8.1-2 were released shortly after but still same issue.

    At this point, I'm resolved to live with it. Who knows, maybe iOS v7.0 w/jailbreak will be better?
     
  5. ckong thread starter macrumors regular

    Joined:
    Nov 12, 2009
    #5
    I think I stumbled upon the answer, or at least a work around...

    This weekend, I installed several updates from Cydia (like over 40 updates due to IOS7 cydia-app updates; I'm still on IOS 6.x). I decided to turn on Icon Caching in FolderEnhancer again to see if it was now stable on my phone. Nope, bizarre App Exists were still occurring. The biggest symptoms were:
    • only 2 or 3 apps would stay in background; almost all others would terminate (as seen thanks to SwitcherMod)
    • scrolling through long lists of programs (like in Activator) would cause Apps to terminate when the list was scrolled nearly to the end (for example the Settings App itself would dump back to the SpringBoard)
    Turning off Icon Caching made these problems go away, but it also made a couple of folders take over a second or three to load (yes...I still have over 500 apps on my phone). But in all this time on this forum, I didn't see anyone else with the blatant problems I was having (you ever feel like you're the only one having a certain issue?). There had to be a root cause and updating all cydia-apps didn't solve it.

    So... Just for laughs, I SSH'd into my phone and checked /var/log/syslog to see what it saw when an App Exited. I noticed a lot of these entries:

    Code:
    Jan 25 18:14:06 ckongs-iPhone kernel[0]: 1250 desired, 1250 numvnodes, 0 free, 0 dead, 0 rage
    Jan 25 18:14:06 ckongs-iPhone kernel[0]: vnode: table is full
    Jan 25 18:14:06 ckongs-iPhone kernel[0]: 1250 desired, 1250 numvnodes, 0 free, 0 dead, 0 rage
    Jan 25 18:14:07 ckongs-iPhone kernel[0]: vnode: table is full
    After doing many google searches, it turns out the maximum number of vnodes is tweakable. To find out the available settable kernal variables:

    Code:
    sysctl -a
    On my phone, the variable "kern.maxvnodes" was set for 1250...exactly what the syslog error message said. So (casting all caution to the wind; and a reading a little internet advice to increase by 1000 at a time):

    Code:
    sysctl -w kern.maxvnodes=2500
    To make sure the command took:

    Code:
    sysctl kern.maxvnodes
    So what was the result? It turns out doubling the original maxvnode value stabilized my App Exit issues...at least so far.

    The good part about doing this command-line fix is that it won't survive a reboot. Reboot the phone, and kern.maxvnodes goes back to 1250. Completely reversible! :)

    And...

    The bad part about doing this command-line fix is that it won't survive a reboot. Argh! I go back the way I started on reboot. :(

    Actually, the fix worked so well, I (did a lot of googling, then...) created a plist/shell script/config file setup to set the variable to 2500 every time my phone reboots. Now at long last, I have FolderEnhancer's Icon Caching turned on without problems. My phone seems very snappy/fast again. :D

    In a way, this all makes sense as my iPhone 5 has a gigabyte of RAM memory, and I'm guessing Apple had defaulted this value for earlier phones with less memory. It's just that no one else seems to have run into these problems as they aren't as App crazy as I am.

    I figure most of you Linux/BSD diehards can figure out the hacks. For those interested and for educational purposes, here is what I did:

    /Library/LaunchDaemons/script.conf.sysctl.plist

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>Label</key>
                    <string>script.sysctl.conf</string>
            <key>ProgramArguments</key>
                    <array>
                            <string>/usr/local/sbin/sysctl.conf.sh</string>
                    </array>
            <key>RunAtLoad</key>
                    <true/>
            <key>UserName</key>
                    <string>root</string>
            <key>GroupName</key>
                    <string>wheel</string>
    </dict>
    </plist>
    /usr/local/sbin/sysctl.conf.sh

    Code:
    #!/bin/sh
    
    # Abort on any non-zero error
    set -e
    
    # sysctl.conf file
    file="/private/etc/sysctl.conf"
    
    # Abort script if file is not there
    [ ! -f $file ] && exit
    
    while read -r line; do
    
        # Trim leading and trailing whitespace
        trimmed=`echo $line`
    
        # Ignore lines beginning with a #
        [[ "$trimmed" =~ ^#.*$ ]] && continue
    
        # Ignore blank lines
        [ -z "$trimmed" ] && continue
    
        # Modify kernel parameter
        /usr/sbin/sysctl -w $trimmed 
    
    done < "$file"
    /etc/sysctl.conf

    Code:
    # Default for vnodes is 1250.  Increasing it to 2500 as kernal was running out.
    kern.maxvnodes=2500
    Setting owner and rights:

    Code:
    chmod +x /usr/local/sbin/sysctl.conf.sh
    chown root:wheel /Library/LaunchDaemons/script.conf.sysctl.plist
    chmod 0644 /Library/LaunchDaemons/script.conf.sysctl.plist
    Load plist: (to launch without having to reboot phone)

    Code:
    launchctl load /Library/LaunchDaemons/script.conf.sysctl.plist
    Unload plist: (used a lot during testing)

    Code:
    launchctl unload /Library/LaunchDaemons/script.conf.sysctl.plist
    List services: (looking for a return/error code of zero)

    Code:
    launchctl list | grep sysctl
    -       0       script.sysctl.conf <--everything worked
    -       1       script.sysctl.conf <--something didn't work
    43      -       script.sysctl.conf <--script is running
    Disclaimer: Use this at your own risk. If your phone breaks in two, you own the pieces. I'm only documenting here in the hopes it'll help someone, or at least be interesting reading.

    Peace!
     

Share This Page