question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get error "Uncaught RuntimeError: unreachable" when initialize

See original GitHub issue

Describe the bug Hi,

Im getting this error: image

It happen when i call FPDF.Init().

It start happen only after use recent version of “emscripten”. Im using now “2.0.34” (but tested with others) to keep it updated, but need solve this error.

To Reproduce

  1. Download latest pdfium from my branch: https://www.dropbox.com/s/n1bz12hcvif2h0a/artifact-wasm-4692.zip?dl=1
  2. Unzip it: unzip artifact-wasm-4692.zip
  3. Untar it: tar -xzvf wasm.tgz
  4. Execute: cd "release/node"
  5. Execute: python -m http.server
  6. Open in browser: http://localhost:8000/?debug=1
  7. Execute on browser console: FPDF.Init()

Expected behavior

Initialize PDFium without problems.

Screenshots

image

System (please complete the following information):

  • OS: [e.g. macos]
  • Version [e.g. bigsur]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
paulocoutinhoxcommented, Nov 6, 2021

I tried all optimization levels, but still failling.

My stacktrace:

index.js:77 Uncaught RuntimeError: unreachable
    at pdfium::base::AllocPages(void*, unsigned long, unsigned long, pdfium::base::PageAccessibilityConfiguration, pdfium::base::PageTag, bool) (index.wasm:0x71085)
    at pdfium::base::internal::PartitionBucket::SlowPathAlloc(pdfium::base::internal::PartitionRootBase*, int, unsigned long, bool*) (index.wasm:0x72900)
    at fxcrt::StringDataTemplate<char>::Create(unsigned long) (index.wasm:0x5628)
    at fxcrt::StringDataTemplate<char>::Create(char const*, unsigned long) (index.wasm:0x5695)
    at fxcrt::ByteString::ByteString(char const*) (index.wasm:0x886e)
    at CLinuxPlatform::CreateDefaultSystemFontInfo() (index.wasm:0xf501)
    at CFX_GEModule::Create(char const**) (index.wasm:0x13666)
    at FPDF_InitLibraryWithConfig (index.wasm:0x70a9e)
    at main (index.wasm:0x367b)
    at index.js:1591
$pdfium::base::AllocPages(void*, unsigned long, unsigned long, pdfium::base::PageAccessibilityConfiguration, pdfium::base::PageTag, bool) @ index.wasm:0x71085
$pdfium::base::internal::PartitionBucket::SlowPathAlloc(pdfium::base::internal::PartitionRootBase*, int, unsigned long, bool*) @ index.wasm:0x72900
$fxcrt::StringDataTemplate<char>::Create(unsigned long) @ index.wasm:0x5628
$fxcrt::StringDataTemplate<char>::Create(char const*, unsigned long) @ index.wasm:0x5695
$fxcrt::ByteString::ByteString(char const*) @ index.wasm:0x886e
$CLinuxPlatform::CreateDefaultSystemFontInfo() @ index.wasm:0xf501
$CFX_GEModule::Create(char const**) @ index.wasm:0x13666
$FPDF_InitLibraryWithConfig @ index.wasm:0x70a9e
$main @ index.wasm:0x367b
(anonymous) @ index.js:1591
callMain @ index.js:5933
doRun @ index.js:5990
(anonymous) @ index.js:6001
setTimeout (async)
run @ index.js:5997
runCaller @ index.js:5911
removeRunDependency @ index.js:1520
receiveInstance @ index.js:1680
receiveInstantiationResult @ index.js:1697
Promise.then (async)
(anonymous) @ index.js:1726
Promise.then (async)
instantiateAsync @ index.js:1723
createWasm @ index.js:1754
(anonymous) @ index.js:5465

I change again to “2.0.24” to finish the PR and will open another PR to solve it.

1reaction
paulocoutinhoxcommented, Nov 28, 2021

I tried the same thing for emscripten 3.0.0 and this problem still 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

RuntimeError: unreachable in rustwasm - Stack Overflow
The issue is that dm.children.len() is 1 so immediately after the first iteration of the while loop, then i becomes 1 which triggers...
Read more >
JS catch wasm out of memory?
My understanding is that if a WASM module running in a JS host crashes, then a WebAssembly. RuntimeError exception is thrown. You should...
Read more >
Getting error: RuntimeError: unreachable - Bug Reports
I have one user who is reporting occasionally getting this error. I haven't been able to reproduce it on any other computer but...
Read more >
Warning: unreachable code after return statement - JavaScript
When an expression exists after a valid return statement, a warning is given to indicate that the code after the return statement is...
Read more >
Debugging - Rust and WebAssembly
Rather than getting cryptic, difficult-to-debug RuntimeError: unreachable executed error messages, this gives you Rust's formatted panic message.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found