Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on opening EPUB, HTML or RTF file #10679

Closed
ilyats opened this issue Jul 11, 2023 · 35 comments · Fixed by #10680 or koreader/koreader-base#1634
Closed

Crash on opening EPUB, HTML or RTF file #10679

ilyats opened this issue Jul 11, 2023 · 35 comments · Fixed by #10680 or koreader/koreader-base#1634

Comments

@ilyats
Copy link

ilyats commented Jul 11, 2023

  • KOReader version:v203.06.1-7-gb1c90260203-07-11
  • Device: ONyx Boox Nova3Color, Firmware 3.3.2 (based on Android 10)

Issue

Latest build seems to crash whenever trying open an EPUB, HTML or RTF file. PDF and DJVU files can be read without any problems. Sometimes there appears Android message '"KOReader keeps crashing'" with options "App info" "Close app" "Freeze this app", other times Koreader closes quietly. No crash logs produced.

Steps to reproduce

Open an EPUB, HTML or RTF file

@benoit-pierre
Copy link
Contributor

Nothing in logcat?

@benoit-pierre
Copy link
Contributor

Where's the build from?

@ilyats
Copy link
Author

ilyats commented Jul 11, 2023

@benoit-pierre the build is form OTA (unstable channel)
Output of logcat attached.
crash.log

@benoit-pierre
Copy link
Contributor

Is that an ARM or ARM64 device?

@ilyats
Copy link
Author

ilyats commented Jul 11, 2023

Processor: Aarch64 Processor rev 2 (aarch64)
CPU Architecture: 8

@benoit-pierre
Copy link
Contributor

I'm going to assume ARM64, out of curiosity, does this build work?

@NiLuJe
Copy link
Member

NiLuJe commented Jul 11, 2023

I can reproduce a crash on loading libkoreader-cre on Android 12 over here, so I'll check with a debug build ;).

