One of my Java processes is being stopped because it receives a SIGTTIN when processing a request. I can reproduce this issue. But I am unable to figure out why this is happening. I tried running strace
but I am not getting any extra information from it:
futex(0x7fa1785779d0, FUTEX_WAIT, 5094, NULLServer ready) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGTTIN {si_signo=SIGTTIN, si_code=SI_USER, si_pid=5128, si_uid=1000}---
--- stopped by SIGTTIN ---
Does anyone have a good way to debugging this issue?
SIGTTIN
signal is delivered to a background process if it tries to read from the terminal. The default behavior for that signal is to stop the program. If you're not running it in the background (e.g., starting it with&
at the end of the command), then I can't explain why your program is receiving the signal.SIGTTIN
will be sent to the entire background process group, not just to the process that tried to read from the terminal. For instance, in{ sleep .1; cat; } | strace -e trace=none cat &
, the second cat will be stopped by SIGTTIN, though it's not trying to read from the tty, but from a pipe; it's its left side co-pipeline sibling which had caused that.{ strace -e trace=none sleep 33 & sleep .1; cat; } &
--sleep 33
doesn't try to read anything from anywhere, but it will be stopped by theSIGTTIN
caused by thecat
, because they're in the same process group. Please show the exact command you're using to start your program from the terminal -- fwiw, trying to read from the tty while in a background job is the only situation where the the kernel will send aSIGTTIN
signal.