Defect #5024

Internal error after clicking on link to PDF Export

Added by Sheng Wang over 7 years ago. Updated over 6 years ago.

Status:ClosedStart date:2010-03-10
Priority:NormalDue date:
Assignee:Toshi MARUYAMA% Done:

0%

Category:PDF export
Target version:-
Resolution: Affected version:

Description

Steps:
  1. browse http://www.redmine.org/issues/408
  2. Click on link to PDF Export

Error information:

Internal error

An error occurred on the page you were trying to access.
If you continue to experience problems please contact your redMine administrator for assistance.

Back

Capture.PNG (3.17 KB) David Sedlar, 2010-03-12 16:16

sl.yml.diff Magnifier - Patch for /config/locales/sl.ylm (333 Bytes) David Sedlar, 2010-03-12 16:50


Related issues

Related to Redmine - Defect #6009: When using "English (British)", the repository browser (s... Closed 2010-07-31 2010-08-19
Related to Redmine - Defect #61: Broken character encoding in pdf export Closed

History

#1 Updated by Eric Davis over 7 years ago

  • Category set to Website (redmine.org)
  • Resolution set to Cant reproduce

Works for me, can anyone else reproduce this error?

#2 Updated by Sheng Wang over 7 years ago

But I let a lot of people try it, all of them reproduct this error:

Browse this page ok.
However, a click on PDF export, first appeared a very long wait, and then throw 500 internal error.

Here are our machines Environment:
Debian           Iceweasel/3.5.8 (like Firefox/3.5.8)
Windows XP      IE6 
Windows 7       IE8

In addition, we are all from China. Could it be that character set problem?

#3 Updated by David Sedlar over 7 years ago

I can confirm this bug, although I cannot confirm it on the redmine.org page, but it happens on my 0.9.3 production version. It does NOT happen when using English language. But it does happen with certain languages.
An example is the Slovenian language. Here is some code from my sl.yml:

  ...
  general_lang_name: 'Slovenščina'
  general_csv_separator: ','
  general_csv_decimal_separator: '.'
  general_csv_encoding: ISO-8859-1
  general_pdf_encoding: ISO-8859-1
  general_first_day_of_week: '1'
  ...

The error can always be reproduced, the exact error as stated in my Redmine log is:

Processing IssuesController#show to pdf (for 10.200.100.16 at 2010-03-11 14:59:10) [GET]
  Parameters: {"format"=>"pdf", "action"=>"show", "id"=>"3", "controller"=>"issues"}

