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

RJB + PdfWriter Freezes Passenger #223

Closed
FooBarWidget opened this issue May 29, 2014 · 5 comments
Closed

RJB + PdfWriter Freezes Passenger #223

FooBarWidget opened this issue May 29, 2014 · 5 comments

Comments

@FooBarWidget
Copy link
Member

From stephen%[email protected] on August 15, 2008 17:43:36

What steps will reproduce the problem? temp_file = Tempfile.new("some_name", RAILS_TMP)
temp_file.close

document = PdfDocument.new_with_sig('Lcom.lowagie.text.Rectangle;',
PageSize.LETTER)
output_file = FileOutputStream.new_with_sig('Ljava.lang.String;',
temp_file.path)
writer = PdfWriter.getInstance(document, output_file) What is the expected output? What do you see instead? This works correctly under Mongrel, but using Passenger, the last line just
hangs. The Passenger process just runs forever. What version of the product are you using? On what operating system? Ubuntu Hardy Heron 32-bit
Apache 2.2.8 (from Repository)
Passenger 2.0.3
Ruby Enterprise 1.8.6 (2008-08-08 patchlevel 286)
iText 2.1.3
RJB 1.1.4 Please provide any additional information below. RAILS_TMP = File.join(RAILS_ROOT, 'tmp')

Original issue: http://code.google.com/p/phusion-passenger/issues/detail?id=122

@FooBarWidget
Copy link
Member Author

From stephen%[email protected] on August 18, 2008 10:02:24

I've created a GitHub repository that holds a simple application that will cause this
problem. http://github.com/stack/passenger-freeze Just run the app with Passenger and click the 'Generate!' link. The application will
freeze.

@FooBarWidget
Copy link
Member Author

From honglilai on August 18, 2008 10:09:48

I get "uninitialized constant TestController::Document" when I run it in Mongrel. Did
you forget to add a model file?

@FooBarWidget
Copy link
Member Author

From honglilai on August 18, 2008 10:19:10

Never mind, that was caused by me not having rjb installed.

This problem is caused by the fact that you're using Java inside your Rails
application. The JVM is not fork-friendly and thus isn't compatible with smart
spawning. Set "RailsSpawnMethod conservative" (see manual) and you'll be fine.

Status: Invalid

@FooBarWidget
Copy link
Member Author

From stephen%[email protected] on August 18, 2008 11:04:37

Yep, that did it. Thanks. Any chance of this being fixed in the future?

@FooBarWidget
Copy link
Member Author

From honglilai on August 18, 2008 11:25:39

This cannot be fixed. The JVM is fundamentally incompatible with smart spawning.

The only way to make it compatible is to fix things at the application level. E.g. by
outsourcing your Java stuff to an external DRb process, or by using autoloading so
that the JVM is loaded after the fork, or things like that.

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

1 participant