Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d0d06c99d : deprecation warning breaks assets recompile #2423

Closed
melissaboiko opened this issue Sep 22, 2023 · 10 comments
Closed

d0d06c99d : deprecation warning breaks assets recompile #2423

melissaboiko opened this issue Sep 22, 2023 · 10 comments
Labels

Comments

@melissaboiko
Copy link

Steps to reproduce the problem

During upgrade to the current head, I get:

+ env RAILS_ENV=production bundle exec rails assets:precompile
...
Compiling...
Compiled all packs in /home/mastodon/glitch-soc/public/packs
`isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration`
    at isModuleDeclaration (/home/mastodon/glitch-soc/node_modules/babel-plugin-lodash/node_modules/@babel/types/lib/val
idators/generated/index.js:2740:35)
    at PluginPass.Program (/home/mastodon/glitch-soc/node_modules/babel-plugin-lodash/lib/index.js:102:44)

And it stops there with an error status code.

Attempting to continue the upgrade process seems to succeed, but if I do rake assets:clobber assets:precompile, it comes up again. So I'm wary if there are assets that end up not compiled.

Expected behaviour

all assets compiled without error

Actual behaviour

a deprecation warning seems to stop the process

Detailed description

No response

Mastodon instance

No response

Mastodon version

d0d06c9

Technical details

ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
node v18.13.0

@nanos
Copy link

nanos commented Sep 22, 2023

yeah, I've been getting this for quite some time now.

Usually just re-running env RAILS_ENV=production bundle exec rails assets:precompile seems to 'fix' things, but I'm not sure about the implications.

@ClearlyClaire
Copy link

The warning is just a warning and can be ignored. If there is an error return status, I'm not sure what the cause is.

@nanos
Copy link

nanos commented Sep 22, 2023

That's what I thought. The error return status is what always somewhat concerned me ...

@nanos
Copy link

nanos commented Sep 22, 2023

Actually, also: Mine explicitly states Compilation failed

Compiling...
Compilation failed:
`isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration`
    at isModuleDeclaration (/home/mastodon/live/node_modules/babel-plugin-lodash/node_modules/@babel/types/lib/validators/generated/index.js:2740:35)
    at PluginPass.Program (/home/mastodon/live/node_modules/babel-plugin-lodash/lib/index.js:102:44)

@ClearlyClaire
Copy link

“Compilation failed” is most likely because it ran out of memory

@nanos
Copy link

nanos commented Sep 22, 2023

oh. I never considered that, because my machine usually has loads of free memory. Are there any good strategies to reduce memory consumption?

@melissaboiko
Copy link
Author

melissaboiko commented Sep 22, 2023

@nanos Yes it is "fixed" next run, but it's fixed by going "Everything's up-to-date. Nothing to do" after the last one broke.

My worry is the possibility of the following scenario, though dunno how likely it is:

  1. assets:precompile is interrupted due to spurious warning out-of-memory error.
  2. Some asset doesn't get compiled.
  3. But on a second pass, it thinks it's all compiled.
  4. Six months from now, someone tries to upload an audio-only media (or some other uncommon operation) and it fails in weird undebuggable ways because frobnicate.js is three versions outdated.

@melissaboiko
Copy link
Author

“Compilation failed” is most likely because it ran out of memory

Ooh that's interesting! The fact that the deprecation warning is the last thing output before the "compilation failed" can be quite misleading I think.

I ran again the clobber–recompile sequence while watching the memory usage on htop. My server has 8GiB RAM, usually with 4GiB in use. During the recompile I saw it edge to 7GiB, but didn't go overboard and this time it all compiled.

I'm not sure what's the solution here since this is a rails thing, not mastodon or glitch. I guess documentation on the mastodon upgrade manual would be a compromise, or a message on the console somehow. In any case I'm closing this issue as it doesn't seem to be glitch-specific.

@nanos
Copy link

nanos commented Sep 22, 2023

Ooh that's interesting! The fact that the deprecation warning is the last thing output before the "compilation failed" can be quite misleading I think.

Yeah. Especially with that colon in there as well, suggestion causality...

@ClearlyClaire
Copy link

@nanos Yes it is "fixed" next run, but it's fixed by going "Everything's up-to-date. Nothing to do" after the last one broke.

My worry is the possibility of the following scenario, though dunno how likely it is:

1. `assets:precompile` is interrupted due to ~spurious warning~ out-of-memory error.

2. Some asset doesn't get compiled.

3. But on a second pass, it thinks it's all compiled.

4. Six months from now, someone tries to upload an audio-only media (or some other uncommon operation) and it fails in weird undebuggable ways because frobnicate.js is three versions outdated.

It's an all-or-nothing situation, but it's possible to indeed have webpack think it correctly build assets. In such a situation, run bundle exec rails assets:clobber

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants