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

[browser][MT] emscripten_check_mailbox per console character #93603

Closed
pavelsavara opened this issue Oct 17, 2023 · 4 comments
Closed

[browser][MT] emscripten_check_mailbox per console character #93603

pavelsavara opened this issue Oct 17, 2023 · 4 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-VM-threading-mono os-browser Browser variant of arch-wasm tenet-performance Performance related issue
Milestone

Comments

@pavelsavara
Copy link
Member

Console.WriteLine on non-UI thread would lead to cross thread message per character.

put_char (dotnet.native.js:1268)
write (dotnet.native.js:1216)
write (dotnet.native.js:2689)
doWritev (dotnet.native.js:5939)
_fd_write (dotnet.native.js:6012)
_emscripten_receive_on_main_thread_js (dotnet.native.js:5746)
_do_call (library_pthread.c:193)
em_task_queue_execute (em_task_queue.c:176)
receive_notification (em_task_queue.c:218)
em_task_queue_execute (em_task_queue.c:176)
_emscripten_check_mailbox (thread_mailbox.c:87)
(anonymous) (dotnet.native.js:744)
(anonymous) (dotnet.native.js:5475)
callUserCallback (dotnet.native.js:5452)
checkMailbox (dotnet.native.js:5475)
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm labels Oct 17, 2023
@pavelsavara pavelsavara added this to the 9.0.0 milestone Oct 17, 2023
@pavelsavara pavelsavara self-assigned this Oct 17, 2023
@ghost
Copy link

ghost commented Oct 17, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Console.WriteLine on non-UI thread would lead to cross thread message per character.

put_char (dotnet.native.js:1268)
write (dotnet.native.js:1216)
write (dotnet.native.js:2689)
doWritev (dotnet.native.js:5939)
_fd_write (dotnet.native.js:6012)
_emscripten_receive_on_main_thread_js (dotnet.native.js:5746)
_do_call (library_pthread.c:193)
em_task_queue_execute (em_task_queue.c:176)
receive_notification (em_task_queue.c:218)
em_task_queue_execute (em_task_queue.c:176)
_emscripten_check_mailbox (thread_mailbox.c:87)
(anonymous) (dotnet.native.js:744)
(anonymous) (dotnet.native.js:5475)
callUserCallback (dotnet.native.js:5452)
checkMailbox (dotnet.native.js:5475)
Author: pavelsavara
Assignees: pavelsavara
Labels:

arch-wasm, area-System.Runtime.InteropServices.JavaScript, os-browser

Milestone: 9.0.0

@pavelsavara
Copy link
Member Author

Other proxies functions are

var proxiedFunctionTable = [ 
null, 
_proc_exit, 
exitOnMainThread, 
pthreadCreateProxied, 
___syscall__newselect, 
___syscall_accept4, 
___syscall_bind, 
___syscall_chdir, 
___syscall_chmod, 
___syscall_connect, 
___syscall_faccessat, 
___syscall_fchmod, 
___syscall_fcntl64, 
___syscall_fstat64, 
___syscall_fstatfs64, 
___syscall_statfs64, 
___syscall_ftruncate64, 
___syscall_getcwd, 
___syscall_getdents64, 
___syscall_getsockname, 
___syscall_ioctl, 
___syscall_listen, 
___syscall_lstat64, 
___syscall_mkdirat, 
___syscall_newfstatat, 
___syscall_openat, 
___syscall_poll, 
___syscall_readlinkat, 
___syscall_recvfrom, 
___syscall_renameat, 
___syscall_rmdir, 
___syscall_sendto, 
___syscall_socket, 
___syscall_stat64, 
___syscall_symlink, 
___syscall_unlinkat, 
___syscall_utimensat, 
__mmap_js, 
__msync_js, 
__munmap_js, 
_environ_get, 
_environ_sizes_get, 
_fd_close, 
_fd_fdstat_get, 
_fd_pread, 
_fd_pwrite, 
_fd_read, 
_fd_seek, 
_fd_sync, 
_fd_write, 
_getaddrinfo 
];

@pavelsavara
Copy link
Member Author

Also any FS is in UI thread and makes startup slower. We should prevent DLL load to touch FS

image

@pavelsavara
Copy link
Member Author

_fd_write actually receives buffer with more that one character. That is good enough for now.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-threading-mono os-browser Browser variant of arch-wasm tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

1 participant