Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-52729] Launcher.ProcStarter.stdout(TaskListener) discards remotability #3563

Merged

Conversation

jglick
Copy link
Member

@jglick jglick commented Jul 24, 2018

See JENKINS-52729.

I suspect there is also a lower-priority encoding bug here, but I am not bothering with that for now.

Proposed changelog entries

  • Developer: Launcher.ProcStarter.stdout(TaskListener) did not properly send its argument over a Remoting channel to an agent.

@jglick jglick requested a review from oleg-nenashev July 24, 2018 23:37
@jglick jglick changed the title [JENKINS-52729] Demonstrating issue with Launcher.ProcStarter.stdout(TaskListener) [JENKINS-52729] Launcher.ProcStarter.stdout(TaskListener) discards remotability Jul 24, 2018
@jglick
Copy link
Member Author

jglick commented Jul 25, 2018

Sigh, apparently echo is not an actual command on Windows, but built into cmd.exe? Presumably so you can @echo off. Whereas on Linux it is both. Will fix test accordingly.

@jglick
Copy link
Member Author

jglick commented Jul 25, 2018

FTR this call seems to be what would be used by typical freestyle build steps.

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

Yes, it would be nice to get it fixed in the context of External Logging stories. In #3557 reference impls I work it around by creating my own Launcher, but such approach would be much better

@@ -295,7 +297,9 @@ public ProcStarter stdout(@CheckForNull OutputStream out) {
* @return {@code this}
Copy link
Member

Choose a reason for hiding this comment

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

It makes sense to explicitly set the requirement that the class is remotable in Javadoc

Copy link
Member Author

Choose a reason for hiding this comment

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

All TaskListener implementations are expected to be remotable but I will clarify this in Javadoc.

@oleg-nenashev oleg-nenashev added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Jul 31, 2018
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

By the way, stederr() has identical problem. I suggest fixing it here as well so that we do not get into surprises with some implementations really using 2 streams

@oleg-nenashev oleg-nenashev added needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging and removed ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback labels Jul 31, 2018
@oleg-nenashev
Copy link
Member

OTOH we could create a follow-up task for stederr

@jglick jglick removed the needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging label Jul 31, 2018
@jglick
Copy link
Member Author

jglick commented Jul 31, 2018

stderr() has identical problem. I suggest fixing it here as well

It does not—there is no stderr(TaskListener) overload. If we wished to allow a distinct and remotable stderr stream, that would be a new API which plugins would have to call.

surprises with some implementations really using 2 streams

The implementations we care about (CommandInterpreter, SCM plugins, etc.) do not separate stderr. I cannot find any callers using this method from a brief search.

There are some calls which currently call stdout(OutputStream) which would not benefit from this change, such as Maven.perform, but that is out of scope.

I did find one possible bug in the mercurial plugin: if you call stdout(TaskListener) and then stdout(OutputStream) you expect the latter call to cancel the former.

@jglick jglick added the work-in-progress The PR is under active development, not ready to the final review label Jul 31, 2018
…tdout(OutputStream), which was true for local but not remote launchers.
@jglick jglick removed the work-in-progress The PR is under active development, not ready to the final review label Jul 31, 2018
@jglick jglick requested a review from oleg-nenashev July 31, 2018 20:08
@jglick
Copy link
Member Author

jglick commented Jul 31, 2018

Test failure is a common flake:

java.lang.AssertionError: deletion stopped
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.junit.Assert.assertFalse(Assert.java:64)
	at hudson.UtilTest.testDeleteRecursive_onWindows(UtilTest.java:489)

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

OK, let's merge it as is. Public API does not change here, so we can fix STDERR in a follow-up if I discover the usa-case for it

@oleg-nenashev oleg-nenashev merged commit ebd7111 into jenkinsci:master Aug 2, 2018
@jglick jglick deleted the RemoteLaunchCallable-JENKINS-52729 branch August 6, 2018 18:10
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