07-11 20:12:57.934 23356 23356 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-11 20:12:57.934 23356 23356 F DEBUG   : Build fingerprint: 'OnePlus/OnePlus6/OnePlus6:11/RKQ1.201217.002/2111252325:user/release-keys'
07-11 20:12:57.934 23356 23356 F DEBUG   : Revision: '0'
07-11 20:12:57.934 23356 23356 F DEBUG   : ABI: 'arm64'
07-11 20:12:57.934 23356 23356 F DEBUG   : Timestamp: 2023-07-11 20:12:57.629813051+0200
07-11 20:12:57.934 23356 23356 F DEBUG   : Process uptime: 0s
07-11 20:12:57.934 23356 23356 F DEBUG   : Cmdline: org.koreader.launcher
07-11 20:12:57.934 23356 23356 F DEBUG   : pid: 23325, tid: 23345, name: Thread-111  >>> org.koreader.launcher <<<
07-11 20:12:57.934 23356 23356 F DEBUG   : uid: 10292
07-11 20:12:57.934 23356 23356 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x6800000054
07-11 20:12:57.934 23356 23356 F DEBUG   :     x0  0000006800000054  x1  0000007adeaac1d0  x2  0000000000000000  x3  0000000000000010
07-11 20:12:57.934 23356 23356 F DEBUG   :     x4  0000000000000000  x5  00000079b83995a0  x6  0000000000000040  x7  0000000060e200dd
07-11 20:12:57.934 23356 23356 F DEBUG   :     x8  0000000000000001  x9  0000007a5eaa0530  x10 0000000000000001  x11 00000000deaac284
07-11 20:12:57.934 23356 23356 F DEBUG   :     x12 0000ffff00000eff  x13 0000000000dbc37d  x14 000000007cdcefb7  x15 7269475f65685400
07-11 20:12:57.934 23356 23356 F DEBUG   :     x16 00000079a6d70988  x17 00000079a6b76e44  x18 00000079bd6de000  x19 0000007a9ea3f5f0
07-11 20:12:57.934 23356 23356 F DEBUG   :     x20 0000007adeaac1d0  x21 0000000000000002  x22 00000079a6d9bdf8  x23 000000000000002c
07-11 20:12:57.934 23356 23356 F DEBUG   :     x24 000000000000002d  x25 00000000fff90000  x26 ffffffffffffffff  x27 00000079bc6aba48
07-11 20:12:57.934 23356 23356 F DEBUG   :     x28 00000079bc6ab9c8  x29 00000079bdbd6870
07-11 20:12:57.934 23356 23356 F DEBUG   :     lr  00000079a6b78730  sp  00000079bdbd6460  pc  00000079a6b76f88  pst 0000000020000000
07-11 20:12:57.934 23356 23356 F DEBUG   : backtrace:
07-11 20:12:57.934 23356 23356 F DEBUG   :   NOTE: Function names and BuildId information is missing for some frames due
07-11 20:12:57.934 23356 23356 F DEBUG   :   NOTE: to unreadable libraries. For unwinds of apps, only shared libraries
07-11 20:12:57.934 23356 23356 F DEBUG   :   NOTE: found under the lib/ directory are readable.
07-11 20:12:57.934 23356 23356 F DEBUG   :   NOTE: On this device, run setenforce 0 to make the libraries readable.
07-11 20:12:57.934 23356 23356 F DEBUG   :       #00 pc 0000000000159f88  /data/data/org.koreader.launcher/files/libs/libcrengine.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #01 pc 000000000015b72c  /data/data/org.koreader.launcher/files/libs/libcrengine.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #02 pc 00000000001f01a8  /data/data/org.koreader.launcher/files/libs/libcrengine.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #03 pc 00000000001ebc40  /data/data/org.koreader.launcher/files/libs/libcrengine.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #04 pc 00000000001eb9ec  /data/data/org.koreader.launcher/files/libs/libcrengine.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #05 pc 00000000001e61bc  /data/data/org.koreader.launcher/files/libs/libcrengine.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #06 pc 00000000001c9704  /data/data/org.koreader.launcher/files/libs/libcrengine.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #07 pc 00000000001c945c  /data/data/org.koreader.launcher/files/libs/libcrengine.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #08 pc 0000000000022014  /data/data/org.koreader.launcher/files/libs/libkoreader-cre.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #09 pc 000000000001c700  /data/app/~~T4dt-Yv3WsxIIYbfbTkLRQ==/org.koreader.launcher-w73SXYjzGkdwNH_UgQloYQ==/lib/arm64/libluajit.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #10 pc 000000000001d31c  /data/app/~~T4dt-Yv3WsxIIYbfbTkLRQ==/org.koreader.launcher-w73SXYjzGkdwNH_UgQloYQ==/lib/arm64/libluajit.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #11 pc 000000000008b31c  /data/app/~~T4dt-Yv3WsxIIYbfbTkLRQ==/org.koreader.launcher-w73SXYjzGkdwNH_UgQloYQ==/lib/arm64/libluajit.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #12 pc 000000000001c700  /data/app/~~T4dt-Yv3WsxIIYbfbTkLRQ==/org.koreader.launcher-w73SXYjzGkdwNH_UgQloYQ==/lib/arm64/libluajit.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #13 pc 000000000008b31c  /data/app/~~T4dt-Yv3WsxIIYbfbTkLRQ==/org.koreader.launcher-w73SXYjzGkdwNH_UgQloYQ==/lib/arm64/libluajit.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #14 pc 000000000001c700  /data/app/~~T4dt-Yv3WsxIIYbfbTkLRQ==/org.koreader.launcher-w73SXYjzGkdwNH_UgQloYQ==/lib/arm64/libluajit.so
07-11 20:12:57.934 23356 23356 F DEBUG   :       #15 pc 000000000003018c  /data/app/~~T4dt-Yv3WsxIIYbfbTkLRQ==/org.koreader.launcher-w73SXYjzGkdwNH_UgQloYQ==/lib/arm64/libluajit.so (lua_pcall+144)
07-11 20:12:57.934 23356 23356 F DEBUG   :       #16 pc 0000000000002458  /data/app/~~T4dt-Yv3WsxIIYbfbTkLRQ==/org.koreader.launcher-w73SXYjzGkdwNH_UgQloYQ==/lib/arm64/libluajit-launcher.so (android_main+488) (BuildId: 961b3aace73d69b5e541c54969363649439875ac)
07-11 20:12:57.934 23356 23356 F DEBUG   :       #17 pc 0000000000003a2c  /data/app/~~T4dt-Yv3WsxIIYbfbTkLRQ==/org.koreader.launcher-w73SXYjzGkdwNH_UgQloYQ==/lib/arm64/libluajit-launcher.so (BuildId: 961b3aace73d69b5e541c54969363649439875ac)
07-11 20:12:57.934 23356 23356 F DEBUG   :       #18 pc 00000000000b1810  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264) (BuildId: 6bfaf10f10e5ff343703efae2f1bdbdb)
07-11 20:12:57.934 23356 23356 F DEBUG   :       #19 pc 00000000000512f0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 6bfaf10f10e5ff343703efae2f1bdbdb)
07-11 20:12:58.029  1004 13452 I ActivityManager: Process org.koreader.launcher (pid 23325) has died: fg  TOP

