Issue Type: Bug Bug
Affects Versions: JRuby 1.7.0
Assignee: Thomas E Enebo
Created: 22/Nov/12 3:50 PM
Description:

This works as expected:

% ruby -e 'Process.kill("QUIT", $$)'
2012-11-22 13:42:09
Full thread dump OpenJDK 64-Bit Server VM (23.2-b09 mixed mode):
...

However, if STDOUT is redirected, the thread dump disappears:

% ruby -e 'STDOUT.reopen(STDERR); Process.kill("QUIT", $$)'
<nothing>

Same behavior redirecting to STDERR as to a File - no dump!

If I watch strace, it writes to FD 1, which was previously dup2'd as expected, but nothing comes out. Hmm...

% strace -o /tmp/x -fe trace=open,write,dup2 ruby -e 'STDOUT.reopen(File.new("/tmp/log", "w")); Process.kill("QUIT", $$)'

And relevant strace data:

3542  open("/tmp/log", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 10
3542  open("/dev/null", O_WRONLY)       = 12
3542  dup2(12, 1)                       = 1
...
3527  --- SIGQUIT {si_signo=SIGQUIT, si_code=SI_USER, si_pid=3527, si_uid=1000} ---
3557  write(1, "2012-11-22 13:44:53\n", 20) = 20
3557  write(1, "Full thread dump OpenJDK 64-Bit "..., 65) = 65

So my observation here is that /tmp/log is opened as fd 10, then for some reason /dev/null is opened as fd 12 which is then used to redirect stdout.

Project: JRuby
Priority: Major Major
Reporter: Jordan Sissel
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to