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

Issue using canvas:compile | Parallel::UndumpableException: FrozenError: can't modify frozen Array #2303

Open
aidangibson opened this issue Jan 19, 2024 · 13 comments

Comments

@aidangibson
Copy link

Summary:

Working through the installation guide for the simple install, and have reached an issue I can't for the life of me work out. I am trying to run Canvas LMS on Ubuntu Server 22.04.3 LTS.

When running bundle exec rails canvas:compile_assets
or bundle exec rake canvas:compile_assets the compilation breaks with FrozenError.

FrozenError: The error FrozenError: can't modify frozen Array indicates that the code is trying to modify an array that has been frozen (made immutable) and cannot be changed.

This error occurs in the Rails engine setup (as indicated by the path /var/lib/gems/3.1.0/gems/railties-7.0.8/lib/rails/engine.rb).

Specific Location of the Error:

The error specifically occurs at engine.rb:575 in the rails gem. This line is involved in the process of initializing the Rails application.

It occurs at this point within canvas:compile_assets:

--> Finished: 'js:webpack_production' in 60.63s
rake aborted!
Parallel::UndumpableException: FrozenError: can't modify frozen Array: ["/home/user/canvas/app/middleware", "/home/user/canvas/lib/base"]

Steps to reproduce:

  1. Follow the instructions at https://github.com/instructure/canvas-lms/wiki/Quick-Start

  2. Run command bundle exec rails canvas:compile_assets

Expected behavior:

Successful compilation of canvas-lms

Actual behavior:

FrozenError

Additional notes:

Compile Canvas Output.md

@psenicka0101
Copy link

Having the exact same problem... I've tried the prod and all the recent stable branches and master branch with no luck. Also had no luck with their docker script.

@0711kps
Copy link

0711kps commented Feb 21, 2024

I'm not sure if it's related, but I had the same issue before,
and the error was solved(or maybe just disappear for some reason)
after I delete .bundle/plugin folder and run bundle install again

@Maclenn77
Copy link

I recently installed canvas in a self-hosted vm instance. bundle exec rake canvas:compile_assetswas a pain point.

Despite the problem doesn't seem the same, just running bundle exec rails js:webpack_production works for me.

If you google the error, all the issues are canvas related, so I guess that they are wrapping a memory error with that exception. It seems that js:webpack_production is a task with heavy memory requirements and that's why it fails often to compile.

@virgo47
Copy link

virgo47 commented Mar 25, 2024

I'm trying to put together a production Dockerfile, but I'm also verifying the steps in Ubuntu 22.04 VM. I got stuck on this as well, FrozenError, although in my case it's after css:compile so I guess it's sooner?

--> Finished: 'css:compile' in 17.58s
rake aborted!
Parallel::UndumpableException: FrozenError: can't modify frozen Array: ["/var/canvas/app/controllers", "/var/canvas/app/controllers/concerns", "/var/canvas/app/graphql", "/var/canvas/app/helpers", "/var/canvas/app/messages", "/var/canvas/app/models", "/var/canvas/app/observers", "/var/canvas/app/presenters", "/var/canvas/app/serializers", "/var/canvas/app/services", "/var/canvas/app/stylesheets", "/var/canvas/lib", "/var/canvas/gems/plugins/qti_exporter/lib", "/var/canvas/gems/plugins/moodle_importer/lib", "/var/canvas/gems/plugins/account_reports/lib", "/var/canvas/gems/plugins/academic_benchmark/lib", "/var/canvas/vendor/bundle/ruby/3.1.0/gems/sentry-rails-5.16.1/app/jobs", "/var/canvas/vendor/bundle/ruby/3.1.0/gems/canvas_webex-0.18.2/app/models", "/var/canvas/vendor/bundle/ruby/3.1.0/gems/canvas_webex-0.18.2/lib", "/var/canvas/vendor/bundle/ruby/3.1.0/gems/canvas_connect-0.3.16/app/models", "/var/canvas/vendor/bundle/ruby/3.1.0/gems/canvas_connect-0.3.16/lib", #<Pathname:/var/canvas/lib/stubs>]
/var/canvas/vendor/bundle/ruby/3.1.0/gems/railties-7.0.8/lib/rails/engine.rb:574:in `unshift'

No change after deleting .bundle/plugin and running bundle install.

I used https://github.com/instructure/canvas-lms/archive/prod.tar.gz, I'd rather go for a concrete pinned version, but I don't know how to do it and existing guides differ quite a lot on how and what to download, often leading to 404 anyway.

@nogara
Copy link

nogara commented Mar 25, 2024

I had the same exact problem when using my own Dockerfile, and I gave up on it after a few tries.

I decided to give it another try today, and following Production Start almost to the letter on the master branch finally worked. I used a c5.2xlarge instance on AWS to get a lot of CPU and memory and eliminate this from the equation.

I'm going to try creating a Dockerfile again using the master branch to see if it works too.

@virgo47
Copy link

virgo47 commented Mar 26, 2024

Just to be sure, could that error indicate a lack of memory? I'm no Rails/Ruby expert, but just from the message itself, I assume it's the source code problem.
EDIT: I'm using Ubuntu VM with 16GB of RAM, 8 vCPU and Docker on it. 16GB should be enough, or not?

@aidangibson
Copy link
Author

aidangibson commented Mar 27, 2024 via email

@virgo47
Copy link

virgo47 commented Mar 28, 2024

EDIT: So my problem seems to be that I wanted to run this as Dockerfile step - but this step requires config/database.yml correctly configured and DB initalized. The error message is unbelievably cryptic, but the reason is simple and the step is shown AFTER DB initialization for good reason.
In order to optimize Dockerfile steps, I reordered some, but this one must go after DB init. It probably can't be done during Docker image preparation (unless one prepares some temporary DB as well?) and I'll put these steps into some kind of "seeder job" in my Helm chart.

@0711kps
Copy link

0711kps commented Mar 28, 2024

I notice there's a line Managed item /home/science/canvas/node\_modules/plugin-bundles-generated.js isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option) in your complete output log

is the file/folder exist? maybe you can try to make a backup for it, removing it and run the compile assets command again

@aidangibson
Copy link
Author

aidangibson commented Mar 28, 2024 via email

@nogara
Copy link

nogara commented May 21, 2024

I'm still getting the same error, even after trying different versions of ruby and different branches... Did anyone have any luck fixing this?

@aidangibson
Copy link
Author

aidangibson commented Jun 23, 2024 via email

@phil-davis
Copy link

I was following the "quick" start for developers:
https://github.com/instructure/canvas-lms/wiki/Quick-Start

And getting this FrozenError

Then I did later DB setup steps:

$ cp config/database.yml.example config/database.yml
$ createdb canvas_development
$ cp config/security.yml.example config/security.yml
$ bundle exec rails db:initial_setup

And then came back and did:

bundle exec rails canvas:compile_assets

Now it only gives me a warning (unrelated to this issue):

WARNING in ⚠ custom stage for process_assets is not supported yet, so Infinity is fallback to Compilation.PROCESS_ASSETS_STAGE_REPORT(5000)

The installation and set up process needs to be reviewed by "someone who knows what they are doing" (tm), and the order of steps etc. be adjusted.

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

No branches or pull requests

7 participants