|
From: | Cryptographrix |
Subject: | Re: Please help me to resolve a tail related server fault |
Date: | Sat, 9 Feb 2013 21:32:45 -0500 |
Ah wow, yeah I was really lost there too - good to hear you got it resolved!
I got this resolved, it's a bug in my java code. I didn't close the error stream, which means tail's stderr was piped to the java program too. I did not consume any error output, and after a month the stderr buffer got full, that caused tail to block.Thanks.If it's happening when some type of log rotation rotates the log out, there is a good possibility that tail catches the EOF when log rotation kicks the process that created the file and tail dies.
I believe the retry feature of tail may not necessarily retry after what it sees as an EOF, and that would probably be intentional.
To test this, you can tail the file yourself when log rotation is going to run. If you go back to shell, then you need to write a retry into the Java code you're writing to compensate.
It may very likely be that Oracle added STDIN limitations into Java with the latest releases as well.
On Feb 8, 2013 9:36 AM, "Liu Haifeng" <address@hidden> wrote:We are developing our own tailer now, but I want to find out what happened with gnu tail or oracle java.On Feb 8, 2013, at 10:03 PM, Cryptographrix <address@hidden> wrote:I do not know what limitations STDIN has on it in java offhand, but it sounds like this is what you are trying to do:On Thu, Feb 7, 2013 at 11:52 PM, Liu Haifeng <address@hidden> wrote:
HiI have a log transport agent written in java which creates a sub process that executing "tail -F a.log" to tail log file,and the output is piped to the main java process,thus I can read and transport log content using java.This worked fine in the past 30 days,but now it seams the java process can't read any data. I checked java thread stack, it's blocked on Java.io.FileInputStream.readBytes.The log file I am tailing is rotated every one hour,and the fault happened at the moment the rotating script is supposed to run.Currently I have no idea about this fault. Here following by some status of the tail process, not more as I don't have the root privilege.
#cat /proc/28195/status
Name: tailState: S (sleeping)SleepAVG: 78%Tgid: 28195Pid: 28195PPid: 28143TracerPid: 0Uid: 0 0 0 0Gid: 0 0 0 0FDSize: 256Groups: 0 1 2 3 4 6 10VmPeak: 3828 kBVmSize: 3828 kBVmLck: 0 kBVmHWM: 524 kBVmRSS: 524 kBVmData: 180 kBVmStk: 88 kBVmExe: 36 kBVmLib: 1468 kBVmPTE: 36 kBStaBrk: 198b3000 kBBrk: 198d4000 kBStaStk: 7fff7679c1d0 kBThreads: 1SigQ: 0/32768SigPnd: 0000000000000000ShdPnd: 0000000000000000SigBlk: 0000000000000004SigIgn: 0000000000000003SigCgt: 0000000000000000CapInh: 0000000000000000CapPrm: 00000000fffffeffCapEff: 00000000fffffeffCpus_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,ffffffff,ffffffffMems_allowed: 00000000,00000001
#cat /proc/28195/stat28195 (tail) S 28143 28138 27881 0 -14202496 141 0 1 0 10328 53939 0 0 18 0 1 0 214643641 3919872 131 18446744073709551615 1 1 0 0 0 0 4 3 0 18446744073709551615 0 0 17 2 0 0 1
#yum list|grep coreutilscoreutils.x86_64 5.97-34.el5_8.1 installedpolicycoreutils.x86_64 1.33.12-14.8.el5 installedpolicycoreutils-gui.x86_64 1.33.12-14.8.el5 basepolicycoreutils-newrole.x86_64 1.33.12-14.8.el5 base
[Prev in Thread] | Current Thread | [Next in Thread] |