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

Revamp the test and run fork process infrastructure #449

Merged
merged 12 commits into from
May 2, 2018

Conversation

jvican
Copy link
Contributor

@jvican jvican commented Apr 20, 2018

  1. Migrate to NuProcess and avoid the annoying Java and Scala process APIs.
    Nuprocess gives us a better foundation to deal with stdout and stderr, as well
    as processing standard input from the host process (Bloop). NuProcess will
    also be more efficient than our previous approach.

  2. Migrate test server and the whole runMain machinery to Task so that we
    can have a finer control over it. Note that now these actions can be cancelled!

@jvican
Copy link
Contributor Author

jvican commented Apr 20, 2018

The logic in this pull request also makes Bloop able to cancel tests and applications run reliably.

@jvican
Copy link
Contributor Author

jvican commented Apr 20, 2018

Looks like CI fails because of an annoying bug in Docker. --privileged doesn't enable one of the permissions we need to efficiently handle processes with nuprocess. I'm working around it temporarily.

@jvican
Copy link
Contributor Author

jvican commented Apr 22, 2018

Modifying the drone test agents to allow SYS_ADMIN seccomp capabilities fixed this issue. CI is now passing.

@jvican jvican force-pushed the topic/fix-input-process branch 2 times, most recently from f470a17 to bf3fbd1 Compare April 24, 2018 12:27
@jvican jvican added the blocked Any issue or pull request whose fix is blocked by third parties or ongoing improvements. label Apr 27, 2018
jvican added 5 commits May 1, 2018 15:42
Otherwise, `System.console() == null`.
1. Migrate to `NuProcess` and avoid the annoying Java and Scala process
APIs. Nuprocess gives us a better foundation to deal with stdout and
stderr, as well as processing standard input from the host process
(Bloop). `NuProcess` will also be more efficient than our previous
approach.

2. Migrate test server and the whole `runMain` machinery to `Task` so
that we can have a finer control over it. Note that now these actions
can be cancelled!
It fails spuriously with good reason: Bloop doesn't yet support
concurrent clients. When we do, we'll re-enable this test suite.
@jvican jvican force-pushed the topic/fix-input-process branch 7 times, most recently from ddcf694 to b6c8473 Compare May 1, 2018 22:06
jvican added 2 commits May 2, 2018 00:11
The modernization makes sure that:

1. All processes that call bloop do provide an empty or inherited input
stream in both the server part and the client part.

2. The implementation is task based so that we can remove the annoying
thread sleep + have automatic shutdown of the processes if the timeout
is not met.
Copy link
Contributor Author

@jvican jvican left a comment

Choose a reason for hiding this comment

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

After an arduous journey to make nuprocess work (and thanks to the great job of the maintainer who cut a new version of nuprocess fixing a fundamental issue so that we can run it in our infrastructure), we're done here.

The PR as is does the following things:

  1. Implement a task-based NailgunTest that:
  • Removes an unnecessary big sleep of 500ms for every server init.
  • Allows for a timeout (good to identify issues with tests without getting hanging processes).
  1. Implement a new forker implementation that is task-based and:
  • Allows cancelling run and test execution (as proved by the new tests).
  • Allows a more efficient handling of process streams.

This PR also disables a test case that doesn't make sense until we have safe concurrent client processing implemented in the core. Then, we'll be able to re-enable it and experiment with parallel nailgun testing.

@@ -257,7 +257,6 @@ object Cli {
.flatMap(start => taskState.materialize.map(s => (s, start)))
.map { case (state, start) => logElapsed(start); state }
.dematerialize
.executeWithOptions(_.enableAutoCancelableRunLoops)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't need cancel to propagate through the current flatMap stack, so we disable this. I've also experienced some weird Monix behaviour when this is enabled. Since this is not a well-tested feature and it doesn't make much sense to have it enabled by default, I'm more comfortable with using the stock task options.

@jvican
Copy link
Contributor Author

jvican commented May 2, 2018

Oh, and I forgot to say that now we're handling input streams correctly (which means that run applications that require stdin will work).

@jvican jvican requested a review from Duhemm May 2, 2018 07:43
I think this is one of the reasons why our nailgun-based test infrastructure has been traditionally not very stable. Let's see if this fixes it.
@jvican jvican force-pushed the topic/fix-input-process branch 2 times, most recently from b88b0a7 to f7cf859 Compare May 2, 2018 08:21
@jvican jvican merged commit 51817bc into master May 2, 2018
@tues tues mentioned this pull request May 3, 2018
@tgodzik tgodzik deleted the topic/fix-input-process branch September 7, 2021 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Any issue or pull request whose fix is blocked by third parties or ongoing improvements. enhancement task / run task / test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant