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

Isolate the Chrome crash #26

Closed
wants to merge 198 commits into from
Closed

Isolate the Chrome crash #26

wants to merge 198 commits into from

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Oct 3, 2022

What problem does this PR solve?

A part of #1 (comment)

This PR provides a minimal reproducible Chrome crash scenario:

console.log( '[WebWorker] Spawned' );

const wasmTable = new WebAssembly.Table( {
	initial: 6743,
	maximum: 6743,
	element: 'anyfunc',
} );
const WASM_PAGE_SIZE = 65536;
const INITIAL_INITIAL_MEMORY = 1073741824;
const wasmMemory = new WebAssembly.Memory( {
	initial: INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE,
} );

const noop = function()	{};
const info = {
	env: {
		// System functions – they must be provided but don't have to be implemented to cause the crash.
		I: noop, vb: noop, ub: noop, tb: noop, sb: noop, r: noop, rb: noop, qb: noop, pb: noop, ob: noop, oa: noop, nb: noop, mb: noop, lb: noop, kb: noop, jb: noop, na: noop, ib: noop, hb: noop, gb: noop, u: noop, y: noop, D: noop, ma: noop, fb: noop, eb: noop, la: noop, db: noop, cb: noop, q: noop, bb: noop, ab: noop, $a: noop, _a: noop, Za: noop, Ya: noop, Xa: noop, Wa: noop, Va: noop, Y: noop, ka: noop, Ua: noop, Ta: noop, Sa: noop, Ra: noop, Qa: noop, Pa: noop, Oa: noop, Na: noop, H: noop, ja: noop, Ma: noop, xb: noop, La: noop, ia: noop, G: noop, ha: noop, Ka: noop, Ja: noop, Ia: noop, Ha: noop, A: noop, t: noop, F: noop, w: noop, C: noop, Fa: noop, B: noop, Ea: noop, Da: noop, Ca: noop, E: noop, ga: noop, Ba: noop, fa: noop, za: noop, ya: noop, n: noop, ea: noop, da: noop, ca: noop, xa: noop, wa: noop, va: noop, ba: noop, Fb: noop, l: noop, N: noop, ua: noop, wb: noop, X: noop, Eb: noop, W: noop, aa: noop, ta: noop, M: noop, b: noop, $: noop, V: noop, L: noop, U: noop, m: noop, Db: noop, Cb: noop, Bb: noop, z: noop, T: noop, sa: noop, K: noop, k: noop, S: noop, s: noop, J: noop, Ab: noop, zb: noop, R: noop, _: noop, yb: noop, Q: noop, e: noop, Z: noop, ra: noop, qa: noop, P: noop, pa: noop, h: noop, a: noop, O: noop, f: noop, j: noop, g: noop, x: noop, Ga: noop, Aa: noop, Gb: noop, i: noop, d: noop, o: noop, v: noop, p: noop, c: noop, __memory_base: 1024,
		__table_base: 0,
		memory: wasmMemory,
		table: wasmTable,
	},
	global: { NaN, Infinity },
	asm2wasm: {
		'f64-rem'() {},
	},
};
fetch( 'webworker-php.wasm' ).then( async ( response ) => {
	WebAssembly.instantiate(
		await response.arrayBuffer(),
		info,
	);
} );

console.log( 'Called instantiateStreaming', { info } );

It's not meant to be merged. It's meant to enable you, the reader, to clone and help.

How to help?

Think of a way to make it not crash :-)

The progress and the latest findings can be tracked in #1 (comment)

