balena-os / balena-supervisor

Balena Supervisor: balena's agent on devices.
https://balena.io
Other
148 stars 62 forks source link

Failed to migrate ids for legacy app #1744

Open 20k-ultra opened 3 years ago

20k-ultra commented 3 years ago

A device was provisioned with an OS that had Supervisor version 6.x.x (forgot to get exact version..) but then was HUPd to balenaOS version with 12.3.5 which worked perfectly fine. The issue though was when trying to apply the target state we can see the following log where the Supervisor tries to "Migrating ids for legacy app..." but gets stuck.

Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [info]    Supervisor v12.3.5 starting up...
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [info]    Setting host to discoverable
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [warn]    Invalid firewall mode: . Reverting to state: off
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [info]    🔥 Applying firewall mode: off
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [debug]   Starting logging infrastructure
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [debug]   Performing database cleanup for container log timestamps
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [info]    Starting firewall
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [info]    Previous engine snapshot was not stored. Skipping cleanup.
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [debug]   Handling of local mode switch is completed
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: (node:1) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [info]    API Binder bound to: https://api.resin.io/v6/
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [success] 🔥 Firewall mode applied
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [debug]   Starting api binder
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [info]    Legacy app detected, running migration
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [event]   Event: Supervisor start {}
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [info]    Migrating ids for legacy app...
Jul 07 15:25:20 8e66e9d resin-supervisor[9702]: [debug]   Getting release 4f748f42731a7d72bf01de8180a520241820f21a for app 653693 from API
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]: [debug]   Found a release with releaseId 1082779, imageId 1537659, serviceId 6347
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]: [debug]     Image location is registry2.balena-cloud.com/v2/ff4b3dbc3c2431cd18be76f3d634cd91@sha256:e44b8c8960f2bdeac52de1cf10a0710e0a1c8280d3bf3cdda67febf1d2f09b44
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]: (node:1) UnhandledPromiseRejectionWarning: Error: (HTTP code 404) no such image - no such image: registry2.balena-cloud.com/v2/ff4b3dbc3c2431cd18be76f3d634cd91: No such image: registry2.balena-cloud.com/v2/ff4b3dbc3c2431cd18be76f3d634cd91:latest
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]:     at /usr/src/app/dist/app.js:10:2302933
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]:     at /usr/src/app/dist/app.js:10:2302865
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]:     at Modem.buildPayload (/usr/src/app/dist/app.js:10:2302885)
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]:     at IncomingMessage.<anonymous> (/usr/src/app/dist/app.js:10:2302138)
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]:     at IncomingMessage.emit (events.js:322:22)
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]:     at endReadableNT (_stream_readable.js:1187:12)
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]:     at processTicksAndRejections (internal/process/task_queues.js:84:21)
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]: (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
Jul 07 15:25:21 8e66e9d resin-supervisor[9702]: (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The JF ticket contains more diagnostic logs that shows the entire state which created this: https://jel.ly.fish/4d29ca1d-8669-4fe6-aba4-a8d2a209ba55

jellyfish-bot commented 3 years ago

[20k-ultra] This issue has attached support thread https://jel.ly.fish/4d29ca1d-8669-4fe6-aba4-a8d2a209ba55