Defect #23962
openRedmine Out of Memory Exception when exporting issues with lots of columns (> 50) to PDF
0%
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
Updated by Marius BÄ‚LTEANU almost 7 years ago
- Has duplicate Defect #28337: Problem when creating PDF with too many columns added
Updated by Jun NAITOH over 6 years ago
I could not reproduce this problem.
The procedure I did is as follows. :- Create 1 issue with custom field.
- 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 - Redmine Restart : touch tmp/restart.txt
- 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 } - Go to /issues page
- Choose to display every columns and apply the filter
- 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