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 =
			t.vendor_name, t.vendor_id =, vendor.vid
			t.field_name = product_vals[column]
			for k,v in $rules do
				if (k == t)
					found_matching_rule +=1
					x =
					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
			column += 1
		line_number += 1

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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

This bug was heavily reported back in 2008 on 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.
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?
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

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 :)

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
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 :=)
zaidmarjiAuthor Commented:
no solution found so changed the code in question
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

From novice to tech pro — start learning today.