Commit Graph

15023 Commits

Author SHA1 Message Date
Mahmood Ali
fcceaee9b4 Merge pull request #5742 from hashicorp/b-test-fixes-20190520
Grab bag of (primarily race) test fixes
2019-05-21 11:46:36 -04:00
Mahmood Ali
ae1b110864 Merge pull request #5740 from hashicorp/b-nomad-exec-term-race
exec: allow drivers to handle stream termination
2019-05-21 11:24:12 -04:00
Mahmood Ali
13caa42dff Merge pull request #5741 from hashicorp/b-alloc-race-20190521
client: synchronize access to `ar.alloc`
2019-05-21 11:04:58 -04:00
Michael Schurter
a7747106c8 Merge pull request #5732 from hashicorp/b-eval-race
nomad: fix race in BlockedEvals
2019-05-21 07:34:53 -07:00
Mahmood Ali
af48f7d3dc client: synchronize access to ar.alloc
`allocRunner.alloc` is protected by `allocRunner.allocLock`, so let's
use `allocRunner.Alloc()` helper function to access it.
2019-05-21 09:55:05 -04:00
Mahmood Ali
ea2f96e585 tests: fix fifo lib race
Accidentally accessed outer `err` variable inside a goroutine
2019-05-21 09:49:56 -04:00
Mahmood Ali
56f564fa75 tests: fix data race in client TestDriverManager_Fingerprint_Periodic 2019-05-21 09:49:56 -04:00
Mahmood Ali
5e17907a0c tests: fix client TestFS_Stream data race
Close is invoked in a different goroutine from test
2019-05-21 09:49:56 -04:00
Mahmood Ali
db3241c0df tests: handle unicode matches
naive implementation should focus on ascii characters only
2019-05-21 09:41:23 -04:00
Mahmood Ali
1492d0c49a exec: allow drivers to handle stream termination
Without this change, alloc_endpoint cancel the context passed to handler
when we detect EOF.  This races driver in setting exit code; and we run
into a case where the exec process terminates cleanly yet we attempt to
mark it as failed with context error.

Here, we rely on the driver to handle errors returned from Stream and
without racing to set an error.
2019-05-21 09:40:25 -04:00
Michael Schurter
b58282284d nomad: fix deadlock in UnblockClassAndQuota
Previous commit could introduce a deadlock if the capacityChangeCh was
full and the receiving side exited before freeing a slot for the sending
side could send. Flush would then block forever waiting to acquire the
lock just to throw the pending update away.

The race is around getting/setting the chan field, not chan operations,
so only lock around getting the chan field.
2019-05-20 15:41:52 -07:00
Michael Schurter
01a4ed1481 nomad: fix race in BlockedEvals
I assume the mutex was being released before sending on capacityChangeCh
to avoid blocking in the critical section, but:

1. This is race.
2. capacityChangeCh has a *huge* buffer (8096). If it's full things
   already seem Very Bad, and a little backpressure seems appropriate.
2019-05-20 15:26:20 -07:00
Michael Schurter
59946ff70f Merge pull request #5411 from hashicorp/b-snapshotafter
Block plan application until state store has caught up to raft
2019-05-20 14:03:10 -07:00
Michael Lange
0ecbfe6a82 Merge pull request #5721 from hashicorp/f-ui/watchable-cancellation-tokens
UI: Replace the adapter cancellation methods with a cancellation token system
2019-05-20 11:49:14 -07:00
Michael Schurter
85e1e0ba68 Fix links. 2019-05-20 11:44:47 -07:00
Michael Schurter
60adaf71fa Add PR link to changelog for #5702 2019-05-20 11:33:23 -07:00
Michael Schurter
b24aba2af3 Fix typo. 2019-05-20 11:27:16 -07:00
Michael Lange
3c1de2df91 Standardize on Abort over Cancel 2019-05-20 11:08:16 -07:00
Michael Lange
c68962078a Replace the adapter cancellation methods with a cancellation token system 2019-05-20 10:29:22 -07:00
Mahmood Ali
72f46f0a77 Merge pull request #5275 from hashicorp/f-api-config-httpclient
api: allow configuring http client
2019-05-20 12:36:00 -04:00
Mahmood Ali
10ab705a2c remove "incidentally" exported internal function
`*Config.ConfigureTLS()` is invoked internally by `NewClient` and API
consumers should not invoke directly.

