knu/ruby-domain_name — pull request #2 by Agiley (2012-03-18 15:00:51+00:00)
Title: Running DomainName multi-threaded leads to Stack Errors

I'm running Mechanize (https://github.com/tenderlove/mechanize) multi-threaded using Sidekiq (https://github.com/mperham/sidekiq).

Mechanize pulls in the DomainName-gem to handle (for example) parsing of cookie domain names. Apparently due to the large size (~4000 items) of the hash in lib/domain_name/etld_data.rb a stack error occurred. This does not happen when in single-threaded mode though.

Changing the hash to be first instantiated and then adding the respective hash items seems to solve it.

The tests pass on 1.9.3-p125 and 1.9.-p290. If necessary I can see if I can set up a sample Rails-app with Mechanize/Sidekiq so you can reproduce the issue yourself.