Also provide stack trace output in daemon logs.
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 26d0bac8955903bc3a845358d159b2ec2f7c253f)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
| ... | ... |
@@ -137,7 +137,7 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
|
| 137 | 137 |
} |
| 138 | 138 |
|
| 139 | 139 |
if err := handlerFunc(ctx, w, r, vars); err != nil {
|
| 140 |
- logrus.Errorf("Handler for %s %s returned error: %v", r.Method, r.URL.Path, err)
|
|
| 140 |
+ logrus.Errorf("Handler for %s %s returned error: %+v", r.Method, r.URL.Path, err)
|
|
| 141 | 141 |
httputils.MakeErrorHandler(err)(w, r) |
| 142 | 142 |
} |
| 143 | 143 |
} |
| ... | ... |
@@ -237,7 +237,7 @@ func (pm *Manager) save(p *v2.Plugin) error {
|
| 237 | 237 |
return errors.Wrap(err, "failed to marshal plugin json") |
| 238 | 238 |
} |
| 239 | 239 |
if err := ioutils.AtomicWriteFile(filepath.Join(pm.config.Root, p.GetID(), configFileName), pluginJSON, 0600); err != nil {
|
| 240 |
- return err |
|
| 240 |
+ return errors.Wrap(err, "failed to write atomically plugin json") |
|
| 241 | 241 |
} |
| 242 | 242 |
return nil |
| 243 | 243 |
} |
| ... | ... |
@@ -42,12 +42,12 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
|
| 42 | 42 |
|
| 43 | 43 |
if p.PropagatedMount != "" {
|
| 44 | 44 |
if err := mount.MakeRShared(p.PropagatedMount); err != nil {
|
| 45 |
- return err |
|
| 45 |
+ return errors.WithStack(err) |
|
| 46 | 46 |
} |
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 | 49 |
if err := initlayer.Setup(filepath.Join(pm.config.Root, p.PluginObj.ID, rootFSFileName), 0, 0); err != nil {
|
| 50 |
- return err |
|
| 50 |
+ return errors.WithStack(err) |
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
if err := pm.containerdClient.Create(p.GetID(), "", "", specs.Spec(*spec), attachToLog(p.GetID())); err != nil {
|
| ... | ... |
@@ -56,7 +56,7 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
|
| 56 | 56 |
logrus.Warnf("Could not unmount %s: %v", p.PropagatedMount, err)
|
| 57 | 57 |
} |
| 58 | 58 |
} |
| 59 |
- return err |
|
| 59 |
+ return errors.WithStack(err) |
|
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 | 62 |
return pm.pluginPostStart(p, c) |
| ... | ... |
@@ -67,7 +67,7 @@ func (pm *Manager) pluginPostStart(p *v2.Plugin, c *controller) error {
|
| 67 | 67 |
if err != nil {
|
| 68 | 68 |
c.restart = false |
| 69 | 69 |
shutdownPlugin(p, c, pm.containerdClient) |
| 70 |
- return err |
|
| 70 |
+ return errors.WithStack(err) |
|
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
p.SetPClient(client) |
| ... | ... |
@@ -3,7 +3,6 @@ |
| 3 | 3 |
package v2 |
| 4 | 4 |
|
| 5 | 5 |
import ( |
| 6 |
- "errors" |
|
| 7 | 6 |
"os" |
| 8 | 7 |
"path/filepath" |
| 9 | 8 |
"strings" |
| ... | ... |
@@ -12,6 +11,7 @@ import ( |
| 12 | 12 |
"github.com/docker/docker/oci" |
| 13 | 13 |
"github.com/docker/docker/pkg/system" |
| 14 | 14 |
specs "github.com/opencontainers/runtime-spec/specs-go" |
| 15 |
+ "github.com/pkg/errors" |
|
| 15 | 16 |
) |
| 16 | 17 |
|
| 17 | 18 |
// InitSpec creates an OCI spec from the plugin's config. |
| ... | ... |
@@ -29,7 +29,7 @@ func (p *Plugin) InitSpec(execRoot string) (*specs.Spec, error) {
|
| 29 | 29 |
|
| 30 | 30 |
execRoot = filepath.Join(execRoot, p.PluginObj.ID) |
| 31 | 31 |
if err := os.MkdirAll(execRoot, 0700); err != nil {
|
| 32 |
- return nil, err |
|
| 32 |
+ return nil, errors.WithStack(err) |
|
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 | 35 |
mounts := append(p.PluginObj.Config.Mounts, types.PluginMount{
|
| ... | ... |
@@ -95,7 +95,7 @@ func (p *Plugin) InitSpec(execRoot string) (*specs.Spec, error) {
|
| 95 | 95 |
path := *dev.Path |
| 96 | 96 |
d, dPermissions, err := oci.DevicesFromPath(path, path, "rwm") |
| 97 | 97 |
if err != nil {
|
| 98 |
- return nil, err |
|
| 98 |
+ return nil, errors.WithStack(err) |
|
| 99 | 99 |
} |
| 100 | 100 |
s.Linux.Devices = append(s.Linux.Devices, d...) |
| 101 | 101 |
s.Linux.Resources.Devices = append(s.Linux.Resources.Devices, dPermissions...) |