From: John Stoffel Date: 2009-02-19T23:33:25+09:00 Subject: Re: Quieting DRb messages in fork() code James M. Lawrence wrote: > John Stoffel wrote: >> Hi, >> >> I've got some code which seems to work well, but the warning messages >> are driving me insane! I can't use this code if it's always going to >> spew warnings like these on a CentOS 5.2 system with ruby 1.8.5 >> (2006-08-25) [i386-linux] as the environment. I'm also using >> slave-1.2.1 from http://www.codeforpeople.com >> as well. >> >> >> $ ./readdir-slave-only.rb --kids 4 tmp >> Starting Slave Counter >> Exception `DRb::DRbBadScheme' at /usr/lib/ruby/1.8/drb/drb.rb:814 - >> drbunix:///tmp/slave_counter_537520870_11835_11836_0_0.697410256497375 >> Exception `DRb::DRbBadScheme' at /usr/lib/ruby/1.8/drb/drb.rb:814 - >> drbunix:///tmp/slave_counter_537520870_11835_11836_0_0.697410256497375 > > The exception is "normal" insofar as being expected behavior from DRb. > It tries each loaded protocol until it finds a match, rescuing the > non-matches. > > You are seeing these messages because you have $DEBUG=true. If you are > determined to avoid them in the presence of $DEBUG then you could put a > preferred protocol at the beginning of the search list. > > module DRb::DRbProtocol > module_function > def prefer_protocol(proto) > @protocol.delete(proto) > @protocol.unshift(proto) > end > end > > DRb::DRbProtocol.prefer_protocol(DRb::DRbUNIXSocket) Duh, I feel like a fool now. I had forgotten about the $DEBUG setting (my mistake for burying it down low...) and now that I've turned it off, it's much better! Now I can address my remaining issues with the code and final cleanup. I would have hoped that DRb would have a DRb::DEBUG value instead, or at least something in the documentation which talks about this more since I was going nuts trying to figure out why it was so darn noisy. This is a huge hug help, thanks! John -- Posted via http://www.ruby-forum.com/.