Commit Graph

302 Commits

Author SHA1 Message Date
Michael Schurter
a4bf901559 run goimports 2018-04-19 11:16:28 -07:00
Fabien Ninoles
d6cc8895ca Update based on PR request. 2018-04-17 13:43:04 -04:00
Fabien Ninoles
7023b63ffa - Clean up for windows compilation.
- Set CREATE_NEW_PROCESS_GROUP for Windows subprocess.
- Ensure we only kill actual process that need to.
2018-04-14 13:58:42 -04:00
Michael Schurter
1e67780f1e Merge pull request #3572 from emate/master
Create new process group on process startup.
2018-04-13 11:56:38 -07:00
Michael Schurter
2df0640e47 executor: increase level for helpful log lines
Should help with debugging issues like #3971
2018-03-21 11:53:58 -07:00
Marcin Matlaszek
9b5a5922e2 Make raw_exec processes cleanup function more precise. 2018-03-20 13:40:21 +01:00
Marcin Matlaszek
963c10e584 Fix errors when trying to kill whole process group. 2018-03-20 13:40:21 +01:00
Marcin Matlaszek
76a8978c3e Make starting & cleaning process group Windows compatible. 2018-03-20 13:40:21 +01:00
Marcin Matlaszek
708d74cb7a Create new process group on process startup.
Clean up by sending SIGKILL to the whole process group.
2018-03-20 13:40:21 +01:00
Michael Schurter
a90ce65def Merge pull request #3958 from simplesurance/swappiness
fix: disable swap for executor_linux allocations
2018-03-13 10:10:22 -07:00
Fabian Holler
fbc461b904 fix: disable swap for executor_linux allocations
A comment in the nomad source code states that swapping for
executor_linux allocations is disabled but it wasn't.

Nomad wrote -1 to the memsw.limit_in_bytes cgroup file to disable
swapping.
This has the following problems:

1.) Writing -1 to the file does not disable swapping. It sets
    the limit for memory and swap to unlimited.
2.) On common Linux distributions like Ubuntu 16.04 LTS the
    memsw.limit_in_bytes cgroup file does not exist by default.
    The memsw.limit_in_bytes file only exist if the Linux kernel is
    build with CONFIG_MEMCG_SWAP=yes and either
    CONFIG_MEMCG_SWAP_ENABLED=yes or when the kernel parameter
    swapaccount=1 is passed during boot.
    Most Linux distributions disable swap accounting by default because
    of higher memory usage.
    Nomad silently ignores if writing to the memsw.limit_in_bytes file
    fails. The allocation succeeds, no message is logged to notify the
    user.

To ensure that disabling swap works on common Linux kernels, disable
swapping by writing 0 to the memory.swappiness file.
Using the memory.swappiness file only requires that the kernel is
compiled with CONFIG_MEMCG=yes. This is the default in common Linux
kernels.
2018-03-13 10:52:50 +01:00
Josh Soref
a657cbaced spelling: removes 2018-03-11 18:41:43 +00:00
Josh Soref
31651d124d spelling: remnants 2018-03-11 18:41:26 +00:00
Josh Soref
bd2912978b spelling: isolation 2018-03-11 18:19:02 +00:00
Josh Soref
8f4cbb2157 spelling: executor 2018-03-11 18:05:31 +00:00
Josh Soref
e8b989e328 spelling: constraints 2018-03-11 17:50:28 +00:00
Charlie Voiselle
8d6bd6dca4 fix typo
Priviledge -> privilege
2018-01-08 15:56:07 -05:00
Chelsea Holland Komlo
f09e3ec798 set default kill signal on executor shutdown 2017-12-07 11:40:15 -05:00
Chelsea Holland Komlo
927c0a4d88 change location of default kill signal 2017-12-06 17:48:25 -05:00
Chelsea Holland Komlo
9e49836d4f move kill_signal to task level, extend to docker 2017-12-06 14:36:39 -05:00
Chelsea Holland Komlo
079e6b5fb1 allow controlling the stop signal in exec/raw_exec 2017-12-06 11:28:45 -05:00
Adam Stankiewicz
79eccb2b1e Remove AllocID from ExecutorContext 2017-10-13 17:07:49 +02:00
Michael Schurter
04b8f8e7fc Remove structs import from api
Goes a step further and removes structs import from api's tests as well
by moving GenerateUUID to its own package.
2017-09-29 10:36:08 -07:00
Alex Dadgar
a9e3a41407 Enable more linters 2017-09-26 15:26:33 -07:00
Alex Dadgar
22c5999c09 darwin test fixes 2017-07-22 19:48:47 -07:00
Alex Dadgar
d4e35815a1 executor and logging pkg 2017-07-21 12:14:54 -07:00
Hynek Schlawack
96c9f9dd02 Fix typos 2017-06-16 16:10:12 +02:00
Michael Schurter
52ffc01972 Log PID when sending signals 2017-06-12 11:11:36 -07:00
Michael Schurter
aa0e977f1c Fix executor tests 2017-05-26 16:46:03 -07:00
Michael Schurter
ace00980a1 Refactor TaskEnvironment into Builder and TaskEnv 2017-05-23 13:53:33 -07:00
Michael Schurter
426c696404 Reuse ExecScript implementation 2017-05-04 16:21:40 -07:00
Michael Schurter
90f5e232a5 Switch java/exec to use Exec in Executor 2017-04-21 16:25:49 -07:00
Michael Schurter
10cb924b2c Refactor Consul Syncer into new ServiceClient
Fixes #2478 #2474 #1995 #2294