Now that http client is created in `api.NewClient`,
`*Config.ConfigureTLS` makes no sense.  API consumers that call it
explicitly can remove the invocation and preserve the behavior.
2019-05-20 11:58:43 -04:00
Mahmood Ali
44f0654e9b Run TestClientAllocations_Restart_ACL test 2019-05-17 20:30:23 -04:00
Michael Schurter
a2e4f124bc nomad: emit more detailed error
Avoid returning context.DeadlineExceeded as it lacks helpful information
and is often ignored or handled specially by callers.
2019-05-17 14:37:42 -07:00
Michael Schurter
b5fec1c776 nomad: wait for state store to sync in plan apply
Wait for state store to catch up with raft when applying plans.
2019-05-17 14:37:12 -07:00
Omar Khawaja
e8a2fdba95 Vagrant optional (#5724)
* specify Vagrant as optional in getting started and installation

* edit next steps
2019-05-17 16:50:16 -04:00
Michael Schurter
6ca9f0cd92 nomad: remove unused NotifyGroup struct
I don't think it's been used for a long time.
2019-05-17 13:30:23 -07:00
Michael Schurter
cec076290f nomad: refactor waitForIndex into SnapshotAfter
Generalize wait for index logic in the state store for reuse elsewhere.
Also begin plumbing in a context to combine handling of timeouts and
shutdown.
2019-05-17 13:30:23 -07:00
Mahmood Ali
cbc155582a api: allow configuring http client
Allow clients to configure httpClient, e.g. set a pooled/keep-alive
client.

When caller configures HttpClient explicitly, we aim to use as-is; e.g.
we assume it's configured with TLS already.  Expose `ConfigureTLS` to
aid api consumers with configuring their http client.

Also, removes `SetTimeout` call that I believe is internal only and has
odd side-effects when called on already created config.  Also deprecates
`config.ConfigureTLS` in preference to the new `ConfigureTLS`.
2019-05-17 16:26:58 -04:00
Lang Martin
568a120e7b Merge pull request #5649 from hashicorp/b-lookup-exe-chroot
lookup executables inside chroot
2019-05-17 15:07:41 -04:00
Mahmood Ali
a64a4dcf12 Merge pull request #5722 from hashicorp/f-nomad-exec-escape-try2
escapingio: handle stalled readers
2019-05-17 14:52:54 -04:00
Mahmood Ali
30b148c8d4 Restore tty start before emitting errors
Otherwise, the error message appears indented unexpectedly.
2019-05-17 11:58:31 -04:00
Mahmood Ali
10797ca61f escapingio: handle stalled readers
Handle stalled readers (e.g. network write got stalled), by having
escaping io have a buffer so it looks for escaped characters in the
stream.

This simplifies the implementation considerably, as we can look
for new lines followed by escaped characters directly.

Also, we add a test to ensure that any partial results are flushed to
readers.
2019-05-17 11:58:31 -04:00
Mahmood Ali
e211a993fd escapingio: thread-safe struct for escaped chars
Use a helper struct for capturing escaped characters that's thread safe.
2019-05-17 10:22:24 -04:00
Mahmood Ali
cbe88fa868 Merge pull request #5720 from hashicorp/f-nomad-exec-escape
Support escaping sequence for terminating alloc exec
2019-05-16 17:34:54 -04:00
Preetha Appan
3bcf7a02c4 Add preemption to changelog 2019-05-16 16:21:15 -05:00
Mahmood Ali
fb0d002eb1 avoid printing counts in tests 2019-05-16 17:07:32 -04:00
Mahmood Ali
0b4bebd3aa Fix typos and comments
Co-Authored-By: Michael Schurter <michael.schurter@gmail.com>
2019-05-16 17:06:03 -04:00
Mahmood Ali
eedd8e9e66 Implement escaping chrarcter for alloc exec 2019-05-16 16:22:52 -04:00
Mahmood Ali
4e7736023a Add a escaping reader that mimics ssh behavior
Adds an escaping reading that mimics ssh handling of input escape
sequences.

The reader parses chunks to look for \n~
2019-05-16 16:22:52 -04:00
Preetha
a6105ad79f Merge pull request #5709 from jweissig/patch-10
docs: fixed wording
2019-05-16 11:06:43 -05:00
Preetha
a2d6dc0489 Merge pull request #5717 from hashicorp/b-plan-apply-preemptions
Fix bug in plan applier introduced in PR-5602
2019-05-16 11:01:05 -05:00
Danielle Lancashire
0458a14aa9 changelog: Update for eval-broker fix 2019-05-16 16:03:04 +01:00
Preetha Appan
0367c7dc42 update changelog 2019-05-15 22:00:48 -05:00
Preetha
abaf5dcff1 Merge pull request #5702 from hashicorp/f-filter-by-create-index
Filter deployments by create index
2019-05-15 21:50:41 -05:00
Preetha Appan
f12c332eee Merge branch 'f-filter-by-create-index' of github.com:hashicorp/nomad into f-filter-by-create-index 2019-05-15 21:17:34 -05:00
Preetha Appan
9abd35285f Add -all to help text and flags 2019-05-15 21:16:57 -05:00
Preetha
f56c9cdf3e remove stray newline
Co-Authored-By: Danielle <dani@builds.terrible.systems>
2019-05-15 21:11:52 -05:00
Preetha Appan
d3061f93e3 Fix bug in plan applier introduced in PR-5602
This fixes a bug in the state store during plan apply. When
denormalizing preempted allocations it incorrectly set the preemptor's
job during the update. This eventually causes a panic downstream in the
client. Added a test assertion that failed before and passes after this fix
2019-05-15 20:34:06 -05:00
Danielle
781c94b0b7 Merge pull request #5699 from hashicorp/dani/b-eval-broker-lifetime
Eval Broker: Prevent redundant enqueue's when a node is not a leader
2019-05-15 23:30:52 +01:00
Buck Doyle
caa410a64f Merge pull request #5715 from hashicorp/b-precommit-linting
Restore precommit linting
2019-05-15 16:44:19 -05:00