TritonDataCenter / sdc-imgapi

SDC internal API for managing OS images
Mozilla Public License 2.0
5 stars 18 forks source link

imgapi crash when pulling from docker.io with invalid credentials #13

Closed timclassic closed 6 years ago

timclassic commented 7 years ago

I tried to start a container that required pulling an image from docker.io with an incorrect Docker account password. imgapi crashes with the following messages:

      {"name":"imgapi","hostname":"cde4e9e5-0dbf-4b3c-97e6-7bef3efe2415","pid":48719,"req_id":"528439dc-e51d-4695-aab9-bcba5c44a419","level":30,"evt":{"ph":"b","name":"createimage","req_seq":1492271454862004},"msg":"","time":"2017-04-15T15:50:54.865Z","v":0}
      {"name":"imgapi","hostname":"cde4e9e5-0dbf-4b3c-97e6-7bef3efe2415","pid":48719,"req_id":"528439dc-e51d-4695-aab9-bcba5c44a419","level":30,"indexName":"docker.io","supportsV2":true,"msg":"regSupportsV2","time":"2017-04-15T15:50:54.964Z","v":0}
      Uncaught Error: too few args to sprintf

      FROM
      jsSprintf (/opt/smartdc/imgapi/node_modules/extsprintf/lib/extsprintf.js:71:4)
      WError (/opt/smartdc/imgapi/node_modules/verror/lib/verror.js:207:41)
      HttpError (/opt/smartdc/imgapi/node_modules/restify/lib/errors/http_error.js:68:12)
      new module.exports.(anonymous function) (/opt/smartdc/imgapi/node_modules/restify/lib/errors/http_error.js:146:19)
      Object.wrapErrorFromDrc (/opt/smartdc/imgapi/lib/errors.js:557:16)
      /opt/smartdc/imgapi/lib/images.js:3563:37
      /opt/smartdc/imgapi/node_modules/docker-registry-client/lib/registry-client-v1.js:873:9
      next (/opt/smartdc/imgapi/node_modules/vasync/lib/vasync.js:201:4)
      _afterCall (/opt/smartdc/imgapi/node_modules/docker-registry-client/lib/registry-client-v1.js:865:28)
      Barrier._onGetNonRedirResult (/opt/smartdc/imgapi/node_modules/docker-registry-client/lib/registry-client-v1.js:659:9)
      emitNone (events.js:67:13)
      Barrier.emit (events.js:166:7)
      Immediate._onImmediate (/opt/smartdc/imgapi/node_modules/vasync/lib/vasync.js:515:9)
      processImmediate [as _immediateCallback] (timers.js:383:17)

and then the service restarts.

I resolved the issue locally by running a docker login and supplying the correct credentials.

imgapi version:

[root@headnode (XXX) ~]# sdcadm instances imgapi
INSTANCE                              SERVICE  HOSTNAME  VERSION                                     ALIAS
cde4e9e5-0dbf-4b3c-97e6-7bef3efe2415  imgapi   headnode  release-20170413-20170413T065313Z-gcd38df3  imgapi0
ofsole commented 7 years ago

+1, we met the same issue here, this happened when we run docker pull image

Uncaught Error: too few args to sprintf

FROM
jsSprintf (/opt/smartdc/imgapi/node_modules/extsprintf/lib/extsprintf.js:71:4)
WError (/opt/smartdc/imgapi/node_modules/verror/lib/verror.js:207:41)
HttpError (/opt/smartdc/imgapi/node_modules/restify/lib/errors/http_error.js:68:12)
new module.exports.(anonymous function) (/opt/smartdc/imgapi/node_modules/restify/lib/errors/http_error.js:146:19)
Object.wrapErrorFromDrc (/opt/smartdc/imgapi/lib/errors.js:557:16)
/opt/smartdc/imgapi/lib/images.js:3563:37
/opt/smartdc/imgapi/node_modules/docker-registry-client/lib/registry-client-v1.js:873:9
next (/opt/smartdc/imgapi/node_modules/vasync/lib/vasync.js:201:4)
/opt/smartdc/imgapi/node_modules/docker-registry-client/lib/registry-client-v1.js:485:20
_after (/opt/smartdc/imgapi/node_modules/docker-registry-client/lib/registry-client-v1.js:801:13)
Barrier._onGetNonRedirResult (/opt/smartdc/imgapi/node_modules/docker-registry-client/lib/registry-client-v1.js:659:9)
emitNone (events.js:67:13)
Barrier.emit (events.js:166:7)
Immediate._onImmediate (/opt/smartdc/imgapi/node_modules/vasync/lib/vasync.js:515:9)
processImmediate [as _immediateCallback] (timers.js:383:17)
processImmediate [as _immediateCallback] (timers.js:383:17)
[ Aug 28 07:46:46 Stopping because all processes in service exited. ]
[ Aug 28 07:46:46 Executing stop method (:kill). ]
[ Aug 28 07:46:46 Restarting too quickly, changing state to maintenance. ]
twhiteman commented 6 years ago

This error should now be fixed by the aforementioned change.