09-10-2020, 07:07 AM | #16 |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
Just recognized it myself and run bt.
But what happend after I quit gdb was that I got a message about not having registered an Adobe ID with the device, this message I have not seen before and it is true, I did not have registered it with Adobe. |
09-10-2020, 07:16 AM | #17 |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
New crashlog, did a "where" and a "bt" command.
|
Advert | |
|
09-10-2020, 08:04 AM | #18 | |
cosiñeiro
Posts: 1,271
Karma: 2200049
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Quote:
The backtrace points to the garbage collector failing to free some memory. Not sure if it is a bug in the code because that will affect all models and all other platforms. Anyways, could you try to reproduce with: Code:
diff --git a/frontend/device/pocketbook/device.lua b/frontend/device/pocketbook/device.lua index 84c76061..8f36586e 100644 --- a/frontend/device/pocketbook/device.lua +++ b/frontend/device/pocketbook/device.lua @@ -10,6 +10,13 @@ require("ffi/posix_h") require("ffi/linux_input_h") require("ffi/inkview_h") +ffi.cdef[[ + void *mmap(void *addr, size_t length, int prot, int flags, int fd, size_t offset); + int munmap(void *addr, size_t length); +]] + + + -- FIXME: Signal ffi/input.lua (brought in by device/input later on) that we want to use poll mode backend. -- Remove this once backend becomes poll-only. _G.POCKETBOOK_FFI = true @@ -17,6 +24,14 @@ _G.POCKETBOOK_FFI = true local function yes() return true end local function no() return false end +local function isModelBroken() + local model = ffi.string(inkview.GetDeviceModel()) + if model == "PB627" or model == "PB631" or model == "PocketBook 631" then + return true + end + return false +end + local ext_path = "/mnt/ext1/system/config/extensions.cfg" local app_name = "koreader.app" @@ -36,8 +51,28 @@ local PocketBook = Generic:new{ -- all devices that have warmth lights use inkview api hasNaturalLightApi = yes, + + should_restrict_JIT = isModelBroken, } +function PocketBook:restrictJIT() + -- reservation enough mmap slots for mcode allocation + local reserved_slots = {} + for i = 1, 32 do + local len = 0x10000 + i*0x1000 + local p = ffi.C.mmap(nil, len, 0x3, 0x22, -1, 0) + table.insert(reserved_slots, {p = p, len = len}) + end + -- free the reservation immediately + for _, slot in ipairs(reserved_slots) do + ffi.C.munmap(slot.p, slot.len) + end + -- and allocate a large mcode segment, hopefully it will succeed. + -- 64KB ought to be enough for everyone with 10000 loop threshold + require("jit.opt").start("sizemcode=64","maxmcode=64", "hotloop=10000") + for _=1,20000 do end -- Force allocation of one large segment +end + -- Make sure the C BB cannot be used on devices with a 24bpp fb function PocketBook:blacklistCBB() -- As well as on those than can't do HW inversion, as otherwise NightMode would be ineffective. @@ -70,6 +105,10 @@ local function tryOpenBook() end function PocketBook:init() + if self.should_restrict_JIT then + self:restrictJIT() + end + -- Blacklist the C BB before the first BB require... self:blacklistCBB() |
|
09-10-2020, 09:14 AM | #19 |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
Thanks for your effort ... and here comes the but .... now my problem is that I don't have a working compiling environment to do the changes.
Edit:Sorry I'm a little slow today. Did the change manually in device.lua, will test it soon. Last edited by nhedgehog; 09-10-2020 at 09:46 AM. |
09-10-2020, 10:00 AM | #20 |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
I did a quick test with an epub and it really worked at the beginning. I was soo happy but at the end it just took a lot of more clicks, to crash Koreader. I'll do some more thorough tests till tomorrow and provide the logfile if it crashes again.
|
Advert | |
|
09-10-2020, 11:24 AM | #21 |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
I did a thourough test with a difficult epub (lots of pages and lots of chapters) and a very difficult pdf (hundreds of svg on one page). Both files are known to be difficult to handle.
Couldn't bring it to crash easily but after same page turning opening the menu finally did it! There is a pattern going through it: 1) It is allways the menu opening or changing, that provokes the crash. Even the Koreader inbuild fileopener crashes after some directory changes. 2) The menu handling crashes Koreader easier after reading some pages. 3) The behaviour seems not to be affected by the size or complexity of the epub or pdf. Last edited by nhedgehog; 09-10-2020 at 11:36 AM. |
09-10-2020, 12:03 PM | #22 | |
cosiñeiro
Posts: 1,271
Karma: 2200049
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Quote:
rename /mnt/ext1/applications/koreader as /mnt/ext1/applications/koreader.old download last nightly from http://build.koreader.rocks/download/nightly/ and copy just the applications folder edit /mnt/ext1/applications/koreader/reader.lua: the first line should look like: Code:
#!./luajit -joff If you still manage to get memory corruption with the JIT compiler off there are probably other things involved. If you cannot then please compare performance (it is 10x worst or 100x worst?) Don't get me wrong. I'm not sure what I'm doing here, just blindy testing. Anyways the intent here is not disabling the JIT, but testing that we're unable to trigger the segfault without the JIT enabled. |
|
09-10-2020, 12:44 PM | #23 | |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
Did as you proposed. With nightly build, your changes to:device.lua&
Quote:
Now that is strange: I enabled nightmode and everything is slowed down so much it feels like I'm waiting more than 2-3 minutes for any reaction after my input. After disabling Night mode everything goes soooo fast. Edit: Thinking about it I guess Koreader didn't even crash, just slowed down soo much (nightmode) that I thought it crashed. Last edited by nhedgehog; 09-10-2020 at 01:08 PM. |
|
09-10-2020, 05:03 PM | #24 |
Groupie
Posts: 169
Karma: 100516
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
|
Getting onboard, perhaps a couple of steps behind nhedgehog. The debug build you posted, freshly installed, a single medium-sized epub, very early crashed. The first run doesn't include a bt because I c'ed once or twice too much past SIGSEGV. Some of the other have redundant bt and where, before I realized they were equivalent.
Anything else which I could specifically do? |
09-10-2020, 05:20 PM | #25 |
Groupie
Posts: 169
Karma: 100516
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
|
And this one inserting one by one the commands of nhedgehog in https://www.mobileread.com/forums/at...7&d=1599736061, i.e. starting koreader from gdb, instead of attaching gdb to the reader.lua process started earlier, just after opening the book.
Crash at the third or fourth page-turning tap at the center of the screen. |
09-10-2020, 05:38 PM | #26 |
cosiñeiro
Posts: 1,271
Karma: 2200049
Join Date: Apr 2014
Device: BQ Cervantes 4
|
@EastEriq @nhedgehog: thanks for your help!
Just try to run the last nightly with ./luajit -joff as stated above and without any other change. You don't need to run gdb or any other tool, just keep a look at logs and report segmentation faults (please remove old crash.log to avoid confusion ) Since this is painfully slow (specially for screen transformations like inversion or rotation) I would suggest to enable C blitter unless that makes the program crash (In developer options, see attachments) Just try to read books and explore the UI/Menus. As @nhedgehog said the behaviour isn't affected by big or complex files. It just happens randomly when the GC hits in. Also, if you don't mind, please lets move conversation to https://github.com/koreader/koreader/issues/6000 because it is easier to paste diffs there and keep track of reports. If that's not possible it is cool for me to stay here. Moderators can move this thread to dev's corner if they want |
09-10-2020, 06:12 PM | #27 |
Groupie
Posts: 169
Karma: 100516
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
|
Ok, moving to issue 6000. For tonight, I'll just briefly test #!./luajit -joff in reader.lua in the debug build I have currently installed. More of that, in the following.
|
09-14-2020, 10:46 PM | #28 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jul 2018
Device: Pocketbook Touch HD
|
This version works well enough for me:
https://github.com/koreader/koreader...018.10.07-beta |
09-15-2020, 02:52 PM | #29 |
Groupie
Posts: 169
Karma: 100516
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
|
yeah, tried it, I find somehow more difficult to crash it, but alas it has no RTL support, very few gestures, doesn't see my system fonts, and misses probably two years of other bonus features. Which for me defeats the purpose, not worth the disk space it would takes on my reader, if I was stuck at that one.
|
09-17-2020, 06:28 PM | #30 |
Groupie
Posts: 169
Karma: 100516
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
|
Bottom line, the cause for https://github.com/koreader/koreader/issues/6000 was identified and IIUC on the way to be solved. This is what I (and others likewise) did. Thanks a lot ezdiy, pazos, NiLuJe, nhedgehog.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pocketbook Touch HD PB631 - PDF Reflow bug with fw 5.20 | BluePiaf | PocketBook | 2 | 07-18-2020 06:32 PM |
Touch HD(PB631) ePub3 series management | sirtao | PocketBook | 3 | 02-13-2019 07:57 AM |
My new PB Touch HD 2 ( PB631 ) | Noto | PocketBook Developer's Corner | 7 | 10-19-2018 03:17 PM |
Themes for Touch HD2 (PB631)? | x01 | PocketBook | 1 | 08-14-2018 11:59 AM |
PRS-600 So what are the chances... | 44Dave | Sony Reader | 4 | 05-24-2010 04:58 AM |