Skip to content

Conversation

@jglick
Copy link
Member

@jglick jglick commented Sep 29, 2016

Related to jenkinsci/workflow-job-plugin#27.

@reviewbybees esp. @oleg-nenashev

…ller call ProcessLiveness.

It is guaranteed to not find the process, which would cause an immediate -1 return value.
Instead limit the watcher to the simple result file,
and check for special statuses only if exitStatus is being called from the master.
}
CountingInputStream cis = new CountingInputStream(utf8EncodedStream);
handler.output(cis);
lastLocationFile.write(Long.toString(lastLocation + cis.getByteCount()), null);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that this would not suffer from JENKINS-37575-like problems. We intentionally write lastLocationFile only after a successful call to output, so that if there is an agent channel outage we do not lose output. In such a case this Watcher simply dies; if and when the agent is reconnected, a new one should start at the same position.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now applies to #60.

try (FileChannel ch = FileChannel.open(Paths.get(logFile.getRemote()), StandardOpenOption.READ)) {
InputStream locallyEncodedStream = Channels.newInputStream(ch.position(lastLocation));
InputStream utf8EncodedStream;
Charset nativeEncoding = Charset.defaultCharset();
Copy link
Contributor

@lne3 lne3 Feb 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is taking the agent's default character set. If so ...
For various reasons (e.g. JENKINS-13091) we might be in a situation that the agent does not run with the systems default encoding, i.e. the –Dfile.encoding=… jvm parameter changing it to something else. Therefore system default encoding might be a good default. However, it should be possible to set the encoding explicitly since encoding of any shell output (IBM1047 on z/OS) does not necessarily match the encoding set by –Dfile.encoding.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in #61.

@jglick
Copy link
Member Author

jglick commented Feb 13, 2018

Now identical to #62, which better captures the relationship among changes.

@jglick jglick closed this Feb 13, 2018
@jglick jglick deleted the logs-JENKINS-38381 branch February 13, 2018 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants