Open Matgoeth opened 2 years ago
If it doesn't happen on Android, logically that just means that Kindle (or all Kindles) is woefully short on memory.
Ideally there should be something to abort in case of OOM instead of crashing of course.
This may be true, however maybe (since KOReader does display optimized pages) there is a chance it can be prevented either by not showing some parts or scaling something down? Also: this happens on a page that contains nothing but link in footer, so my guess is that there may be something else playing a role here (this shouldn't overload memory that much)?
Either way I decided to submit a bug, cause maybe it's a low-hanging fruit :)
Yep, OOM.
See https://github.com/koreader/koreader/issues/2663#issuecomment-1126975284 for some work being done to be able to murder the most egregious memory hog on the Kindle's stock framework.
(Fair warning: here be dragons, don't try this unless you understand the implications, and have USBNet working and ready at all time. Because Kindles are finicky, and soft bricks are not fun).
Also: this happens on a page that contains nothing but link in footer, so my guess is that there may be something else playing a role
error: malloc of array (9678 x 15442 bytes) failed
Sounds a bit like one of my first commits #2800 https://github.com/koreader/koreader/commit/76f6b4973 When there is something really small, that we want to scale, we might scale the whole original page (to then crop the relevant text from the super large image) - and may be cropping first and then scaling would be cheaper (if that's ever possible, dunno much about kopt).
Sounds a bit like one of my first commits #2800 76f6b4973 When there is something really small, that we want to scale, we might scale the whole original page (to then crop the relevant text from the super large image) - and may be cropping first and then scaling would be cheaper (if that's ever possible, dunno much about kopt).
I was originally thinking about providing 2-3 pages of this PDF here, but turns out if they are separated they don't cause such issue, so I gave up on that idea. I can still do that though, plus what you've mentioned may be the case since on Android it looks to be scaled like this: https://anopic.us/rVgRPkWNedrVSJkNtVlyemhhy1lmT1p63n7bH0JL.png
However, if I'll be able to help via logs, testing, screenshots or anything, I am more than happy to do so (I would like to keep my new paperwhite non-bricked however so probably wouldn't go as far as NiLuJe mentions, sorry 😞)
See #2663 (comment) for some work being done to be able to murder the most egregious memory hog on the Kindle's stock framework.
Tested on Kindle PW3 5.13.5 everything seems alright, only got one crash in Terminal emulator run htop then press clear button
The crash.log from that crash might have been interesting, just in case it was an actual crash and not an OOM kill ;o).
KOReader v2022.03.1-43-g86c35ad0_2022-05-01 with some git master patches and newer crengine
ping @zwim ;).
./luajit: plugins/terminal.koplugin/terminputtext.lua:399: invalid value (nil) at index 3 in table for 'concat'
stack traceback:
[C]: in function 'concat'
plugins/terminal.koplugin/terminputtext.lua:399: in function 'interpretAnsiSeq'
plugins/terminal.koplugin/main.lua:227: in function 'action'
frontend/ui/uimanager.lua:1212: in function '_checkTasks'
frontend/ui/uimanager.lua:1643: in function 'handleInput'
frontend/ui/uimanager.lua:1755: in function 'run'
./reader.lua:291: in main chunk
[C]: at 0x00013e9d
lipc-wait-event exited normally with status: 0
See #2663 (comment) for some work being done to be able to murder the most egregious memory hog on the Kindle's stock framework.
Tested on Kindle PW3 5.13.5 everything seems alright, only got one crash in Terminal emulator run htop then press clear button
I am looking into this tomorrow (today). But I can confirm the bug by now. :(
Unfortunately the issue still persists :(
crash.log
(if applicable)Once again: happy to help if this requires me to do any further testing
Accidentally closed by unrelated comment.
Issue
KOReader crashes when firing up certain pages from document. This doesn't seem to happen on Android version of the document and it may be that document is not well-formatted (there is only link in the footer, nothing else). There seems to be some strange URLs in crash.log so maybe KOReader would have some safety mechanism in case they do crash the app?
Steps to reproduce
Start KOReader (via KUAL in my case), flip the page to one causing problem - KOReader will stop responding shortly and will exit.
crash.log
(if applicable)crash.log
``` _ _____ ____ _ | |/ / _ \| _ \ ___ __ _ __| | ___ _ __ | ' / | | | |_) / _ \/ _` |/ _` |/ _ \ '__| | . \ |_| | _ < __/ (_| | (_| | __/ | |_|\_\___/|_| \_\___|\__,_|\__,_|\___|_| It's a scroll... It's a codex... It's KOReader! [*] Current time: 05/17/22-15:17:02 [*] Version: v2022.03.1 ffi.load: blitbuffer 05/17/22-15:17:02 INFO initializing for device KindlePaperWhite5 05/17/22-15:17:02 INFO framebuffer resolution: { ["w"] = 1236, ["h"] = 1648, } [ko-input] Forked off fake event generator (pid: 15422) ffi.load: libs/libmupdf.so ffi.load: libs/libwrap-mupdf.so ffi.load: libs/libfreetype.so.6 ffi.load: libs/libharfbuzz.so.0 ffi.load: libs/libzstd.so.1 ffi.load: libs/libutf8proc.so.2 PING 192.168.1.1 (192.168.1.1): 56 data bytes 64 bytes from 192.168.1.1: seq=0 ttl=64 time=35.069 ms --- 192.168.1.1 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 35.069/35.069/35.069 ms 05/17/22-15:17:04 INFO Loading plugins from directory: plugins ffi.load: sqlite3 05/17/22-15:17:11 INFO GestureDetector:probeClockSource: Touch event timestamps appear to use CLOCK_REALTIME 05/17/22-15:17:25 INFO opening file /mnt/us/documents/Markham, Noel/Java Programming Interviews Exposed - Noel Markham.pdf ffi.load: libs/liblept.so.5 ffi.load: libs/libk2pdfopt.so.2 05/17/22-15:17:25 INFO setting zoom mode to content warning: unknown link uri 'http://www.it-ebooks.info/' PING 192.168.1.1 (192.168.1.1): 56 data bytes 64 bytes from 192.168.1.1: seq=0 ttl=64 time=38.962 ms --- 192.168.1.1 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 38.962/38.962/38.962 ms 05/17/22-15:18:13 INFO cannot connect to calibre server warning: ... repeated 2 times ... warning: unknown link uri 'http://localhost:8080Thiswillrespondwiththesame%E2%80%9CHelloWorld.%E2%80%9DItwillnothaveatrailingnewline.ForagraphicalHTTPclient' warning: ... repeated 3 times ... warning: unknown link uri 'http://www.it-ebooks.info/' warning: ... repeated 2 times ... warning: unknown link uri 'http://localhost:8080/echo/' warning: unknown link uri 'http://www.it-ebooks.info/' warning: unknown link uri 'http://java.sun.com/xml/ns/javaee' warning: unknown link uri 'http://www.w3.org/2001/XMLSchema-instance' warning: unknown link uri 'http://www.it-ebooks.info/' warning: unknown link uri 'http://java.sun.com/xml/ns/javaee' warning: ... repeated 2 times ... warning: unknown link uri 'http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd' warning: unknown link uri 'http://www.it-ebooks.info/' warning: ... repeated 2 times ... warning: unknown link uri 'http://www.playframework.org' warning: unknown link uri 'http://localhost:9000' warning: unknown link uri 'http://www.it-ebooks.info/' warning: ... repeated 4 times ... error: malloc of array (9678 x 15442 bytes) failed ./luajit: ./ffi/mupdf.lua:78: could not allocate pixmap: malloc of array (9678 x 15442 bytes) failed (1) stack traceback: [C]: in function 'error' ./ffi/mupdf.lua:78: in function 'merror' ./ffi/mupdf.lua:1002: in function 'render_for_kopt' ./ffi/mupdf.lua:1051: in function 'getPagePix' frontend/document/koptinterface.lua:406: in function 'renderOptimizedPage' frontend/document/koptinterface.lua:443: in function 'hintPage' frontend/apps/reader/modules/readerhinting.lua:11: in function 'handleEvent' frontend/ui/widget/container/widgetcontainer.lua:95: in function 'propagateEvent' frontend/ui/widget/container/widgetcontainer.lua:113: in function 'handleEvent' frontend/apps/reader/modules/readerview.lua:97: in function 'action' frontend/ui/uimanager.lua:1201: in function '_checkTasks' frontend/ui/uimanager.lua:1622: in function 'handleInput' frontend/ui/uimanager.lua:1734: in function 'run' ./reader.lua:324: in main chunk [C]: at 0x00013e9d lipc-wait-event exited normally with status: 0 Segmentation fault ```