2

I have a Java application writing to System.out from time to time. I also have some logging turned on (-XX:+PrintCompilation -verbose:gc ...) which is implemented natively in the VM. Both the native logging and calls to System.out eventually make a printf call to stdout.

However, on Mac OS (and just on this one, not on Linux and Windows) parts of the printed messages of the Java application are missing! Meaning I have a call like System.out.println("Valid run.") and it just prints Valid ru and the immediately one of the log messages of the VM. However, the missing n. is nowhere to be found.

I know the C standard does not specify printf to be atomic, however I though it is, or at least even if not, the missing n. must be somewhere else and not completely missing. Any ideas what this might be or how to debug this further?

Markus Weninger
  • 11,931
  • 7
  • 64
  • 137
loonytune
  • 1,775
  • 11
  • 22
  • 1
    Can you please provide some details about the version of JVM/JDK you are using? Please type on a terminal java -version – javapapo Jan 02 '16 at 13:08
  • Did you try `System.out.flush()` after performing the write to check whether it was a flushing issue? – merlin2011 Jan 02 '16 at 13:11
  • 1
    Have you tried redirecting the output to a file and thoroughly looking for the missing `n`? Its disappearance could be an artifact of terminal display combined with hidden characters or carriage returns. – RealSkeptic Jan 02 '16 at 13:19
  • version: openjdk version "1.8.0_66-internal" OpenJDK Runtime Environment (build 1.8.0_66-internal-b17) OpenJDK 64-Bit Server VM (build 25.66-b17, mixed mode) – loonytune Jan 02 '16 at 14:04
  • flushing doesnt help. I already redirect it into a file, the problem occurs with and without redirection. – loonytune Jan 02 '16 at 14:05

0 Answers0