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

[ci skip] Add documentation on interlock issue in Rails development mode #2540

Conversation

wildmaples
Copy link
Contributor

Description

Hello, it's my first time here! 👋

Closes #2352

The documentation is a new file docs/rails_dev_mode.md as suggested and pretty much a paraphrase/copy pasta of @earksiinni's analysis and observation.

Your checklist for this pull request

  • I have reviewed the guidelines for contributing to this repository.
  • I have added an entry to History.md if this PR fixes a bug or adds a feature. If it doesn't need an entry to HISTORY.md, I have added [changelog skip] or [ci skip] to the pull request title.
  • I have added appropriate tests if this PR fixes a bug or adds a feature.
  • My pull request is 100 lines added/removed or less so that it can be easily reviewed.
  • If this PR doesn't need tests (docs change), I added [ci skip] to the title of the PR.
  • If this closes any issues, I have added "Closes #issue" to the PR description or my commit messages.
  • I have updated the documentation accordingly.
  • All new and existing tests passed, including Rubocop. (I mean... it probs should cause this is just a documentation change)

@cjlarose
Copy link
Member

cjlarose commented Jan 27, 2021

This is good to document. Thanks for your contribution! Just a few notes worth investigating:

  • This problem isn't unique to puma. Any multithreaded web server you use to serve a Rails application will have the same problem.
  • I haven't verified this, but this is only a problem with the "classic" autoloader. I suspect this isn't a problem with zeitwerk.
  • Another workaround is probably to just remove the ActionDispatch::Reloader from the Rack middleware stack. That's the thing that prevents concurrent requests from autoloading.


#### 2. Use multiple processes on Puma

Alternatively, you may also enable multiple single-threaded workers on Puma. By doing so, you are sidestepping the problem by creating multiple processes rather than new threads. However, this workaround is not ideal because debugging tools such as [byebug](https://github.com/deivid-rodriguez/byebug/issues/487) and [pry](https://github.com/pry/pry/issues/2153), work poorly with any multi-process web server.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workaround only works if these multiple processes are only using 1 thread. If you use cluster mode with multiple threads, the lock can still occur.

@nateberkopec nateberkopec added the waiting-for-changes Waiting on changes from the requestor label Jan 28, 2021
@nateberkopec nateberkopec merged commit 05fcbad into puma:master Feb 1, 2021
JuanitoFatas pushed a commit to JuanitoFatas/puma that referenced this pull request Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs waiting-for-changes Waiting on changes from the requestor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Solution: Puma/Rails locks up when performing an HTTP request to self in Rails development mode
3 participants