I would like to ask about the impact of a process stuck in the 'D' uninterruptible sleep state on a Linux system when an user logs out.
Is ending an user session by logout (not shutdown or restart) even possible in case of a lingering unkillable user process in disk sleep or would the system freeze/crash on logout attempt? If logout is successful despite the stuck process, what happens to the process? Does it get orphaned and reparented? Does it carry on to the next user session? Also, if the process was accessing a shared memory segment before entering the uninterruptible sleep, what happens to that shared memory and other processes using it? Are they also be affected? How does a Linux system handle such situations?
This state is hard to reproduce on purpose so I cannot figure out a way to test it myself in order to know the answer.
I apologize if a similar question was answered before somewhere; I have tried searching various Linux websites and message boards for answers to these questions but most pages seem to only explain what the uninterruptible sleep is and how to prevent/fix the problem. I did not manage to find any resources explaining what happens to such process when an user session ends without rebooting the system. Most sources just recomment to restart the system to get rid of it.