mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 22:02:06 -06:00
[GH-ISSUE #15] Memory leak while embedding C libxlsxwriter in Ruby #12
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @eroncastro on GitHub (Dec 1, 2015).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/15
Originally assigned to: @jmcnamara on GitHub.
Hi! First of all, thank you for this wonderful lib.
I am trying to use it within my Ruby on Rails project by calling it using FFI. But, when deploying it to my production server, I am getting memory leaks that generate files which names contains some parts of the content of my .xlsx, not in the directory it was called, by in the root directory of my application.
Yesterday, I also got the problem:
[ERROR][packager.c:62]: Error opening zip file for xlsx
[ERROR][workbook.c:1108]: Memory allocation failed.
Do I have to grant writing permission recursively to the directories preceding the directory where the file is being generated? I there a way you would recommend me to simulate my production environment in order to effectively test the embedded lib?
Thanks in advance!
Eron
@jmcnamara commented on GitHub (Dec 1, 2015):
The libxlsxwriter lib creates some temporary files that are zipped/assembled into a xlsx file. It is possible that if the application fails that these temp files are left behind. Typically they are xml files.
This shouldn't be causing a memory leak though.
This is a misleading error. It is caused by not having sufficient write permission to create the output file. See the explanation in Issue #12.
Possibly. You, or your app, should be able to do something like this without getting an error:
I don't have any sure fire suggestions. Debugging write permission in a web app can be tricky.
By the way, there is a Ruby port of the original Perl module that libxlsxwriter is ported from: https://github.com/cxn03651/write_xlsx
@eroncastro commented on GitHub (Dec 1, 2015):
Thank you for answering.
I already use write_xlsx gem. The problem with it is that it consumes too much memory when exporting a large number of rows (~ 1MM), which makes my app to stop the process in order not to fall.
When I used your solution embedded with my Rails app in constant memory mode, it only consume 2% of my machine RAM and took only 30 seconds to generate my .xlsx file. I'm going to try once again and I'll report you any other issues!
Thank you again!
@jmcnamara commented on GitHub (Dec 1, 2015):
I didn't realise that the Ruby port hadn't ported the constant_memory/optimization mode. It was in the original Perl module and is in my Python and Lua versions as well.
@eroncastro commented on GitHub (Dec 1, 2015):
I used strace command to attach it to the process. The error I get is the following:
open("/var/www/app/public/exports/ff/c3/8e/ffc38ef077171f690eb01cfe8792845b/test.xlsx", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 EACCES (Permission denied)
write(2, "[ERROR][packager.c:62]: Error op"..., 56) = 56
write(2, "[ERROR][workbook.c:1108]: Memory"..., 52) = 52
write(1, "=> 1\n", 5)
I just did not realise yet what is causing this.
@jmcnamara commented on GitHub (Dec 8, 2015):
Closing this issue because it looks more like a permissions issue than a libxlsxwriter issue.
Note, the current HEAD version gives a clearer error message in this condition:
@AlfonsoUceda commented on GitHub (Jun 1, 2016):
@eroncastro do you have your wrapper open sourced?
@jmcnamara sorry if this bothers you