Project

General

Profile

Actions

Defect #23962

open

Redmine Out of Memory Exception when exporting issues with lots of columns (> 50) to PDF

Added by Stephane Evr over 7 years ago. Updated about 6 years ago.

Status:
New
Priority:
High
Assignee:
-
Category:
PDF export
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

I was able to reproduce the bug descibed hereafter on a bitnami vanilla redmine install. This bug makes the server eventually run out of memory, so is quite severe in my opinion.

Environment:
  Redmine version                3.3.0.stable
  Ruby version                   2.1.10-p492 (2016-04-01) [x86_64-linux]
  Rails version                  4.2.6
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.9.4
  Cvs                            1.12.13
  Git                            2.7.4
  Filesystem                     
Redmine plugins:
  no plugin installed

The bug occurs when trying to export to pdf a list of issues (on the issues page) with a huge amount of columns (around 50 or more). It happens even if there is only 1 issue to export.

To reproduce the bug, you can create around 40 custom fields with a random name (30 chars) / format and assign them to a tracker / project. then create an issue with random content in the fields. Then on the issues page, export to pdf with all columns included.

Because anyway the pdf would not look nice with such big amount of columns, we could perhaps forbid the export if there are too many columns (lets say > 40) selected in the export.

This is what I added to mitigate the error, in app/controllers/issues_controller.rb#index:

if params[:format] == 'pdf' && @query.column_names.count > 40
  redirect_to(:back)
  flash[:error] = "Please reduce the amount of columns selected." 
  return
end

After further investigation, I found the problem to be located in lib/redmine/export/pdf.rb, in the RDMMultiCell method. So it may be due to RBPDF...


Related issues

Has duplicate Redmine - Defect #28337: Problem when creating PDF with too many columnsClosed

Actions
Actions #1

Updated by Toshi MARUYAMA over 7 years ago

  • Description updated (diff)
Actions #2

Updated by Toshi MARUYAMA over 7 years ago

  • Category set to PDF export
Actions #3

Updated by Toshi MARUYAMA over 7 years ago

  • Affected version set to 3.3.0
Actions #4

Updated by Marius BÄ‚LTEANU about 6 years ago

  • Has duplicate Defect #28337: Problem when creating PDF with too many columns added
Actions #5

Updated by Jun NAITOH about 6 years ago

I could not reproduce this problem.

The procedure I did is as follows. :
  1. Create 1 issue with custom field.
  2. app/models/custom_field.rb "attr_protected :id" comment out.
    http://www.redmine.org/projects/redmine/repository/entry/tags/3.4.4/app/models/custom_field.rb#L38
  3. Redmine Restart : touch tmp/restart.txt
  4. Create many issue custom fields
    You can use this command in the console: (1..60).each { |i| CustomField.new(IssueCustomField.last.attributes.merge!({id:nil,name:"testooooooooooooooooooooooo-#{i}", is_for_all: true})).save }
  5. Go to /issues page
  6. Choose to display every columns and apply the filter
  7. Try to export to PDF
$ ruby bin/about

sh: darcs: command not found
sh: bzr: command not found
Environment:
  Redmine version                3.4.4.stable
  Ruby version                   2.1.2-p95 (2014-05-08) [i686-linux]
  Rails version                  4.2.8
  Environment                    production
  Database adapter               SQLite
SCM:
  Subversion                     1.6.11
  Mercurial                      1.4
  Git                            1.7.12.4
  Filesystem                     
Redmine plugins:
  no plugin installed
Actions

Also available in: Atom PDF