I encountered a crash bug on browser in a destructor of class.

26721 Test.worker.js:1 Uncaught TypeError: Cannot read properties of null (reading 'onwheel')
26722     at _emscripten_set_wheel_callback_on_thread (Test.js:9:298002)
26723     at Test.wasm:0xc931c1
26724     at Test.wasm:0xc9404e
26725     at Test.wasm:0x584be8
26726     at Test.wasm:0x584c63
26727     at Test.wasm:0x41b7d4
26728     at Test.wasm:0x41aacd
26729     at Test.wasm:0x4cdb70
26730     at Test.wasm:0x4ce67a
26731     at Test.wasm:0x4cdb4e
26732 _emscripten_set_wheel_callback_on_thread @ Test.js:9  //  1
26733 $func24281 @ Test.wasm:0xc931c1
26734 $func24289 @ Test.wasm:0xc9404e
26735 $func12652 @ Test.wasm:0x584be8
26736 $func12653 @ Test.wasm:0x584c63
26737 $func6984 @ Test.wasm:0x41b7d4
26738 $func6958 @ Test.wasm:0x41aacd
26739 $func10201 @ Test.wasm:0x4cdb70
26740 $func10273 @ Test.wasm:0x4ce67a
26741 $func10201 @ Test.wasm:0x4cdb4e
26742 $func20575 @ Test.wasm:0x951582
26743 $func1928 @ Test.wasm:0x119a51
26744 $func2100 @ Test.wasm:0x1331bd
26745 $func2102 @ Test.wasm:0x133348
26746 $func3391 @ Test.wasm:0x280f07
26747 $func3402 @ Test.wasm:0x2856f1
26748 runDestructor @ Test.js:9
26749 releaseClassHandle @ Test.js:9
26750 ClassHandle_delete @ Test.js:9
26751 delete @ wasmModule.ts:165
26752 closeCase @ interfaces.ts:321
26753 handleNavigate @ ExitOrderAlertPopup.tsx:25
26754 onClick @ UButton.tsx:77
26755 callCallback2 @ chunk-5EUSZPTA.js?v=fbd2250f:3674

I found the definition of emscripten_set_wheel_callback_on_thread in `/emsdk/upstream/emscripten/src/library_html5.js`.

It doesn’t check target before using it.

It’s bad code.

So I checked the version of emsdk:

[root:/emsdk] # ./emsdk list

The *recommended* precompiled SDK download is 3.1.35 (671550b5bdceee7bdb21493714f9a815aa5149a9).

To install/activate it use:
         latest

This is equivalent to installing/activating:
         3.1.35             

All recent (non-legacy) installable versions are:
         3.1.35    
         3.1.35-asserts    
         3.1.34    
         3.1.34-asserts    
         3.1.33    
         3.1.33-asserts    
         3.1.32    
         3.1.32-asserts    
         3.1.31    
         3.1.31-asserts    
         3.1.30    
         3.1.30-asserts    
         3.1.29    INSTALLED
         3.1.29-asserts    
         3.1.28    
         3.1.28-asserts    
         3.1.27    

Then I upgraded emsdk to 3.1.51:

cd /emsdk

./emsdk update

./emsdk install 3.1.51

./emsdk activate 3.1.51

source "/emsdk/emsdk_env.sh"

emsdk list

Had been new version:

The *recommended* precompiled SDK download is 4.0.4 (ea71afcf5a172125179a07ff1731de6e81c92222).

To install/activate it use:
         latest

This is equivalent to installing/activating:
         4.0.4             

All recent (non-legacy) installable versions are:
         4.0.4    
         4.0.4-asserts    
//...
         3.1.53    
         3.1.53-asserts    
         3.1.52    
         3.1.52-asserts    
         3.1.51    INSTALLED
         3.1.51-asserts    
         3.1.50    
         3.1.50-asserts

There is a check logic now.

New line:

if (!target) return {{{ cDefs.EMSCRIPTEN_RESULT_UNKNOWN_TARGET }}};

.

Rebuild the wasm project and test our web app. It works now.


2025.03.04:

You can also just add the following check logic for emscripten_set_wheel_callback_on_thread on /emsdk/upstream/emscripten/src/library_html5.js of 3.1.29 emsdk. Because higher version emsdk will generate a resize event bug on vtk wasm web app, relative post: https://www.weiy.city/2025/02/wasm-abortedassertion-failed-attempt-to-write-non-integer-undefined-into-integer-heap/

Add the line:

if (!target) return {{{ cDefine('EMSCRIPTEN_RESULT_NOT_SUPPORTED') }}};

Categories: Web

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X
0
Would love your thoughts, please comment.x
()
x