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

library_exceptions.js: exceptionThrowBuf leaks and causes lsan failures #12226

Closed
sbc100 opened this issue Sep 15, 2020 · 4 comments · Fixed by #12230
Closed

library_exceptions.js: exceptionThrowBuf leaks and causes lsan failures #12226

sbc100 opened this issue Sep 15, 2020 · 4 comments · Fixed by #12230

Comments

@sbc100
Copy link
Collaborator

sbc100 commented Sep 15, 2020

This means that all exception handling tests currently fail in asan mode. e.g:

 ./tests/runner.py asan.test_exceptions_custom
...
==42==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x437b2 in malloc+0x437b2 (/tmp/emscripten_test/src.wasm+0x437b2)
    #1 0x8000053d  (JavaScript+0x53d)
    #2 0x80000776 in ___cxa_find_matching_catch_3 /tmp/emscripten_test/src.js:1910:23
    #3 0x3492 in __original_main+0x3492 (/tmp/emscripten_test/src.wasm+0x3492)
    #4 0x62fc in main+0x62fc (/tmp/emscripten_test/src.wasm+0x62fc)
    #5 0x8000053d  (JavaScript+0x53d)
    #6 0x80001b04 in callMain /tmp/emscripten_test/src.js:6916:13
    #7 0x80001b29 in doRun /tmp/emscripten_test/src.js:6953:21
@sbc100
Copy link
Collaborator Author

sbc100 commented Sep 15, 2020

Not sure what the best solution is.. maybe the simplest thing to do would be to mark it specifically a leaked memory? Anyone remember how to do that?

@aheejin
Copy link
Member

aheejin commented Sep 15, 2020

It looks like the same bug I fixed long ago in #8947, using makeStaticAlloc. But #12039 reverted it to _malloc to support thread safety..? @kripken

@sbc100
Copy link
Collaborator Author

sbc100 commented Sep 15, 2020

Ah! Ok that makes sense. Thanks for the background.

@sbc100
Copy link
Collaborator Author

sbc100 commented Sep 15, 2020

I'll move it to a C static I think

sbc100 added a commit that referenced this issue Sep 15, 2020
Turns out this is a pointer that is only used locally so I guess
we can just stackAlloc it?

Fixes: #12226
sbc100 added a commit that referenced this issue Sep 15, 2020
Turns out this is a pointer that is only used locally so I guess
we can just stackAlloc it?

Fixes: #12226
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants