According to go/codec's docs, Reset(...) should be called on
Decoders/Encoders before reuse:
https://godoc.org/github.com/ugorji/go/codec
I could find no evidence that *not* calling Reset() caused bugs, but
might as well do what the docs say?
This PR enhances the API package by having client only RPCs route
through the server when they are low cost and for filesystem access to
first attempt a direct connection to the node and then falling back to
a server routed request.
Fixes#3342
Two bugs were fixed:
* Closing the StreamFramer's exitCh before setting the error means other
goroutines blocked on exitCh closing could see the error as nil. This
was *not* observered.
* parseFramerError on Windows would fall through and return an
improperly captured nil err variable. There's no need for
parseFramerError to be a closure which fixes the confusion.
This PR removes deepcopying of the job attached to the allocation in the
alloc runner. This operation is called very often so removing reflect
from the code path and the potentially large number of mallocs need to
create a job reduced memory and cpu pressure.
This PR adds tracking to when a task starts and finishes and the logs
API takes advantage of this and returns better errors when asking for
logs that do not exist.
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>`.
This PR:
* Fixes a race in which StreamFramer could panic while closing.
* Simplifies the logic of the StreamFramer
* Removes a potentially leaked goroutine