NoMethodError (private method `gsub' called for 337.794921875:Float):
  lib/redmine/export/pdf.rb:94:in `Cell'
  lib/redmine/export/pdf.rb:306:in `issue_to_pdf'
  lib/redmine/export/pdf.rb:303:in `issue_to_pdf'
  app/controllers/issues_controller.rb:119
  app/controllers/issues_controller.rb:116:in `show'

Rendering D:/Ruby/Redmine/public/500.html (500 Internal Server Error)

Any information on this?

#4 Updated by Sheng Wang over 7 years ago

  • The error can always be reprodued in redmine 0.8.7 production.
  • what is more,this error is not always occur, it will only appear in the case of the issue is too long.
  • When this error occurs, CUP will reach 100%.

#5 Updated by Sheng Wang over 7 years ago

Oh, I'm sorry.
It should be the CPU rather than the CUP

#6 Updated by David Sedlar over 7 years ago

Upon further inspection there seems to be a problem with some of the language templates and this method:

 def number_to_human_size(number, *args)

It seems the method is supposed to take a number as an argument and return the text in the appropriate human readable form (ie. 356.56 KB). But instead it somehow returns a Float insted, without converting it to human text form. Thus the methos gsub is not found for type Float.

#7 Updated by David Sedlar over 7 years ago

Forgot to mention, this only happens when there are attachments, because that is when the number_to_human_size method is called. Also on the display page this value is not converted properly using some language templates. I've attached a screenshot.

#8 Updated by David Sedlar over 7 years ago

  • % Done changed from 0 to 20

Also, this bug is now 100% reproducible on this very page (because I have added the attachment). Switch to a language that is causing the problems (ie. Slovenščina) and click on PDF export on the bottom of this page. It will reproduce the error.

#9 Updated by David Sedlar over 7 years ago

Another update:
The problem is related to some missing values in the language templates. For example the documentation for the method number_to_human_size parameters reads:

    * :precision - Sets the level of precision (defaults to 1).
    * :separator - Sets the separator between the units (defaults to ".").
    * :delimiter - Sets the thousands delimiter (defaults to "").

But these setting are missing in some templates even though they should be there, especially if these values are not the same as defaults. For example, the Slovenščina language locale has a "," separator and "." delimiter.

Adding these two setting to the sl.yml template solved my problem. I am fairly certain that other languages which are affected have the same solution:

  number: 
    format:
      separator: ','
      delimiter: '.'

I have also included a patch for the sl.ylm (Slovenščina) template.

#10 Updated by Sheng Wang over 7 years ago

Thanks for your efforts! :)
But This page (http://www.redmine.org/issues/408) has no attachments, the 500 internal error still occurs.
I think your solution is another bug, rather than I pointed out that the bug.
On this question, I also think that too long issues description lead to error occurs.

once one issue with too long description (In particular, there is a particularly long line) lead to this error,
then I split the long line issue description information into two lines, it work well.

#11 Updated by Fitz Agard over 7 years ago

I've encountered the same "defect" using redmine 0.9.3 stable with english. I can replicate on my server irrespective of the issue size or with/without attachments.

After sometime I decided to upgrade to the latest in the svn repository. I backed up my database.yml and email.yml. I wiped the location clean and performed an svn checkout. I'm now on Redmine 0.9.3.devel.3668 (MySQL) and I'm still seeing the issue. I'm now wondering if there is some configuration setting in the database (i have no idea, just guessing) that is making this happen.

I have a different server running Redmine 0.9.3.devel.3608 (MySQL) and I'm not seeing the issue there.

Thanks for looking into this.

#12 Updated by Fitz Agard over 7 years ago

Here is the output to the log:

Processing IssuesController#show to pdf (for 00.000.00.000 at 2010-04-12 12:12:04) [GET]
Parameters: {"controller"=>"issues", "action"=>"show", "id"=>"10", "format"=>"pdf"}

TypeError (can't convert String into Integer):
lib/redmine/export/pdf.rb:258:in `issue_to_pdf'
app/controllers/issues_controller.rb:123:in `block (2 levels) in show'
app/controllers/issues_controller.rb:119:in `show'
<internal:prelude>:8:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
passenger (2.2.11) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:358:in `block in handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/utils.rb:184:in `safe_fork'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:163:in `start'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:213:in `start'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:262:in `block (2 levels) in spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:256:in `block in spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:80:in `block in synchronize'
<internal:prelude>:8:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

Rendering /srv/www/vhosts/site/public/500.html (500 Internal Server Error)

#13 Updated by Sheng Wang over 7 years ago

Sheng Wang wrote:

Steps:
  1. browse http://www.redmine.org/issues/408
  2. Click on link to PDF Export

Error information:
[...]

Key points:

The browser's preferred language set to Chinese will appear in this exception.
However, the browser's preferred language set to English will not appear.

#14 Updated by Muntek Singh over 7 years ago

I am unable to reproduce using any language on trunk r3696 nor on redmine.org

#15 Updated by Sheng Wang over 7 years ago

But, once I set browser preferred language to Chinese, browse http://www.redmine.org/issues/408 , click PDF export, internal error could occur. However, set browser preferred language to english, it could not occur.

#16 Updated by Muntek Singh over 7 years ago

Ah ok, doing traditional chinese and using that exact issue #408 I am able to reproduce. Does not error with any other random issue I checked.

#17 Updated by Sheng Wang over 7 years ago

I think this is the pdf export function bug. What's more, only too long issue can lead to this exception.
I once encountered similar problems:

There is a long long issue description inline. Once I click pdf export, it occur internal error. In addition, the CPU up to 100%。
then, I split the long line issue description information into two lines, it work well.

So, I think when deal with long string , memory overflow may occur.

#18 Updated by Toshi MARUYAMA over 6 years ago

  • Assignee set to Toshi MARUYAMA

#19 Updated by Toshi MARUYAMA over 6 years ago

  • Resolution deleted (Cant reproduce)

#20 Updated by Toshi MARUYAMA over 6 years ago

  • Category changed from Website (redmine.org) to PDF export

#21 Updated by Toshi MARUYAMA over 6 years ago

sl.yml.diff has committed r4004 #6009.

#22 Updated by Toshi MARUYAMA over 6 years ago

#23 Updated by Toshi MARUYAMA over 6 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

I fixed typo UFT-8 in sl.yml at r5233 #61.

#24 Updated by Toshi MARUYAMA over 6 years ago

  • Status changed from Closed to Reopened
  • % Done changed from 20 to 0
  • Resolution deleted (Duplicate)

I confirmed #408 has error in Traditional Chinese.
We need to check after redmine.org updates 1.2.

#25 Updated by Etienne Massip over 6 years ago

Guess it is not up to date to latest stable, far from that (no subtasking support), so that could take a while =)

#26 Updated by Toshi MARUYAMA over 6 years ago

  • Status changed from Reopened to Closed

I confirmed Redmine 1.1 http://www.redmine.org/issues/408#note-48 eats CPU 100% in Traditional Chinese, and it fixed in 1.2.

#27 Updated by Sheng Wang over 6 years ago

Thank you for your hard work~

Also available in: Atom PDF