Hi all

I suffer from data corruption when processes writes/reads large
amounts of data (~100MiB) from/to filesystem and Jolla enters deep
sleep mode. Looks like a kernel bug to me.

Background: I have created a script for regular checking for updates,
downloading of zip archive with update and uncompressing it's contents
(``unzip -p $FILE > $OUTFILE``) to ~/android_storage/XXX. It worked
perfectly during manual testing, but when I finally configured it with
``timed`` to run without manual interaction, I found that most of the
time the script produces corrupted file. After close examination of
last corrupted file I found that it is 64KiB shorter than correct
uncompressed file with 64KiB chunk missing somewhere around the middle
of the file. WTF?!?!


### Guide to reproduce
Download sample zip file (~100MB).
``curl -o /home/nemo/android_storage/
test.obf.zip -L
'http://download.osmand.net/download.php?standard=yes&file=Russia_moskovskaya-oblast_asia_2.obf.zip'``

Save following script as ``/home/nemo/android_storage/test_unpack.sh``
    #!/bin/sh

    DIR=$(dirname "$0")
    ARCHIVE='test.obf.zip'
    OUTFILE="$DIR/archive_unzipped_$(date +%T)"

    exec >> "$DIR/test_unpack.log"
    exec 2>> "$DIR/test_unpack.log"

    unzip -p "$DIR/$ARCHIVE" | tee "$OUTFILE" | md5sum
    ls -l "$OUTFILE"

    echo ====


Schedule it execution for several times:
``for t in {300..1800..300};do timedclient-qt5
-a'whenDue;runCommand=/bin/sh
/home/nemo/android_storage/test_unpack.sh'
-e"APPLICATION=test_unpack;ticker=$t"; done``

Make sure your device is not connected to charger or USB, switch off
screen, put it aside and don't touch for 40 minutes.

When the time passes check ``~/android_storage/test_unpack.log``


### Testing results
I've tried to place the script and test zip file in different
locations / file systems to observe what might influence the results.
Running in ``~/android_storage``:
<http://pastebin.com/raw.php?i=mBKV6qS3> Only one uncompress out of
six was successful! Note that md5sum is equal in each run, thus
reading is OK, but writing fails.
Running on vfat formatted SD card:
<http://pastebin.com/raw.php?i=QBxzxrcp> unzip reports reading
failures, data have been successfully extracted only in 2 attempts out
of 8, writing seems to be OK. This is strange result, unzip does not
reports read failures o_O
And finally most stable test in $HOME:
<http://pastebin.com/raw.php?i=XYkb9qNe> Just one failure out of 8
attempts.



### Questions

1. Can anyone reproduce this by following my guide?
2. Is there a way to prevent device from entering deep sleep while
scheduled task is running to prevent data corruption?



This message is continuation of discussion at TJC:
<https://together.jolla.com/question/96381/data-loss-during-io-in-deep-sleep/>
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to