@benoit-pierre
Copy link
Contributor

I'd check with this patch.

@NiLuJe
Copy link
Member

NiLuJe commented Jul 11, 2023

I'd check with this patch.

Will do, thanks! (might be in a few hours)

@benoit-pierre
Copy link
Contributor

FWIR, crash would only happen on some EPUB with release builds with LTO, fixed with the above patch.

@ilyats
Copy link
Author

ilyats commented Jul 11, 2023

@benoit-pierre yes, your build works. (I had to uninstall the old version to install it, otherwise I got error W PackageManager: Package org.koreader.launcher signatures do not match previously installed version; ignoring!)

@benoit-pierre
Copy link
Contributor

Great, hopefully it's because of the aforementioned patch, and not one of the other gazillion changes!:P

@benoit-pierre
Copy link
Contributor

benoit-pierre commented Jul 11, 2023

I'm pretty sure the crash was reproducible with the emulator when compiling with clang too, just compile a release build.

@benoit-pierre
Copy link
Contributor

Additionally, I've dropped the mcode reserve hack in luajit-launcher's version of luajit, as I would only get crashes when enabling it. But that was with a newer NDK, and I've not re-checked with NDK23 (that patch is it still disabled in my meson branch).

@NiLuJe
Copy link
Member

NiLuJe commented Jul 11, 2023

Okay, so far, debug build works, so I'm going to try an unstripped release build w/ debug symbols first, for science!

@Frenzie
Copy link
Member

Frenzie commented Jul 11, 2023

Far too late, but I can confirm a crash on EPUB. This morning I'd only tried a PDF. Whoops. :-)

@Frenzie Frenzie added this to the 2023.07 milestone Jul 11, 2023
@NiLuJe
Copy link
Member

NiLuJe commented Jul 11, 2023

Okay, got a trace ;).

I'll test the patch after dinner.

