wicked_pdf icon indicating copy to clipboard operation
wicked_pdf copied to clipboard

PdfHelper hangs the action_dispatch/journey/router

Open andynu opened this issue 4 years ago • 0 comments

Issue description

Including both wicked_pdf and view_component gems in a project hangs the router.

#<Thread:0x000055680984f6e0@puma threadpool 001@/home/andy/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-4.3.3/lib/puma/thread_pool.rb:89 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
/home/andy/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/actionpack-6.0.3/lib/action_dispatch/journey/router.rb:32:in `each': machine stack overflow in critical region (fatal)

Both libraries monkey patch the render method. view_component's monkey patch is going to be included in Rails 6.1 and enables the passing of objects to the rails render method. So this may also be a preview of issues that may be coming for this project along with rails 6.1.

Repro steps.

Example repository: https://github.com/andynu/wicked_pdf-view_component_bug

  1. Checkout example project git clone [email protected]:andynu/wicked_pdf-view_component_bug.git
  2. Run bundle && bin/rails server
  3. Visit https://localhost:3000

Expected or desired behavior

That it does not hang the router.

Proximate cause

Removing the PdfHelper include/prepends fixes the issue.

Since I'm not using the Railtie integration, I love the idea of adding config options to disable these inclusions (as put forth in #818)

System specifications

  • Ubuntu 19.10

  • ruby 2.6.5 (it also happens in ruby 2.7.0)

  • rails (6.0.3)

  • view_component (2.5.1)

  • wicked_pdf (2.0.2)

andynu avatar May 06 '20 19:05 andynu