The new client only handles agent and task service advertisement. Server
discovery is mostly unchanged.

The Nomad client agent now handles all Consul operations instead of the
executor handling task related operations. When upgrading from an
earlier version of Nomad existing executors will be told to deregister
from Consul so that the Nomad agent can re-register the task's services
and checks.

Drivers - other than qemu - now support an Exec method for executing
abritrary commands in a task's environment. This is used to implement
script checks.

Interfaces are used extensively to avoid interacting with Consul in
tests that don't assert any Consul related behavior.
2017-04-19 12:42:47 -07:00
Alex Dadgar
67c07c9932 Various fixes for setting user/group of task
This PR fixes two issues:
* Folder permissions in -dev mode were incorrect and not suitable for
running as a particular user.
* Was not setting the group membership properly for the launched
process.

Fixes https://github.com/hashicorp/nomad/issues/2160
2017-03-20 14:21:13 -07:00
Alex Dadgar
36dc330737 Various fixes
This PR:
* Uses Go 1.8 executable lookup
* Stores any err message from stats init method
* Allows overriding of Cpu Compute for hosts where it can't be detected
2017-03-14 12:56:31 -07:00
Michael Schurter
16fb45e4ba Fix tests broken by API change 2017-03-02 15:54:12 -08:00
Alex Dadgar
07f7e19578 Fix vet script and fix vet problems
This PR fixes our vet script and fixes all the missed vet changes.

It also fixes pointers being printed in `nomad stop <job>` and `nomad
node-status <node>`.
2017-02-27 16:00:19 -08:00
Alex Dadgar
0e8b43767b Fix import 2017-01-25 21:27:36 -08:00
Alex Dadgar
c920d3cbb0 Fix unreachable function in tests 2017-01-25 20:58:24 -08:00
Diptanu Choudhury
84137b02c5 Filter executor log messages 2017-01-12 11:54:19 -08:00
Michael Schurter
34cc7a70ad Switch to a less timing dependent test command
`/usr/bin/yes` could produce output very quickly (100s of MBps on my
laptop) and therefore could cause log files to roll over.

A bash loop with a sleep avoids that issue. The test is slower but
should be much more resilient to the massive timing differences between
workstations and Travis.
2017-01-09 15:40:53 -08:00
Michael Schurter
ed8b3cd37d Fix executor tests 2017-01-06 11:39:18 -08:00
Michael Schurter
12915c30bf Remove debug logging 2017-01-05 16:31:56 -08:00
Michael Schurter
de7351b959 Move chroot building into TaskRunner
* Refactor AllocDir to have a TaskDir struct per task.
* Drivers expose filesystem isolation preference
* Fix lxc mounting of `secrets/`
2017-01-05 16:31:49 -08:00
Alex Dadgar
3bf19b555e Interpolate all check related variables 2016-11-08 14:43:46 -08:00
Alex Dadgar
17cab6e932 Fix env vars relating to secretdir 2016-11-08 12:28:43 -08:00
Diptanu Choudhury
6acfa45f2a Making the executor lock the logger 2016-10-28 10:57:35 -07:00
Alex Dadgar
a186f7a26d Merge pull request #1806 from hashicorp/f-docker4mac-fixes
A couple fixes to make Docker For Mac work
2016-10-27 09:29:40 -07:00
Alex Dadgar
00ce1e50f5 Fix panic 2016-10-25 17:27:13 -07:00
Michael Schurter
4d3187bc7e Remove disk usage enforcement
Many thanks to @iverberk for the original PR (#1609), but we ended up
not wanting to ship this implementation with 0.5.

We'll come back to it after 0.5 and hopefully find a way to leverage
filesystem accounting and quotas, so we can skip the expensive polling.
2016-10-21 13:55:51 -07:00