Open samhendley opened 14 years ago
Hi Macks, I do suffer the same problem. I'm using it in Rails 3, and there is loads of require magic going on, everything works fine, but deployed application is raising TagCollisionError. I tried locally to re-require my protobuf models, and indeed they are raising this exception.
I am also having this problem. Using Rails3/Ruby 1.8.7 when classes are not cached it appears it re-requires the pb.rb which causes a collision:
/Library/Ruby/Gems/1.8/gems/ruby_protobuf-0.4.9/lib/protobuf/message/message.rb:43:in `define_field': Field tag 1 has already been used in NameSpace::Object. (Protobuf::TagCollisionError)
I've tried to fix this bug with that commit : https://github.com/vivrass/ruby-protobuf/commit/862aed177921b1fc235b668a46d5c79d36b00d06
After trying my fix, I saw that was not the problem in my application so I cannot confirm that it is working. You can try it to verify if you want.
Has anyone tried @vivrass's suggested fix?
Hi Macks, I mentioned an issue in my pull request. This error has been present for a while but is really pronounced in the eval() done to verify that the file created is able to be loaded. Basically the protobuf classes are not tolerant of being re-required.
http://gist.github.com/407742
What I think it should do is probably throw away the old definition if it is re-required but I wanted to get your opinion and input on the cleanest way to do that rather than go in with a machete myself.