emkey1 / ish-AOK

Linux shell for iOS with additions
https://ish.app
Other
121 stars 7 forks source link

Race Condition while using procps top or htop #48

Open emkey1 opened 2 years ago

emkey1 commented 2 years ago

iSH-AOK crashes under heavy load with a memory fault.

Screen Shot 2021-12-30 at 10 14 52 AM
emkey1 commented 2 years ago

This has been greatly mitigated as of release 1.2.4 build 363. I'm leaving it open though as I do (rarely) see it occur when the load is heavy for a prolonged period of time.

emkey1 commented 2 years ago

To give a bit more detail, internally iSH-AOK does not deal very well with tasks/threads being deleted. Basically it reaps a thread/task as soon as it can without making any sort of allowance for there possibly being in progress operations like reading information about the process (top, htop) or signals in flight for instance. The later likely being the cause of processes sometimes going to sleep and never waking up.

I've made a lot of internal changes to try to deal with this, and things are MUCH better, but there is still room for improvement.

ghost commented 1 year ago

Top works, but htop it will have segmentation faults. I believe it is that htop thinks that the user is running a actual Linux kernel and taps into a syscall that does not exist.

That is just a theory, the information from the htop crash and dmesg does not seem to help as it only shows this: image

Top does not however does not crash as it does not tap into those syscalls that htop used instead taps into the kernel to see processes, which syscall would be avaiable on iSH including AOK.

62f commented 11 months ago
```apk add htop fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86/APKINDEX.tar.gz fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86/APKINDEX.tar.gz (1/1) Installing htop (3.2.0-r1) Executing busybox-1.35.0-r17.trigger OK: 174 MiB in 128 packages ~ # htop FATAL PROGRAM ERROR DETECTED ============================ Please check at https://htop.dev/issues whether this issue has already been reported. If no similar issue has been reported before, please create a new issue with the following information: - Your htop version: '3.2.0' - Your OS and kernel version (uname -a) - Your distribution and release (lsb_release -a) - Likely steps to reproduce (How did it happen?) Error information: ------------------ A signal 11 (Segmentation fault) was received. Setting information: -------------------- htop_version=3.2.0;config_reader_min_version=3;fields=0 48 17 18 38 39 40 2 46 47 49 1;hide_kernel_threads=1;hide_userland_threads=0;shadow_other_users=0;show_thread_names=0;show_program_path=1;highlight_base_name=0;highlight_deleted_exe=1;highlight_megabytes=1;highlight_threads=1;highlight_changes=0;highlight_changes_delay_secs=5;find_comm_in_cmdline=1;strip_exe_from_cmdline=1;show_merged_command=0;header_margin=1;screen_tabs=1;detailed_cpu_time=0;cpu_count_from_one=0;show_cpu_usage=1;show_cpu_frequency=0;show_cpu_temperature=0;degree_fahrenheit=0;update_process_names=0;account_guest_in_cpu_meter=0;color_scheme=0;enable_mouse=1;delay=15;hide_function_bar=0;header_layout=two_50_50;column_meters_0=AllCPUs Memory Swap;column_meter_modes_0=1 1 1;column_meters_1=Tasks LoadAverage Uptime;column_meter_modes_1=2 2 2;tree_view=0;sort_key=46;tree_sort_key=0;sort_direction=-1;tree_sort_direction=1;tree_view_always_by_pid=0;all_branches_collapsed=0;screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command;.sort_key=PERCENT_CPU;.tree_sort_key=PID;.tree_view=0;.tree_view_always_by_pid=0;.sort_direction=-1;.tree_sort_direction=1;.all_branches_collapsed=0;screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE;.sort_key=IO_RATE;.tree_sort_key=PID;.tree_view=0;.tree_view_always_by_pid=0;.sort_direction=-1;.tree_sort_direction=1;.all_branches_collapsed=0; Running this program with debug symbols or inside a debugger may provide further insights. Thank you for helping to improve htop! !!! Chained handler did not exit. Forcing exit.```

😡that [https://htop.dev/]() forwarding to GitHub page who now like the rest of the DarkWeb requires 2FA instead of being an open-source, publicly-available WiKi.