-
Notifications
You must be signed in to change notification settings - Fork 648
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
Thread puma threadpool terminated with exception machine stack overflow in critical region (fatal) #891
Comments
The actual code changes between 1.4.0 and 2.0.1 are pretty small, and I suspect this issue may have to do with a conflict with some other gem that hooks into Please read this comment and look at the diff to see what I'm talking about. I'm curious why this affects CI, but not development. Is CI running the same version of Ruby you develop with? Does it precompile assets, where maybe you don't locally? |
Interesting, yeah I didn't see that comment. Let me dive back into this and I'll get back to you. Thanks for some direction 👍 Yes we are using the same ruby locally, on CI and on our production servers. Yes we do have |
Ok @unixmonkey I had some more time this avo to debug this. I forked this gem and made this change darrenterhune@ccc8615 and it's now working and passing CI. I just wanted to make sure this comment was true https://github.com/mileszs/wicked_pdf/pull/869/files#r386040878 I also found this where some people are saying having We just need to 🔪 |
Yep. Thanks for confirming that. I'm working on a replacement system that avoids any kind of conflict, but I suspect that won't be released for a while either. You might be better off using your fork or monkey-patching the initializer as a no-op, and including/prepending in the controllers you need it in until then. |
hey, could you elaborate on the way to quick fix this issue : "monkey-patching the initializer as a no-op, and including/prepending in the controllers you need it in until then", while waiting for the next release. i just added rails_admin and I have the same issue as @darrenterhune . |
@Jeremie1707 I tried to quickly setup an app to reproduce this, and was not able to. I looked through the commits of rails_admin and see they recently made some updates to improve compatibility with the zeitwerk loader, so maybe it's better now? You could try upgrading rails_admin and remotipart with: bundle update rails_admin remotipart And try again. Another thing that might help and be minimally invasive is to defer requiring wicked_pdf until railties are booted, and your app initializers run. You can do this by editing gem 'wicked_pdf', require: false Then requiring wicked_pdf before it's needed in the initializer: require 'wicked_pdf'
WickedPdf.config = {
exe_path: '/usr/local/bin/wkhtmltopdf'
} Then only in the controllers it's needed, add the PDF helpers: class MyController < ApplicationController
prepend WickedPdf::PdfHelper
include WickedPdf::WickedPdfHelper::Assets
def show
end
end Or, you can use @darrenterhune 's fork by just changing out your gem 'wicked_pdf', git: 'https://github.com/darrenterhune/wicked_pdf' Please let me know what you end up doing and what worked or not. |
@Jeremie1707 I'd advise against my branch just because I'm not supporting it if there are issues etc. That said it did work for us. However we simply downgraded |
Just bumped this gem again. Deferring works but without it, it doesn't work on CI. I have to either use the 1.4 version, defer or use my branch. We've since switched to just deferring since we currently only use this in 1 controller and 1 action in that controller. Adding to |
@darrenterhune, @unixmonkey I had the same issue adding the view_component gem (has a monkey patch on the render) and @Okatawa's patch (#919) worked for me. @darrenterhune can you give it a try? Maybe it's the same issue. |
I got "fatal - exception reentered" error and stuck on loading when showing my rails home page, even the controller/view don't call to generate/display PDF. Basically, whenever I installed the wicked_pdf gem v2.x above version (just adding to Gemfile, nothing else), the error showed; but, if installed wicked_pdf v 1.4.0 , the error goes away. My setup: After applying @unixmonkey 's comment above, by using the following forked gem, my error goes away.
Hope this helps to someone. |
I see the same error: fatal - machine stack overflow in critical region Setup: I've use version 1.4 of wicked_pdf and no issues at all. Whenever I upgrade to latest this bug shows up and keeps me from upgrading. |
Does anyone in this thread can reliably reproduce this bug? I'm also facing it, but only randomly. Nate Berkopec, a Puma maintainer, is looking into this on puma/puma#2552, but he also can't reproduce the "fatal - machine stack overflow in critical region" error. Please report in that issue if you can help. |
@feliperaul did you solve it ? i have the same problem !!! |
@almokhtarbr Nope, and I can't even reproduce it, it's totally random (every once 15 days for us). For now I have switched to PDFKit, the APIs are very similar. |
@feliperaul the same thing really weird, thanks for suggestion |
I am able to reliably get the I encountered it when trying to add Scout APM to our app. I tried wicked_pdf >= 2.0 and they all have the problem. I downgraded to wicked_pdf 1.4 and the error does not exist. |
I was experiencing :
I've added further details to #111 (comment) |
After encountering the #810 issue....
|
Have you tried using the master branch of wicked_pdf rather than the latest version? |
Issue appears resolved with master branch 5cee578 At least CI is happy, I have not test deployed but should be alright. |
@davegudge any plan on making a new release ? |
Hey @mathieujobin, I do not have permission to create a new release, however, @unixmonkey may be able to indicate when a new version is planned for release? |
Issue description
Our CI server is having a problem with the recent major bump to 2.0. Locally we are fine and pdf's work. If I downgrade to 1.4.0 our CI is fine.
Seems this was also an issue in the past: https://stackoverflow.com/questions/55280153/machine-stack-overflow-in-critical-region-fatal
#810
https://github.com/puma/puma/blob/master/lib/puma/thread_pool.rb#L89
https://github.com/rack/rack/blob/master/lib/rack/urlmap.rb#L58
Expected or desired behavior
CI runs and passes
System specifications
wicked_pdf 2.0.1
wkhtmltopdf-binary-edge 0.12.4.0 because of pallymore/wkhtmltopdf-binary-edge#15 and extra build config just to get it to work so we locked it
Ubuntu 16.04
ruby 2.6.5
rails 6.0.2.1
The text was updated successfully, but these errors were encountered: