misskey-dev / misskey

๐ŸŒŽ A completely free and open interplanetary microblogging platform ๐Ÿš€
https://misskey-hub.net/
GNU Affero General Public License v3.0
9.99k stars 1.36k forks source link

Migration script hangs on the same query #8628

Closed liquidsanek closed 2 years ago

liquidsanek commented 2 years ago

๐Ÿ’ก Summary

Hello, as I tried to update my instance from version 12.98.0 to the latest version (12.110.1), the migration scripts hang constantly on the same query.

๐Ÿฅฐ Expected Behavior

The project is built correctly, and the migration scripts are all executed.

๐Ÿคฌ Actual Behavior

There are errors during the build process:

Found 200 errors in 84 files.

Errors  Files
     1  node_modules/@types/express-serve-static-core/index.d.ts:501
     8  node_modules/htmlparser2/node_modules/domelementtype/lib/index.d.ts:20
     1  node_modules/ip-address/dist/lib/ipv4.d.ts:2
     1  node_modules/ip-address/dist/lib/ipv6.d.ts:3
     1  node_modules/ip-cidr/index.d.ts:2
     1  node_modules/pureimage/types/text.d.ts:1
     1  src/boot/index.ts:15
     3  src/boot/master.ts:9
     2  src/daemons/queue-stats.ts:4
     2  src/daemons/server-stats.ts:5
     1  src/db/postgre.ts:2
     1  src/db/redis.ts:1
     2  src/misc/antenna-cache.ts:17
     1  src/misc/app-lock.ts:3
     1  src/misc/emoji-regex.ts:1
     2  src/misc/extract-custom-emojis-from-mfm.ts:9
     2  src/misc/extract-hashtags.ts:6
     1  src/misc/extract-mentions.ts:10
     1  src/misc/fetch.ts:49
     1  src/misc/get-note-summary.ts:8
     1  src/misc/i18n.ts:16
     1  src/misc/schema.ts:161
     2  src/misc/webhook-cache.ts:19
     1  src/models/repositories/gallery-post.ts:16
     2  src/models/repositories/note.ts:221
     2  src/models/repositories/page.ts:21
     2  src/queue/processors/db/export-custom-emojis.ts:6
     1  src/queue/processors/db/import-custom-emojis.ts:4
     1  src/remote/activitypub/kernel/move/index.ts:1
     1  src/remote/activitypub/kernel/update/index.ts:26
     5  src/remote/activitypub/models/person.ts:62
     1  src/remote/activitypub/renderer/flag.ts:13
     1  src/remote/activitypub/renderer/note.ts:114
     4  src/remote/activitypub/resolver.ts:64
     2  src/server/activitypub.ts:61
     2  src/server/activitypub/followers.ts:18
     2  src/server/activitypub/following.ts:19
     3  src/server/activitypub/outbox.ts:23
     1  src/server/api/api-handler.ts:9
     1  src/server/api/common/signin.ts:37
     4  src/server/api/endpoints.ts:712
     1  src/server/api/endpoints/admin/announcements/list.ts:66
     1  src/server/api/endpoints/admin/drive/files.ts:41
     1  src/server/api/endpoints/admin/drive/show-file.ts:172
     1  src/server/api/endpoints/admin/emoji/list.ts:66
     1  src/server/api/endpoints/admin/meta.ts:319
     1  src/server/api/endpoints/admin/show-users.ts:49
     1  src/server/api/endpoints/drive/files.ts:36
     1  src/server/api/endpoints/drive/files/create.ts:51
     1  src/server/api/endpoints/drive/files/find-by-hash.ts:31
     1  src/server/api/endpoints/drive/files/find.ts:33
     3  src/server/api/endpoints/drive/files/show.ts:53
     2  src/server/api/endpoints/drive/files/update.ts:60
     1  src/server/api/endpoints/drive/files/upload-from-url.ts:40
     1  src/server/api/endpoints/drive/stream.ts:35
     2  src/server/api/endpoints/endpoint.ts:25
     1  src/server/api/endpoints/i/authorized-apps.ts:34
     6  src/server/api/endpoints/i/update.ts:123
     6  src/server/api/endpoints/messaging/messages.ts:72
     8  src/server/api/endpoints/messaging/messages/create.ts:94
     7  src/server/api/endpoints/notes/create.ts:188
     1  src/server/api/endpoints/notes/reactions.ts:59
     4  src/server/api/endpoints/notes/search-by-tag.ts:88
     2  src/server/api/endpoints/notes/translate.ts:86
     2  src/server/api/endpoints/pages/show.ts:51
     4  src/server/api/endpoints/users/followers.ts:68
     4  src/server/api/endpoints/users/following.ts:68
     2  src/server/api/private/signin.ts:17
     3  src/server/api/private/signup-pending.ts:7
     2  src/server/api/private/signup.ts:14
    13  src/server/api/service/discord.ts:149
    11  src/server/api/service/github.ts:147
     8  src/server/api/service/twitter.ts:128
     2  src/server/api/stream/channels/queue-stats.ts:4
     2  src/server/api/stream/channels/server-stats.ts:4
     2  src/server/api/stream/index.ts:196
     5  src/server/index.ts:60
     1  src/server/nodeinfo.ts:97
     1  src/server/web/manifest.ts:2
     1  src/server/web/url-preview.ts:34
     2  src/services/drive/add-file.ts:478
     4  src/services/logger.ts:3
     1  src/services/note/delete.ts:52
     2  src/services/user-cache.ts:11

