Skip to content

[RUN ALL RSPEC] [RUN AS-IF-FOSS] Switch to Zeitwerk autoloader

Heinrich Lee Yu requested to merge enable-zeitwerk into master

What does this MR do?

Switches from the classic autoloader to Zeitwerk. The classic autoloader is deprecated and will be removed in future version of Rails. Zeitwerk is also required for Sidekiq 6.

Previously, when we attempted to switch to Zeitwerk, we ran into code-reloading issues: #211875 (closed) specially when DB load balancing is enabled.

To verify that this is no longer the case:

  1. Switch to this branch

  2. Enable load balancing with something like this in config/database.yml:

    development:
      main:
        adapter: postgresql
        encoding: unicode
        database: gitlabhq_development
        pool: 5
        username: postgres
        password: password
        host: postgres
        load_balancing:
          hosts:
            - postgres
            - postgres
  3. Start Puma

  4. Browse the web UI

  5. Run touch app/models/user.rb (Or any Ruby file)

  6. Refresh the page

NOTE: We currently have a code-reloading issue in Sidekiq. When any Ruby file changes (like when you do touch above), the threads deadlock and when you check the process you'd eventually see something like sidekiq 5.2.9 gitlab [10 of 10 busy]. This MR does not solve the problem but it does not make it any worse. I'm planning to fix this separately.

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Heinrich Lee Yu

Merge request reports