2

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?

5
  • Are you running your Java process in the background? If so, does it read from standard input? Nov 3, 2019 at 2:03
  • @AndyDalton I am not running the java process in the background. But it is a Java RMI program and the rmiregistry is running in the background and my program does read from standard input. Can you explain how that could result in this issue? Nov 3, 2019 at 2:37
  • 1
    The 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. Nov 3, 2019 at 2:52
  • 4
    A 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.
    – mosvy
    Nov 3, 2019 at 2:56
  • 4
    Another example: { 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 the SIGTTIN caused by the cat, 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 a SIGTTIN signal.
    – mosvy
    Nov 3, 2019 at 3:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.