@adamziel adamziel changed the title Debugging chrome crash Isolate the indeterministic Chrome crash Oct 3, 2022
…_interface $_zend_binop_error $_instanceof_function_slow
…$_zend_stack_is_empty $_zend_vspprintf $_zend_vstrpprintf
…rty_name_ex $_zend_is_true $_zend_deprecated_function
…emove $__zend_hash_index_find $_zend_undefined_offset $_zend_undefined_index $_zend_illegal_string_offset $_zend_use_resource_as_offset $_zend_illegal_offset $_zval_undefined_cv $_zend_copy_extra_args $_dummy_encoding_name_getter $_dummy_encoding_lexer_compatibility_checker $_dummy_encoding_detector $_dummy_internal_encoding_getter $abort $_zend_observer_error_notify
…$_zend_multibyte_get_encoding_name $_zend_multibyte_check_lexer_compatibility $_zend_multibyte_encoding_detector $_zend_multibyte_get_internal_encoding $_zend_error_va $_d2b $_diff $_quorem $_Balloc $_Bfree $_zend_hex_strtod $_zend_oct_strtod $_zend_bin_strtod $_gc_remove_compressed $_zend_hash_func $_sigaction $_sigemptyset $_sigaddset $_sigprocmask $_zend_ast_create_zval_with_lineno $_zend_ast_create_zval_ex $_zend_ast_create_zval_from_str $_zend_ast_create_zval_from_long $_zend_ast_create_1 $_zend_ast_create_2 $_zend_ast_create_decl $_zend_ast_create_0 $_zend_ast_create_3 $_zend_ast_create_4 $_zend_ast_create_5 $_zend_ast_create_list_0 $_zend_ast_create_list_1 $_zend_ast_create_list_2 $_zend_ast_with_attributes $_zend_ptr_stack_init $_zend_ptr_stack_reverse_apply $_isupper $___shlim $_isspace $___toread $_isdigit $___lockfile $___unlockfile $_pop_arg $_fmt_o $_fmt_x $_fmt_u $_pthread_self $___towrite
…fer $_mult $_lshift $_zend_sigaction $_tolower $___uflow $_getint $___pthread_self_357 $___syscall_ret $___lock $___unlock $_llvm_bswap_i32 $___pthread_self_105 $___syscall91 $___fflush_unlocked $___syscall219 $_setTempRet0 $_emscripten_memcpy_big $___munmap $___madvise $_memcpy $_zend_hash_find $_zend_signal $_strncasecmp $___shgetc $_wcrtomb $_swapc $___ofl_lock $___ofl_unlock $__estrndup $_zend_string_concat3 $_resolve_class_name $_zend_string_concat2 $_memmove $_zend_set_timeout_ex $_zend_string_tolower_ex $_zval_get_string_func $_zend_array_dup $_pow5mult $_zend_ast_list_add $_zend_multibyte_set_filter $___intscan $_wctomb $___fwritex $___mo_lookup $___strdup $_zend_create_member_string $_zval_copy_ctor_func $_zend_strtod $_strtox_639
…onst $_zval_get_double_func $_get_active_function_or_method_name $_zend_get_callable_name_ex $_strtol
…__zendi_try_convert_scalar_to_number $_is_numeric_str_function $_strtoul $_out
…_arg_long_weak $_zend_parse_arg_double_weak $___lctrans_impl $___lctrans $___strerror_l
…zend_mm_gc $_zend_mm_panic $_strerror $_fprintf $_zend_mm_safe_error $_saveSetjmp $_zend_out_of_memory $_fwrite $_zend_mm_alloc_huge $_zend_mm_chunk_alloc_int $_zend_mm_mmap $___mmap $_zend_mm_del_huge_block $_zend_mm_free_pages $_zend_mm_realloc_huge $_zend_mm_realloc_slow $__efree_32 $__efree_48 $__efree $__erealloc $__erealloc2 $__safe_erealloc $___zend_realloc $_zend_file_context_end $_zend_reset_import_tables $_zend_hash_destroy $_zend_restore_compiled_filename $_zend_add_class_modifier
…ption $_zend_resolve_non_class_name $_zend_hash_find_ptr_lc $_zend_hash_str_find_ptr_lc $_zend_resolve_class_name $_zend_type_to_string_resolved $_zend_type_to_string
@adamziel
Copy link
Collaborator Author

Closing as this exploratory PR has fulfilled its purpose. #1 now contains the specific stack trace pinpointing the root cause of the problem (out of memory error) and #28 implements a workaround.

@adamziel adamziel closed this Oct 11, 2022
@adamziel adamziel deleted the debugging-chrome-crash branch May 10, 2023 08:12
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 this pull request may close these issues.

1 participant