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

Random Bun test failures #185

Open
Tracked by #181
smiasojed opened this issue Jan 30, 2025 · 3 comments
Open
Tracked by #181

Random Bun test failures #185

smiasojed opened this issue Jan 30, 2025 · 3 comments

Comments

@smiasojed
Copy link
Collaborator

smiasojed commented Jan 30, 2025

Sometimes tests fail when executed with bun

105 | }
106 | return new Uint8Array(result, 0, uncompressedSize);
107 | }
108 | return uncompress(base64DecToArr(source), uncompressedSize);})(
109 | "ErcVAPAPAGFzbQEAAAABpw2rAWABfwBgAX8Bf2ACf38AYAJ/CwAgA38MACEDfw0AIQR/DgAiBH8PACIFfxAAIwV/EQAjBn8SACQGfxMAJAd/FAAlB38VABIAZABVAXxgCH8gACcIfyEAAYkANHxgCRQAA5YAJgF+EwABowARfikAU35gBH9+qAATfq4ASHxgCn8+ACoKfzkAA8AAAwkAFH7SAJJ+fn5+AGAAAX5GADZ+YAw4AAQRASJ8ADIAAXEAAC8AKw1/JQAcCzQAEX4BARN+EQAKMQACQgETfloBEX5hASJ+fl0AA3YBEXxUARd+gwABEAEUfJQBKQF8qAAB4gARfKkBASIBMXwBfE0ABCkBQwF/YAiNAAyuAAD8ABN8VQAQfsgBApkAFAovAAX5AQF9ADoQf38CAB0AEwADMAAUfroAE37KAUZ9YAN+FwITfkcCFX4JAgELAFQCfn4BfrsBEX4wABYOigAFGAITfYQCEn56AgVOAAUEAQR7AD1+YA6dAAHoARJ98wABCAAQfGcAHBHHAAP4AgBLAS4FfyQABU8AHRMVAAM7AwLNARIBkAEwf2AEagIBEQABlgECngAgAnzLATcGf3w+AxZ+RAEIHgECcAMUfh4ABAkAEgQmATYJf358AD4Rf36RABwP3wAEigEUfskDI35+XwISfE4BEnwDARR8AgIkfHzpAwYJAAMbABF9gQESfGoAHg5IAQUqAAK8AgEJAF59AX9gIj0BDocBHg/NAB0SdAEDjwQTfl8DJ35+EgAEkAETfvQAA4gCBWADJgh/qgMxAnx8iAQKLwMbfhEEVgF8YAJ+EwUAPgQTfj8BFXxZBBV/xQMD2gIRfeACPXxgFekAAiQAHRkFAQYcAB0dJQEJIAADkAEVfiUCCRQCHQATAgOcABF+YwIjAX5eBBB8FgETfKUBIAN/aAMRDAkCCgsEE3xgBAJnAyV8fPcFAdQBHSHTAQ6uABIDVgISBFUCEwQ5AiQDfC4CEn0dAPA6fX8AApkHiwE | ... truncated 
110 | 22654108);var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}var fs;var nodePath;var requireNodeFS;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}requireNodeFS=()=>{if(!nodePath){fs=require("fs");nodePath=require("path")}};read_=function shell | ... truncated 

RuntimeError: Out of bounds memory access (evaluating 'getWasmTableEntry(index)(a1, a2, a3)')
      at invoke_viii (/home/smiasojed/Development/bun-wasm-issue/soljson.js:110:37401)
      at ccall (/home/smiasojed/Development/bun-wasm-issue/soljson.js:110:28447)
      at <anonymous> (/home/smiasojed/Development/bun-wasm-issue/soljson.js:110:28838)
      at <anonymous> (/home/smiasojed/Development/bun-wasm-issue/compile.js:22:68)
@xermicus
Copy link
Member

xermicus commented Feb 4, 2025

As discussed off-band: This is only reproducible on Linux and the culprit is might be code from solc. So we just create a minimal reproducer (using only solc if the bug stems from there) and open an issue in bun.

@smiasojed
Copy link
Collaborator Author

It looks like this happens just after or during Module initialization. It looks like a race condition. Once initialization passes, we can call the compilation thousands of times without any issues. I see that in Bun initialisation is faster than in Node.js case.

@smiasojed
Copy link
Collaborator Author

smiasojed commented Feb 7, 2025

Anyway issue is created: oven-sh/bun#17146 . I think it would be worth triaging the Emscripten module initialization and experimenting with compilation options like DYNAMIC_EXECUTION and WASM_ASYNC_COMPILATION.

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

No branches or pull requests

2 participants