07-11 21:30:53.882 31241 31262 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x6800000054 in tid 31262 (Thread-95), pid 31241 (reader.launcher)
07-11 21:30:54.256 31269 31269 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-11 21:30:54.257 31269 31269 F DEBUG   : Build fingerprint: 'OnePlus/OnePlus6/OnePlus6:11/RKQ1.201217.002/2111252325:user/release-keys'
07-11 21:30:54.257 31269 31269 F DEBUG   : Revision: '0'
07-11 21:30:54.257 31269 31269 F DEBUG   : ABI: 'arm64'
07-11 21:30:54.257 31269 31269 F DEBUG   : Timestamp: 2023-07-11 21:30:54.049105278+0200
07-11 21:30:54.257 31269 31269 F DEBUG   : Process uptime: 4s
07-11 21:30:54.257 31269 31269 F DEBUG   : Cmdline: org.koreader.launcher
07-11 21:30:54.257 31269 31269 F DEBUG   : pid: 31241, tid: 31262, name: Thread-95  >>> org.koreader.launcher <<<
07-11 21:30:54.257 31269 31269 F DEBUG   : uid: 10294
07-11 21:30:54.257 31269 31269 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x6800000054
07-11 21:30:54.257 31269 31269 F DEBUG   :     x0  0000006800000054  x1  0000007adeaab3d0  x2  0000000000000000  x3  0000000000000010
07-11 21:30:54.257 31269 31269 F DEBUG   :     x4  0000000000000000  x5  00000079ba7a65a0  x6  0000000000000040  x7  0000000060e200dd
07-11 21:30:54.257 31269 31269 F DEBUG   :     x8  0000000000000001  x9  0000007a5ea9fc90  x10 0000000000000001  x11 00000000deaab484
07-11 21:30:54.257 31269 31269 F DEBUG   :     x12 0000ffff00000eff  x13 0000000000dbc37d  x14 000000007cdcefb7  x15 7269475f65685400
07-11 21:30:54.257 31269 31269 F DEBUG   :     x16 00000079a756f958  x17 00000079a7375f3c  x18 00000079c0d0e000  x19 0000007a9ea3f5f0
07-11 21:30:54.257 31269 31269 F DEBUG   :     x20 0000007adeaab3d0  x21 0000000000000002  x22 00000079a759adc8  x23 000000000000002c
07-11 21:30:54.257 31269 31269 F DEBUG   :     x24 000000000000002d  x25 00000000fff90000  x26 ffffffffffffffff  x27 00000079bf9d3168
07-11 21:30:54.257 31269 31269 F DEBUG   :     x28 00000079bf9d30e8  x29 00000079c121b870
07-11 21:30:54.257 31269 31269 F DEBUG   :     lr  00000079a7377828  sp  00000079c121b460  pc  00000079a7376080  pst 0000000020000000
07-11 21:30:54.257 31269 31269 F DEBUG   : backtrace:
07-11 21:30:54.257 31269 31269 F DEBUG   :       #00 pc 000000000015a080  /data/data/org.koreader.launcher/files/libs/libcrengine.so (lstring32_chunk_t::alloc()+324)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #01 pc 000000000015b824  /data/data/org.koreader.launcher/files/libs/libcrengine.so (lString32::assign(char32_t const*)+308)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #02 pc 00000000001f02ec  /data/data/org.koreader.launcher/files/libs/libcrengine.so (LVNamedContainer::SetName(char32_t const*)+28)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #03 pc 00000000001ebd84  /data/data/org.koreader.launcher/files/libs/libcrengine.so (LVDirectoryContainer::OpenDirectory(char32_t const*, char32_t const*)+196)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #04 pc 00000000001ebb30  /data/data/org.koreader.launcher/files/libs/libcrengine.so (LVOpenDirectory(char32_t const*, char32_t const*)+272)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #05 pc 00000000001e6300  /data/data/org.koreader.launcher/files/libs/libcrengine.so (ldomDocCacheImpl::removeExtraFiles()+52)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #06 pc 00000000001c9848  /data/data/org.koreader.launcher/files/libs/libcrengine.so (ldomDocCacheImpl::init()+100)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #07 pc 00000000001c95a0  /data/data/org.koreader.launcher/files/libs/libcrengine.so (ldomDocCache::init(lString32, unsigned int)+188)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #08 pc 00000000000221d0  /data/data/org.koreader.launcher/files/libs/libkoreader-cre.so (initCache(lua_State*)+156)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #09 pc 000000000001c720  /data/app/~~ZRXe8Z-cBHZaevo5mACDmA==/org.koreader.launcher-QUiPsOXSAMBqNulIe7l0Fw==/lib/arm64/libluajit.so
07-11 21:30:54.257 31269 31269 F DEBUG   :       #10 pc 000000000001d33c  /data/app/~~ZRXe8Z-cBHZaevo5mACDmA==/org.koreader.launcher-QUiPsOXSAMBqNulIe7l0Fw==/lib/arm64/libluajit.so
07-11 21:30:54.257 31269 31269 F DEBUG   :       #11 pc 000000000008b33c  /data/app/~~ZRXe8Z-cBHZaevo5mACDmA==/org.koreader.launcher-QUiPsOXSAMBqNulIe7l0Fw==/lib/arm64/libluajit.so
07-11 21:30:54.257 31269 31269 F DEBUG   :       #12 pc 000000000001c720  /data/app/~~ZRXe8Z-cBHZaevo5mACDmA==/org.koreader.launcher-QUiPsOXSAMBqNulIe7l0Fw==/lib/arm64/libluajit.so
07-11 21:30:54.257 31269 31269 F DEBUG   :       #13 pc 000000000008b33c  /data/app/~~ZRXe8Z-cBHZaevo5mACDmA==/org.koreader.launcher-QUiPsOXSAMBqNulIe7l0Fw==/lib/arm64/libluajit.so
07-11 21:30:54.257 31269 31269 F DEBUG   :       #14 pc 000000000001c720  /data/app/~~ZRXe8Z-cBHZaevo5mACDmA==/org.koreader.launcher-QUiPsOXSAMBqNulIe7l0Fw==/lib/arm64/libluajit.so
07-11 21:30:54.257 31269 31269 F DEBUG   :       #15 pc 00000000000301ac  /data/app/~~ZRXe8Z-cBHZaevo5mACDmA==/org.koreader.launcher-QUiPsOXSAMBqNulIe7l0Fw==/lib/arm64/libluajit.so (lua_pcall+144)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #16 pc 0000000000002458  /data/app/~~ZRXe8Z-cBHZaevo5mACDmA==/org.koreader.launcher-QUiPsOXSAMBqNulIe7l0Fw==/lib/arm64/libluajit-launcher.so (android_main+488) (BuildId: f2bbc2aeb8b34e8d990619b313bd311f3faf0f33)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #17 pc 0000000000003a2c  /data/app/~~ZRXe8Z-cBHZaevo5mACDmA==/org.koreader.launcher-QUiPsOXSAMBqNulIe7l0Fw==/lib/arm64/libluajit-launcher.so (BuildId: f2bbc2aeb8b34e8d990619b313bd311f3faf0f33)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #18 pc 00000000000b1810  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264) (BuildId: 6bfaf10f10e5ff343703efae2f1bdbdb)
07-11 21:30:54.257 31269 31269 F DEBUG   :       #19 pc 00000000000512f0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 6bfaf10f10e5ff343703efae2f1bdbdb)

@pazos
Copy link
Member

pazos commented Jul 11, 2023

Thanks to @ilyats for staying on the bleeding edge and reporting back bugs 👍

@benoit-pierre
Copy link
Contributor

Okay, got a trace ;).

I'll test the patch after dinner.

07-11 21:30:53.882 31241 31262 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x6800000054 in tid 31262 (Thread-95), pid 31241 (reader.launcher)

[…]

07-11 21:30:54.257 31269 31269 F DEBUG : backtrace:
07-11 21:30:54.257 31269 31269 F DEBUG : #00 pc 000000000015a080 /data/data/org.koreader.launcher/files/libs/libcrengine.so (lstring32_chunk_t::alloc()+324)
07-11 21:30:54.257 31269 31269 F DEBUG : #1 pc 000000000015b824 /data/data/org.koreader.launcher/files/libs/libcrengine.so (lString32::assign(char32_t const*)+308)
[…]

This does indeed look like the problem fixed by benoit-pierre@ac500b3.

@poire-z
Copy link
Contributor

poire-z commented Jul 11, 2023

^ What was happening with the existing code ? And how your patch shuffling and union'ing everything lstring_chunk solves that issue ? (I did not understand what all this was about when I glanced at your big patch months ago, so it's the occasion for asking :)

@benoit-pierre
Copy link
Contributor

