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

strange conflict with -rails- irb seemingly #8

Closed
fringd opened this issue Aug 13, 2012 · 14 comments
Closed

strange conflict with -rails- irb seemingly #8

fringd opened this issue Aug 13, 2012 · 14 comments

Comments

@fringd
Copy link

fringd commented Aug 13, 2012

Calling Spreadsheet.open works fine in a simple ruby script, but blows up my machine and (seemingly) never finishes when i try to use it in my rails app. Also blows up in a newly minted rails app that just has gem 'spreadsheet' added

Any guesses as to what might cause this? Core extensions maybe? Is there anything I can do to help debug this problem?

Thinking to just create a separate service to handle xls files, but would be easier to integrate it and access all my existing models and helpers, etc...

@fringd
Copy link
Author

fringd commented Aug 13, 2012

So it seems that there is a problem not with rails, but with irb

to reproduce

irb
> require 'spreadsheet'
> Spreadsheet.open 'my_file.xls'

does anybody else have this problem with their files?

same problem with pry. eats up gigabytes of memory and grows and grows

@fringd
Copy link
Author

fringd commented Aug 13, 2012

OKAY, so my real problem is that Workbook cannot be nicely printed...

> book = Spreadsheet.open 'my_file.xls';nil
=> nil

works fine, but then

> book

again waits forever...
there's some sort of infinite loop in the inspection code...

@fringd
Copy link
Author

fringd commented Aug 13, 2012

the culprit seems to be that workbook#inspect loops over all its instance variables, and so does worksheet.... does worksheet keep a reference back to workbook somewhere?

@zdavatz
Copy link
Owner

zdavatz commented Dec 1, 2012

How was the file "my_file.xls" created? Did you create that file with MS Office, LibreOffice or with spreadsheet?

@victor-ono
Copy link

I have the same problem with memory in irb under Ruby 1.9.3. No problem under 1.8.7

@zdavatz
Copy link
Owner

zdavatz commented Dec 29, 2012

interesting.

@BiggerNoise
Copy link

Ditto. Same problem under irb, ruby 1.9.3 (installed from RVM if that matters).

@zdavatz
Copy link
Owner

zdavatz commented Jan 22, 2013

BiggerNoise: What is your sample code? What are you trying to do?

@BiggerNoise
Copy link

Sample is:

require 'spreadsheet'
wb = Spreadsheet.open('./tmp/analysis.summary.xls')

If I try and run this under irb, it will exhaust the memory on my machine (starting from ~8GiB).

However, if I just put this in a script, it will run fine. I am able to see the worksheets and get row and column counts.

As far as what I am trying to accomplish, my ultimate goal is to take the spreadsheet that this analysis program produces and import it into my rails application. I may need to jump through some hoops to make that happen in a reasonably performant way, but the first step will be reading the spreadsheet.

Let me know if that answers your questions.

@zdavatz
Copy link
Owner

zdavatz commented Jan 23, 2013

Yes, it does answer my question. I do not know why irb is exhausting your memory. Are you on Linux or Windows or Mac?

@BiggerNoise
Copy link

I am running Mac (10.7). And, if it helps:

andy@Andy-MBP:Crucible $ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

I did follow the advice that I found elsewhere and shutdown irb's inspection of the workbook:

wb = Spreadsheet.open('./tmp/analysis.summary.xls'); nil

That allows me to work in irb.

@zdavatz
Copy link
Owner

zdavatz commented Jan 23, 2013

Awesome! Can you post analysis.summary.xls somewhere please and link it here.

@BiggerNoise
Copy link

I am trying to make a spreadsheet where I can reproduce the problem. Unfortunately, I can't post the one that is actually giving me grief. I will see what I can do and get back to you.

@zdavatz
Copy link
Owner

zdavatz commented Jan 26, 2013

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

4 participants