I could post the full build logs if needed, I haven't yet because of how lengthy it is.

And the command yarn migrate hangs on the query:

Migration chartV61643967331284 has been executed successfully.
query: SELECT "userId", "mutedWords" FROM "user_profile" WHERE "userHost" IS NULL
query: UPDATE "user_profile" SET "mutedWords" = $1 WHERE "userId" = $2 -- PARAMETERS: ["[]","8pflayyvr4"]

๐Ÿ“ Steps to Reproduce

  1. git checkout master
  2. git pull
  3. git submodule update --init
  4. yarn cleanall
  5. yarn install
  6. NODE_ENV=production yarn build
  7. yarn migrate

๐Ÿ“Œ Environment

Misskey version: Update from 12.98.0 to 12.110.1 Your OS: Debian 10 Your browser: / NodeJS's version: Tried with 16.8, then 16.15 and finally 18.x after being told to update Node

Thanks!

Johann150 commented 2 years ago

The problem with errors during the build process is known and getting rid of all the errors is currently the 1st roadmap entry. Misskey should still run despite these build errors.

The query you posted does not strike me as anything out of the ordinary, or even anything that should take a long time to complete. I assume there is no further output after that? Maybe you can check if the PostgreSQL server logs have any more information.

liquidsanek commented 2 years ago

even anything that should take a long time to complete.

I've left it going for at least 20 minutes, and as you said, seeing the query, it really shouldn't take that long, which is why it seems odd to me.

I assume there is no further output after that?

Nothing. It just gets stuck on this query and all I can do is either wait indefinitely or interrupt the migration process.

Maybe you can check if the PostgreSQL server logs have any more information.

I checked and nothing related to said migration queries are showing up, only Misskey failing to do certain queries since the migration scripts are not fully executed yet, which was before I stopped Misskey's process. I can't find any relevant log about this issue.

xianonn commented 2 years ago

ใ“ใ“ใงๆญขใพใฃใฆใ„ใ‚‹ใฟใŸใ„ใงใ™ใญใ€‚ https://github.com/misskey-dev/misskey/blob/a29ff7b1fa45e01bc7c097e8d770a4c4eedf2a8f/packages/backend/migration/1644010796173-convert-hard-mutes.js#L56-L62

ใกใ‚ƒใ‚“ใจ่ชฟในใฆใ„ใชใ„ใฎใงใ™ใŒ 12.98.0 ใ‹ใ‚‰ 12.110.1 ใพใงไธ€ๆฐ—ใซ migrate ใ™ใ‚‹ใจใƒ‡ใƒƒใƒ‰ใƒญใƒƒใ‚ฏใ—ใฆ UPDATE ใงใใฆใ„ใชใ„ใ‚ˆใ†ใชๆฐ—ใŒใ—ใพใ™ใ€‚

ไธ€ๆ—ฆ 12.105.0 ใซใ‚ขใƒƒใƒ—ใƒ‡ใƒผใƒˆใ—ใฆใ‹ใ‚‰ 12.110.1 ใซใ‚ขใƒƒใƒ—ใƒ‡ใƒผใƒˆใ™ใ‚ŒใฐๆˆๅŠŸใ—ใใ†ใงใ™ใ€‚

xianonn commented 2 years ago

12.105.0 ใฏใƒ“ใƒซใƒ‰ใซๅคฑๆ•—ใ™ใ‚‹ใฎใงใƒ€ใƒกใงใ—ใŸใ€‚

12.110.1 ใฎใพใพใงใ‚‚ใƒˆใƒฉใƒณใ‚ถใ‚ฏใ‚ทใƒงใƒณใ‚’็„กๅŠนใซใ™ใ‚‹ใ“ใจใง migrate ใงใใพใ—ใŸใ€‚ yarn migrate ใฎไปฃใ‚ใ‚Šใซไธ‹ใฎใ‚ณใƒžใƒณใƒ‰ใ‚’ๅฎŸ่กŒใ—ใพใ™ใ€‚

cd packages/backend
npx typeorm migration:run -d ormconfig.js -t false
cd ../..
xianonn commented 2 years ago

ไธ€ๅฟœใƒ‡ใƒผใ‚ฟใƒ™ใƒผใ‚นใฎใƒใƒƒใ‚ฏใ‚ขใƒƒใƒ—ใ‚’ๅ–ใฃใฆใ‹ใ‚‰ๅฎŸ่กŒใ—ใŸๆ–นใŒ่‰ฏใ„ใ‹ใ‚‚ใ€‚

liquidsanek commented 2 years ago

It worked! The instance started successfully, and no errors are appearing in the logs. Thanks for the help @xianonn ! :)

Closing the issue since it's solved now

liquidsanek commented 2 years ago

It worked! The instance started successfully, and no errors are appearing in the logs. Thanks for the help @xianonn ! :)

Closing the issue since it's solved now