The original code breaks strict aliasing.

@poire-z
Copy link
Contributor

poire-z commented Jul 11, 2023

OK, I've just read a bit about it, a bit over my head but I somehow understand the idea. But I won't go try to understand where this bad thing happen in lvstring :) (unless there's an obvious place you can point to ?)

@NiLuJe
Copy link
Member

NiLuJe commented Jul 11, 2023

This does indeed look like the problem fixed by benoit-pierre@ac500b3.

Yup, that does the trick ;).

@NiLuJe
Copy link
Member

NiLuJe commented Jul 11, 2023

Additionally, I've dropped the mcode reserve hack in luajit-launcher's version of luajit, as I would only get crashes when enabling it. But that was with a newer NDK, and I've not re-checked with NDK23 (that patch is it still disabled in my meson branch).

Enabling the debug patch, things look okay so far over here ;).

e.g., something like

07-11 23:11:27.828  8597  8657 V LuaJIT  : mcode_alloc: target is @ 0x79bf420000
07-11 23:11:27.828  8597  8657 V LuaJIT  : mcode_alloc: range is 0x3e00000
07-11 23:11:27.828  8597  8657 V LuaJIT  : mcode_alloc: original hint is @ 0x79bf4bb000 (mcarea: 0x0 / last: 0x0 / reserve: 0x79bf4bb000)
07-11 23:11:27.828  8597  8657 V LuaJIT  : mcode_alloc_at: mapped 512K at @ 0x79bf4bb000
07-11 23:11:27.828  8597  8657 V LuaJIT  : mcode_allocarea: new 512K mcarea @ 0x79bf4bb000 (oldarea @ 0x0)

07-11 23:11:30.982  8597  8657 V LuaJIT  : lj_mcode_limiterr: J->szallmcarea: 524288 / sizemcode: 524288 / maxmcode: 524288 / need: 680
07-11 23:11:30.982  8597  8657 V LuaJIT  : trace_abort: LJ_TRERR_MCODEAL -> flush
07-11 23:11:30.982  8597  8657 V LuaJIT  : lj_trace_flushall: will clear mcode
07-11 23:11:30.982  8597  8657 V LuaJIT  : lj_mcode_clear: contiguous 512K link detected @ 0x79bf4bb000 (total: 512K) (next @ 0x0)
07-11 23:11:30.983  8597  8657 V LuaJIT  : lj_mcode_clear: recycled 512K mcarea @ 0x79bf4bb000

07-11 23:12:35.667  8597  8657 V LuaJIT  : lj_mcode_limiterr: J->szallmcarea: 524288 / sizemcode: 524288 / maxmcode: 524288 / need: 387
07-11 23:12:35.667  8597  8657 V LuaJIT  : trace_abort: LJ_TRERR_MCODEAL -> flush
07-11 23:12:35.668  8597  8657 V LuaJIT  : lj_trace_flushall: will clear mcode
07-11 23:12:35.668  8597  8657 V LuaJIT  : lj_mcode_clear: contiguous 512K link detected @ 0x79bf4bb000 (total: 512K) (next @ 0x0)
07-11 23:12:35.668  8597  8657 V LuaJIT  : lj_mcode_clear: recycled 512K mcarea @ 0x79bf4bb000

