Issue with Ruby script

Hi Folks,

I just inherited a ruby script that I'm trying to get to run. It goes through a couple of files and tries to match rules in one file to columns in the other file I'm coming across an issue where I get the following error

C:/Ruby187/lib/ruby/1.8/ostruct.rb:83: [BUG] object allocation during garbage collection phase
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]

Here is the piece of code it is failing on
	for line in product_lines do
		tiebreaker_columns.current_row = line.strip.split("\t")
		tiebreaker_columns.current_line_number = line_number

		vendor = compose_tie_breaker(tiebreaker_columns)
		column = 0
		att_count = 0
		for item in tiebreaker_columns.current_row do
			t = OpenStruct.new
			t.vendor_name, t.vendor_id = vendor.name, vendor.vid
			t.field_name = product_vals[column]
			for k,v in $rules do
				if (k == t)
					found_matching_rule +=1
					x = OpenStruct.new
					x.vid = vendor.vid.to_s().strip
					x.row_id = line_number.to_s().strip
					x.attribute_type = v.our_type.to_s().strip
					x.attribute_name = v.our_field_name.to_s().gsub("'","''").strip
					$attributes[x] = item.to_s().gsub("'","''").strip
				end
				att_count+=1
			end
			column += 1
		end
		line_number += 1
	end

Open in new window


it breaks in the most inner loop. Any idea on why this might be happening?

Thanks your help is very much appreciated.

zaidmarjiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JESiiCommented:
This bug was heavily reported back in 2008 on ruby-forum.org and there were some indications that it might be due to problems with a gem. I see that you're running this on windows with the latest version of Ruby 1.8.7...

Couple of suggestions:
1. Do you have the latest version of the gems you are using? If not, you could try updating them.
2. Maybe you could try upgrading to the latest Ruby version - 1.9.2? It certainly is stable and is the way to go for the future. Only problem is, there were some changes in some of the language syntax, so that might not work out of the box for you.
0
zaidmarjiAuthor Commented:
@ JESii

Thanks I actually upgraded to 1.9.2 to try and see if it would work. The only problem I'm facing right now is trying to connect this to a MS Sql database. With 1.8.7 I could you dbd-odbc, but I dont see they have a version for 1.9.2 that runs on Windows. Any ideas?
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

zaidmarjiAuthor Commented:
we had to simplify our code substantially, and move all the heavy lifting to the database. Which enabled us to  use 1.8.x once more. the fun of trying to make all these technologies together.

Thanks for the help :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JESiiCommented:
You're welcome; I'm sorry to hear that as I'm developing a rails app to go against MS SQL Server and I'm hoping to use 1.9.2... we'll see how much "fun" I can have :=)
0
zaidmarjiAuthor Commented:
no solution found so changed the code in question
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Ruby

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.