Closed hssm closed 9 years ago
Reported by nicolas.raoul
on 2011-07-20 00:06:19
Seems as if this is related to the apostrophe in your deck's name. Could you try it
again with a changed deck name?
I experienced this bug again, but without having an apostrophe in the name.
Of course, we have to solve this program-sided; shouldn't be too much work...
Reported by NorbertNagold
on 2011-07-20 07:40:12
Thanks. I removed the apostrophe and am still seeing the same problem.
Here's a small (3-card) version of the deck, if anyone wants to try it. This deck causes
the same problem on my device: I'm kicked out of reviewing mode about 5 seconds after
showing the answer.
Maybe it's something to do with custom fonts?
Reported by mikemorr.com
on 2011-07-20 13:26:23
Hi Mike,
Thanks for the simplified deck, it will make it easier to identify the problem!
Unfortunately, I was not able to reproduce the bug on my Android 1.5: After showing
the answer, I have been waiting for 2 minutes and still nothing suspicious.
Could you please send us a log taken after you renamed your deck? (the apostrophe created
other exceptions that might make other logs less obvious to see)
Reported by nicolas.raoul
on 2011-07-21 02:47:08
Thanks. Here's a log from the new 3-card deck. Today I didn't get kicked out of the
reviewer every single time, but when I wasn't getting kicked out, the app was still
being very sluggish.
http://www-personal.umich.edu/~mikemorr/ankidroidlog20110721.txt
Reported by mikemorr.com
on 2011-07-21 04:30:55
Thanks for the deck. I wasn't able to reproduce this. Answering all cards worked without
any problems.
Reported by NorbertNagold
on 2011-07-21 07:36:07
I answered about 20 times (waiting for 6 seconds before pressing "Again") and still
can't reproduce, on Android 1.5
As you said, it is probably due to custom fonts. Could you please post your file:///mnt/storage/AnkiDroid/fonts/KanjiStrokeOrders.ttf
?
Reported by nicolas.raoul
on 2011-07-21 07:49:43
The two files I currently have in that fonts folder are:
KanjiStrokeOrders.ttf, the Kanji Stroke Order Font, from http://sites.google.com/site/nihilistorguk/
YOzREF.TTC, containing YOzFontEF, YOzFontEF Italic, YOzFontEF90, and YOzFontEF90 Italic,
from http://yozvox.web.infoseek.co.jp/
Reported by mikemorr.com
on 2011-07-21 12:16:48
I had a closer look into this. Indeed, there was a problem with the whiteboard state,
which was not restored if the deck's path contained apostrophes. I solved this case
by always stripping the the path of single and double quotes.
The problem seems to be here:
07-19 13:11:17.867 I/ActivityManager( 1216): Process com.ichi2.anki (pid 17643) has
died.
07-19 13:11:18.023 I/WindowManager( 1216): WIN DEATH: Window{4580a930 com.ichi2.anki/com.ichi2.anki.StudyOptions
paused=false}
07-19 13:11:18.023 I/WindowManager( 1216): WIN DEATH: Window{458ba620 com.ichi2.anki/com.ichi2.anki.Reviewer
paused=false}
07-19 13:11:18.328 I/ActivityManager( 1216): Start proc com.ichi2.anki for activity
com.ichi2.anki/.StudyOptions: pid=17678 uid=10027 gids={1015, 3003, 3002, 3001}
07-19 13:11:18.328 I/ActivityManager( 1216): Low Memory: No more background processes.
07-19 13:11:18.859 I/UsageStats( 1216): Unexpected resume of com.ichi2.anki while already
resumed in com.ichi2.anki
07-19 13:11:19.047 I/AnkiDroid(17678): New instance of custom exception handler
As I understand this, ankidroid is paused due to low memory (which is probably caused
of ankidroid too) and restarted again. Since there were some changes of ankidroid's
intent structure, a restart starts studyoptions and not the last opened intent. I'm
afraid we have to solve two problems:
a) (re)starting ankidroid with the last used intent
b) find the memory leaks
Cheers!
Norbert
Reported by NorbertNagold
on 2011-07-24 07:53:13
I tested my 3-card deck (attached above) with some earlier versions. Problem does not
occur with 0.6 (or 0.7alpha1, which is almost the same version).
With 0.7alpha2 and all later versions I've tried, reviewing is very slow and sluggish.
Sometimes the kick-back to the study options screen occurs after tapping "Show Answer";
sometimes it occurs after tapping an answer button (Again/Hard/etc.); and sometimes
it does not occur at all.
As a workaround, though, I can disable custom fonts (for example, by renaming my AnkiDroid/fonts
directory to something else, so AnkiDroid doesn't see it). Reviewing is quick and smooth
when I disable the fonts.
Reported by mikemorr.com
on 2011-07-25 02:36:21
Was 0.6 displaying custom fonts correctly?
Reported by nicolas.raoul
on 2011-07-25 02:54:40
Accepted
Someone else has reported hitting a low memory condition which occurs only when using
custom fonts.
A possible cause is that many fonts for Japanese are much larger than regular fonts
because they need to include a much larger set of character and often the fonts, besides
often having a more detailed representation of Japanese characters then standard fonts
like Arial.
Could you try using a custom font that is not as large (e.g., a non-japanese font from
your desktop) and see if this still happens?
Thanks for your help investigating this.
Reported by flerda
on 2011-07-25 03:07:02
Nicolas, I don't see the custom fonts in 0.6, but I thought that feature wasn't introduced
until 0.7alpha2.
Reported by mikemorr.com
on 2011-07-25 03:31:41
OK, I could not remember, thanks!
It would be interesting to try with a lighter font as Flavio suggested.
Reported by nicolas.raoul
on 2011-07-25 03:35:40
Flavio, I tried specifying some Latin custom fonts with 0.7beta13, instead of the Japanese
fonts, and behavior was as desired: reviewing was quick and smooth, the custom fonts
displayed correctly on the deck's English text, and the Japanese characters not contained
in the Latin font fell back to the default Android font.
So the problem only occurs with the large/Japanese fonts.
Reported by mikemorr.com
on 2011-07-25 04:02:09
Thanks for this useful information!
Setting priority to "Medium" as it is not really a memory leak (or is it?).
At least we can try and fix this:
a) (re)starting ankidroid with the last used intent
Reported by nicolas.raoul
on 2011-07-25 04:37:23
but there must definitely some memory leaks. AD slows considerably down after some time
(even without japanese fonts). A restarts solves this case.
Unfortunately I'm lacking the knowledge to find this problem...
Cheers!
Norbert
Reported by NorbertNagold
on 2011-07-25 07:23:35
seems as if all fonts (even smaller ones) slow ad down. It's considerably smoother without.
Reported by NorbertNagold
on 2011-07-25 11:36:55
I have been unable to reproduce this so far.
AnkiDroid does not actually load any of the fonts.
However, it is possible that either:
- we are retaining multiple WebViews: if each of them loads a font, that might consume
quite some memory
- a particular version of WebView has a leak
In particular, for a large font I get a delay in displaying it the first time I review
a deck. However, this does not happen after the first card. Did you notice this delay
on the first card? Does it happen for every card? It might be that the WebView is reloading
the font each time.
Would you be able to capture an HPROF dump from a device in the state where it is using
too much memory?
The easiest way to do that is to use DDMS (in Eclipse or on its own).
Reported by flerda
on 2011-07-26 00:18:31
I was able to reproduce on a different device!
I am investigating...
Reported by flerda
on 2011-07-26 00:44:17
Started
Okay. It seems the webview is keeping state around.
I tried a quick trick: create a new webview each time we show a card.
That's probably not where we want to end up with, but at least could be used to show
whether the problem is.
I have a commit at:
https://github.com/flerda/Anki-Android/commit/fba3bf623bd941f82478a203e3709ab0f2f8dcc9
which does this (also attached an APK, for anyone who want to test it, will need to
remove the existing version first).
This, of course, is not ready to be merged. The card flickers every time it flips a
card, but, if you get a chance to try it, please do let me know if it fixes the memory
issue.
Thanks!
Reported by flerda
on 2011-07-26 01:55:05
WaitingForFeedback
I'm trying that .apk (from comment 21 above) now. To start everything fresh, I'm starting
with a reboot of my device. Here's a description of my experience:
Using the Ankidroid-issue687.apk version.
Using MikesDeckForIssue687 (the 3-card deck attached in comment 3 above).
Reviewing first card. Tap "Show Answer".
First card has a short delay before showing the Kanji Stroke Order Font in the answer.
First card also seems slow in responding when I tap "Again".
However, all subsequent cards seem reasonably quick to review.
Rebooting again; I want to try something different this time.
Using the Ankidroid-issue687.apk version.
Using MikesDeckForIssue687 (the 3-card deck attached in comment 3 above).
Reviewing first card. Tap "Show Answer".
First card has a short delay before showing the Kanji Stroke Order Font.
This time, I'm feeling impatient, so I try swiping up and down to scroll the card before
the font is displayed. That (attempting to scroll) causes me to get kicked out of reviewing
(like in the original problem), but I get kicked to the deckpicker instead of to study
options.
Log of that experience (where I tried to scroll, and got kicked to the deckpicker)
is here:
http://www-personal.umich.edu/~mikemorr/AnkiDroidLog20110726-1.txt
(As an aside, I have two custom fonts specified in this deck: the stroke order font
and YOzFont. I notice that the YOzFont isn't showing up, but maybe it never did; that
could be a problem with me not figuring out the right file name, since I'm trying to
use one font out of a TTC file.)
Reported by mikemorr.com
on 2011-07-26 12:58:09
Now trying the same with the standard 0.7beta13 .apk.
Very first card kicked me back to the deckpicker after tapping "Show Answer".
After that, it's behaving much like the new .apk, for some reason: short delay on first
card; quicker after that; scrolling causes kick-out; kicking to deckpicker instead
of study options.
I'll look into getting the HPROF dump you mentioned.
Reported by mikemorr.com
on 2011-07-26 13:07:11
Here's an .hprof file from DDMS. I hope I did it right; I tried to time it for when
the Memory Usage pie chart (under Sysinfo) looked the most out of balance.
http://www-personal.umich.edu/~mikemorr/20110805-2.com.ichi2.anki.hprof
Reported by mikemorr.com
on 2011-08-06 13:58:58
Thanks for the details.
Two things:
- Can you send the output of:
adb shell dumpsys meminfo com.ichi2.anki
possibly if you can do this at 4 different stages:
- before starting review;
- while showing the first card
- while showing the first answer
- while showing the second card
The leak seems to be within the native code, probably related to:
http://code.google.com/p/android/issues/detail?id=9904
- Can you also attach the result of:
adb bugreport
Thanks,
-Flavio
Reported by flerda
on 2011-08-08 16:48:32
I think Flavio has fixed that, so please everyone test the latest beta and let us know!
http://code.google.com/p/ankidroid/downloads
Reported by nicolas.raoul
on 2011-08-09 02:37:23
Thank you Flavio ! I tried the 0.7 beta20 with KanjiStrokeOrder and it's much better
than before, as I wasn't brought back to the main screen during the review.
The display of the first card was slow. Then most of the cards were quickly displayed,
but not all of them. Sometimes, the on/kun yomi included in the anwser is replaced
by the kanji (so I have two kanji in my answer, in two different fonts, instead of
kanji + on/kun yomi).
I had only a few cards to review, so I will try it again tonight with more cards.
Reported by fluttering.lili
on 2011-08-09 12:37:47
Flutteri, can you please send screenshots ( http://code.google.com/p/androidscreencast
) when this happens? And also the deck that contains the card on the screenshot. Thanks!
Reported by nicolas.raoul
on 2011-08-09 12:48:56
Hi Flavio, here's the meminfo from various points in time. At one point during the second
attempt, you can see the numbers climb, and
then "error: protocol fault".
http://www-personal.umich.edu/~mikemorr/dumpsys-meminfo20110809-1.txt
And here's the bugreport:
http://www-personal.umich.edu/~mikemorr/bugreport20110809-1.txt
I haven't tried 0.7beta20 yet.
Reported by mikemorr.com
on 2011-08-09 15:34:14
I'm experiencing the same problems in 0.7beta20.
Reported by mikemorr.com
on 2011-08-09 16:14:26
As asked by Nicolas, I made a record with Androidsreencast. As you will see, the right
and left side of the screen are inverted, for an unknown reason. I don't know how to
fix it, but I think it's enough to see what's happening.
The answer of the first card is quite slow to display. No problem after this one.
At 0:51 there is a crash (exit app). At 1:06, I have an answer with two kanjis in two
different fonts instead of kanji/kun-on yomi.
Reported by fluttering.lili
on 2011-08-09 19:54:54
Thanks Flutteri! I understand now.
Side issue: In your video attached, the screen is split in two parts vertically, the
left parted being displayed on the right, and the right part on the left. It is not
an issue specific with AnkiDroid, right? Is it displayed like this on your phone itself?
Or is it a problem of the recording software androidscreencast?
Reported by nicolas.raoul
on 2011-08-10 01:51:36
Accepted
there is still some flickering when exchanging the webviews, especially on night mode
and on starting reviewer. Flavio, you consider recreating the webviews as the only
possibility to get rid of the memory leak? Probably, better have fonts working and
a bit flickering than vice-versa.
But it would be great to solve this (as there are as well some issues together with
the upcoming animations).
Cheers!
Nrobert
Reported by NorbertNagold
on 2011-08-10 07:28:49
To Nicolas
The right-left parts problem on the video is due to androidscreencast, and I don't
know how to solve it. But it has nothing to see with Ankidroid, don't worry !
Reported by fluttering.lili
on 2011-08-10 09:32:35
Flutteri, could you please report the androidscreencast problem here?
http://code.google.com/p/androidscreencast/issues/entry
It is an open source project as well, so let's help them :-)
I recommend uploading both the video and a screenshot of the video for immediate understanding.
Thanks!
Reported by nicolas.raoul
on 2011-08-10 12:11:37
Issue 712 appears to be reporting the "flicker" issue.
Reported by mikemorr.com
on 2011-08-10 19:29:25
Now using 0.7beta20.
I found that I consistently get kicked back to the deckpicker if I attempt to scroll
the card up and down while waiting for the custom-font character to display; see 0:31
and 0:55 in this screencast: http://www.youtube.com/watch?v=V5g5w0riWO4
I wrote a batch file to run "adb shell dumpsys meminfo com.ichi2.anki" once per second.
Here's the resulting log corresponding to that screencast: http://www-personal.umich.edu/~mikemorr/20110810meminfolog.txt
And here's the output of "adb bugreport", taken just after doing that screencast: http://www-personal.umich.edu/~mikemorr/20110810bugreport.txt
Reported by mikemorr.com
on 2011-08-10 20:28:43
Thanks for all the details.
The problem seems to be that the system runs out of memory and since there is nothing
else left to kill, it kills AnkiDroid.
08-10 15:58:41.452 I/ActivityManager( 1215): Low Memory: No more background processes.
08-10 15:58:41.710 I/ActivityManager( 1215): Process com.ichi2.anki (pid 1449) has
died.
08-10 15:58:41.710 I/WindowManager( 1215): WIN DEATH: Window{4574e3b0 com.ichi2.anki/com.ichi2.anki.StudyOptions
paused=false}
08-10 15:58:41.710 I/WindowManager( 1215): WIN DEATH: Window{45648710 com.ichi2.anki/com.ichi2.anki.Reviewer
paused=false}
Looking at the meminfo, AnkiDroid had allocated 40MB of native memory just before being
killed (note, the pid changes).
** MEMINFO in pid 2215 [com.ichi2.anki] **
native dalvik other total
size: 40320 4871 N/A 45191
allocated: 29705 4170 N/A 33875
free: 10614 701 N/A 11315
(Pss): 20508 5660 19596 45764
(shared dirty): 1440 3764 804 6008
(priv dirty): 20208 3056 15828 39092
[...]
** MEMINFO in pid 2365 [com.ichi2.anki] **
native dalvik other total
size: 3924 2951 N/A 6875
I am not sure how this is related to the scrolling though, unless it just happens that
while you are scrolling the system allocates extra memory.
Reported by flerda
on 2011-08-11 09:32:55
Norbert,
> there is still some flickering when exchanging the webviews, especially on night
mode and on starting reviewer.
Yes, there is some flickering, which is annoying.
For the night view, probably setting a black background in the frame layout might help.
> Flavio, you consider recreating the webviews as the only possibility to get rid of
the memory leak? Probably, better have fonts working and a bit flickering than vice-versa.
> But it would be great to solve this (as there are as well some issues together with
the upcoming animations).
I have not found any other way to address the leak. Since the leak is in the WebView
itself, there is no easy way to work around it. I have looked at the WebView implementation
and tried to trace font loading down through WebKit, but the path is not that straightforward.
There might be other way to fix this, but I could not find any so far.
One possibility would be to have a setting to enable custom fonts, and then do the
WebView swapping only in that case.
I actually tried using the 3.1 animation APIs to slide the WebView in from the side,
which makes the transition a bit less bothersome. That might be a way to reduce the
effect of the issue.
-Flavio
Reported by flerda
on 2011-08-11 09:39:01
> One possibility would be to have a setting to enable custom fonts, and then do the
WebView swapping only in that case.
I thought about this too. This is probably a good thing. And we can additionally fill
the background frame with the background color in case custom fonts are enabled.
Reported by NorbertNagold
on 2011-08-11 11:20:16
I've just noticed that after finishing a deck with custom font, when I press "Open a
another deck" ("Ouvrir un autre paquet" in my french version), Ankidroid suddenly close
up with a crash message.
It doesn't seem to happen after a deck without custom font.
This is not a big issue, as I can restart the app immediately (device doesn't crash).
Reported by fluttering.lili
on 2011-08-12 09:10:51
Hi Flutteri,
Thank you very much for the crash feedback! It is a serious problem that we must solve
before 0.7.
Could you please use the "SendLog" application just after the crash and post the result
in this issue I just created?
http://code.google.com/p/ankidroid/issues/detail?id=717
Thanks!
Reported by nicolas.raoul
on 2011-08-12 09:19:35
I believe this issue has been solved before the last release.
Please re-open this issue if you are still seeing the same behavior.
Reported by flerda
on 2012-01-24 21:57:38
Fixed
Changing summary from "Kicked back to deck screen when "Show Answer" is pressed." to
"Extremely large fonts cause restart".
Sorry I've been away for a bit. I did some more testing with a recent beta, and extremely
large fonts consistently seem to cause AnkiDroid to restart. (Let me know if you think
I should move this to a new issue.) Details follow:
Using AnkiDroid 2.0beta15 on Archos 28 4GB, firmware 2.4.83, Android 2.2.1.
On Windows desktop (Anki 2.0-beta18), I created a simple 10-card test deck with the
Basic note type. (Front: 1, Back: A; Front: 2, Back: B; etc.)
I kept the default styling for the Basic note type, except I changed "font-family:
arial;" to "font-family: testfont;".
I copied the following fonts of various sizes from my C:\Windows\Fonts folder to the
tablet's AnkiDroid/fonts folder:
33,791,880 mingliub.ttc
23,275,812 arialuni.ttf
17,931,856 KanjiStrokeOrders_v3.000.ttf
14,366,944 YOzREF.TTC
4,127,600 epkyouka.ttf
1,654,136 CharisSILR.ttf
69,480 Curlz___.TTF
43,704 Eurosti.TTF
I renamed each font file in turn to "testfont", preserving the original extension (.ttf/.TTF/.ttc/.TTC),
and reviewed the test deck in AnkiDroid.
Results:
Using each of the four smaller font files (under 5MB), there was a 2-second delay before
showing the first card, but then reviewing proceeded smoothly, with the appropriate
font displayed.
But using each of the three largest font files (over 17MB), the first card's text was
never displayed; instead, the timer in the upper right corner counted to about 4 or
5 seconds, and then AnkiDroid seemed to restart.
With the moderately large (14MB) font file (YOzREF.TTC), the font was displayed after
a 20-second delay; then reviewing proceeded sluggishly, eventually leading to a restart
after reviewing several cards.
Bottom line: For now, at least, it looks like I can use Japanese fonts, but I have
to stick with the smaller ones; EPSON 教科書体M (epkyouka.ttf) seems to work fine, but
the larger fonts (KanjiStrokeOrders and Y.OzFont) may be too large for my device to
handle. I'll use platform-specific CSS in Anki so I can specify the smaller fonts for
mobile.
If this is really an Android bug rather than an AnkiDroid bug, I'd be OK with closing
this issue and putting a warning about large fonts on the UsingCustomFonts wiki page.
Reported by mike@mikemorr.com
on 2012-08-18 14:40:38
New
Yes, I think the cause of the restart is a memory leak in WebView.
It seems that it re-loads the font every time the page is loaded.
I do not think we can fix that.
The delay itself is not a bug, it is just that loading the page takes longer than expected.
There might be ways to show a spinner until the font is loaded. That part of the issue
might be actionable (but probably could use a separate issue).
my 2c
Reported by flerda
on 2012-08-18 17:49:42
Thanks Flavio! To me, the 2-second delay while loading the first card is not a problem.
Reported by mike@mikemorr.com
on 2012-08-19 05:27:32
A question: Using epkaisho.ttf (about 3MB) in 2.0beta16, I recently had a restart occur
while reviewing many cards in a row. As I understand it, this might be caused by a
gradual increase in memory use over time due to the WebView leak. Does enabling the
Display/Animations preference cause the WebView to be reset for each card, thereby
freeing up memory? In other words, do the animations not only look cool (and they do
look cool!), but also possibly help to prevent restarts while reviewing?
Reported by mike@mikemorr.com
on 2012-08-22 12:24:02
Actually, I have at some point implemented exactly that.
Every time you load a new card, a new WebView is created.
I think this was eventually changed to only done if custom fonts are installed.
Not sure if that code is still there.
Reported by flerda
on 2012-08-22 15:05:47
Has this been fixed?
Reported by perceptualchaos2
on 2014-04-15 12:28:47
WaitingForFeedback
No, unfortunately, the symptoms in 2.2alpha37 are the same as in my comment #44 above.
But if it's really a bug in WebView or some other part of Android 2.2.1 rather than
in AnkiDroid, I'm still OK with closing this issue and putting a warning about large
fonts in the wiki.
Reported by mike@mikemorr.com
on 2014-04-15 14:15:42
Originally reported on Google Code with ID 687
Reported by
mikemorr.com
on 2011-07-19 17:29:42