07-11 23:12:54.218  8597  8657 V LuaJIT  : lj_mcode_limiterr: J->szallmcarea: 524288 / sizemcode: 524288 / maxmcode: 524288 / need: 256
07-11 23:12:54.219  8597  8657 V LuaJIT  : trace_abort: LJ_TRERR_MCODEAL -> flush
07-11 23:12:54.219  8597  8657 V LuaJIT  : lj_trace_flushall: will clear mcode
07-11 23:12:54.219  8597  8657 V LuaJIT  : lj_mcode_clear: contiguous 512K link detected @ 0x79bf4bb000 (total: 512K) (next @ 0x0)
07-11 23:12:54.220  8597  8657 V LuaJIT  : lj_mcode_clear: recycled 512K mcarea @ 0x79bf4bb000

07-11 23:13:08.137  8597  8657 V LuaJIT  : lj_mcode_limiterr: J->szallmcarea: 524288 / sizemcode: 524288 / maxmcode: 524288 / need: 408
07-11 23:13:08.137  8597  8657 V LuaJIT  : trace_abort: LJ_TRERR_MCODEAL -> flush
07-11 23:13:08.138  8597  8657 V LuaJIT  : lj_trace_flushall: will clear mcode
07-11 23:13:08.138  8597  8657 V LuaJIT  : lj_mcode_clear: contiguous 512K link detected @ 0x79bf4bb000 (total: 512K) (next @ 0x0)
07-11 23:13:08.138  8597  8657 V LuaJIT  : lj_mcode_clear: recycled 512K mcarea @ 0x79bf4bb000

And on exit

07-11 23:14:33.564  8597  8657 V LuaJIT  : lj_mcode_limiterr: J->szallmcarea: 524288 / sizemcode: 524288 / maxmcode: 524288 / need: 1119
07-11 23:14:33.565  8597  8657 V LuaJIT  : trace_abort: LJ_TRERR_MCODEAL -> flush
07-11 23:14:33.565  8597  8657 V LuaJIT  : lj_trace_flushall: will clear mcode
07-11 23:14:33.565  8597  8657 V LuaJIT  : lj_mcode_clear: contiguous 512K link detected @ 0x79bf4bb000 (total: 512K) (next @ 0x0)
07-11 23:14:33.565  8597  8657 V LuaJIT  : lj_mcode_clear: recycled 512K mcarea @ 0x79bf4bb000

07-11 23:14:43.240  8597  8657 V LuaJIT  : lj_mcode_limiterr: J->szallmcarea: 524288 / sizemcode: 524288 / maxmcode: 524288 / need: 828
07-11 23:14:43.241  8597  8657 V LuaJIT  : trace_abort: LJ_TRERR_MCODEAL -> flush
07-11 23:14:43.241  8597  8657 V LuaJIT  : lj_trace_flushall: will clear mcode
07-11 23:14:43.241  8597  8657 V LuaJIT  : lj_mcode_clear: contiguous 512K link detected @ 0x79bf4bb000 (total: 512K) (next @ 0x0)
07-11 23:14:43.241  8597  8657 V LuaJIT  : lj_mcode_clear: recycled 512K mcarea @ 0x79bf4bb000

07-11 23:14:49.128  8597  8657 I KOReader: no dialog left to show
07-11 23:14:49.128  8597  8657 I KOReader: Tearing down UIManager with exit code: 0
07-11 23:14:49.206  8597  8657 I KOReader: Stopping KOReader main activity
07-11 23:14:49.244  8597  8597 V NativeGlue: Pause: 0x7afea67bd0

07-11 23:14:49.268  8597  8657 V LuaJIT  : lj_trace_freestate: will free mcode
07-11 23:14:49.268  8597  8657 V LuaJIT  : lj_mcode_free: mcarea was 0x79bf4bb000
07-11 23:14:49.268  8597  8657 V LuaJIT  : mcode_free: unmapped at @ 0x79bf4bb000
07-11 23:14:49.268  8597  8657 V LuaJIT  : lj_mcode_free: lastmcarea is now 0x79bf4bb000

i.e., the target mmap failing, falling back to the reserve, and recycling that ad nauseam.

As for what would be going wrong with a different compiler, I could possibly see the linker doing something funky with the reserve array in terms of where it ends up in the binary, so that would be something to look into, but the actual layout of the mappings shouldn't be affected (much) by the compiler/linker, I think?

One cannot exclude a stupid issue with the code/logic, though, I did write it after all ;p.

@Frenzie
Copy link
Member

Frenzie commented Jul 12, 2023

http://build.koreader.rocks/download/nightly/v2023.06.1-13-ge1ed3a71_2023-07-12/koreader-android-arm-v2023.06.1-13-ge1ed3a71_2023-07-12.apk seems to crash for me ftr

Edit: same on x86, but apologies for reporting it here since it's actually unrelated to crengine.

@poire-z
Copy link
Contributor

poire-z commented Jul 12, 2023

Hijacking this probably unrelated "crash" issue because I don't know which PR may have caused that.
With today's nightly, on my Kobo, KOReader crashes at start:

[ko-input] Forked off fake event generator (pid: 1017)
07/12/23-12:13:05 WARN  Device:getKeyRepeat: EVIOCGREP ioctl failed: Function not implemented
ffi.load (warning): libsharpyuv.so.0: cannot open shared object file: No such file or directory
./luajit: ./setupkoenv.lua:30: Not able to load dynamic library: libs/libmupdf.so
stack traceback:
    [C]: in function 'error'
    ./setupkoenv.lua:30: in function 'load'
    ./ffi/mupdf.lua:25: in main chunk
    [C]: in function 'require'
    frontend/document/canvascontext.lua:14: in main chunk
    [C]: in function 'require'
    ./reader.lua:191: in main chunk
    [C]: at 0x000140bd
!!!!
Uh oh, something went awry... (Crash n°1: 07/12/23 @ 12:13:06)

Dunno if libsharpyuv.so.0 is not build, or just missed being included in the zip?

@Frenzie
Copy link
Member

Frenzie commented Jul 12, 2023

My guess would be something related to koreader/koreader-base@290639e but I don't have time to check atm.

@Frenzie
Copy link
Member

Frenzie commented Jul 12, 2023

Though I can quickly confirm libsharpyuv.so.0.0.1 exists in the new libwebp build and presumably simply isn't copied.

@poire-z
Copy link
Contributor

poire-z commented Jul 12, 2023

OK, a quick rebuild of the updated version of libwebp for arm and copy of libsharpyuv.so.0 to my Kobo makes it work.

@Frenzie
Copy link
Member

Frenzie commented Jul 12, 2023

PS I left it implicit since I hadn't investigated but this was also the problem I alluded to above wrt Android.

@poire-z
Copy link
Contributor

poire-z commented Jul 12, 2023

Should we remove the nightlies & ota (and which?) ? Dunno how people doing auto updates will recover from updating and not able to start & update to next :/

@Frenzie
Copy link
Member

Frenzie commented Jul 12, 2023

Maybe not a bad idea for the latest.

@mergen3107
Copy link
Contributor

I wanted to test Style Tweak notifications with -13, and it crashed upon start on Android, trying to open epub.

@Frenzie
Copy link
Member

Frenzie commented Jul 12, 2023

I nuked the nightly zsync files so you'll get a 404 asking for an update to the dev channel. I'll leave the rest wrt libwebp to @NiLuJe or potentially myself in some 5 hours.

@poire-z
Copy link
Contributor

poire-z commented Jul 12, 2023

Sharing my kobo-libsharpyuv.so.zip to have its content put in koreader/libs/ for poor Kobo users who would get stuck.

NiLuJe added a commit to NiLuJe/koreader-base that referenced this issue Jul 12, 2023
Newer versions depend on the internal libsharpyuv, ship it.

Fix koreader/koreader#10679 (comment)
NiLuJe added a commit to koreader/koreader-base that referenced this issue Jul 12, 2023
Newer versions depend on the internal libsharpyuv, ship it.

Fix koreader/koreader#10679 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants