[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: ruby resolv library, bind to random port permission deny



Awesome!  Thanks.  I actually figured out a workaround in my specific project, to avoid the DNS lookup.  But i’ll keep this handy for the future.

On Mar 5, 2014, at 2:23 AM, Michal Fojtik <mfojtik redhat com> wrote:

> On Wed Mar 05, 2014 at 10:53:19AM +0100, Michal Fojtik wrote:
> 
> I found a quick and dirty workaround:
> 
> In "lib/ruby/2.1.0/resolv.rb" locate this line:
> 
> 'bind_host = "0.0.0.0"'
> 
> (it should be inside initialize() for UnconnectedUDP class).
> Change it to this:
> 
> bind_host = ENV['OPENSHIFT_RUBY_IP'] || "0.0.0.0"
> 
> (replace OPENSHIFT_RUBY_IP with 'DIY' or whatever cartridge you use as
> a web framework (env | grep IP))
> 
> Now gem install will succeed.
> 
>  -- Michal
> 
>> On Tue Mar 04, 2014 at 09:50:12AM -0800, Bruce Lysik wrote:
>> 
>> Hi,
>> 
>> Bruce, thanks for reporting this issue. We know about this as this was
>> recently broken in rubygems, where gem is trying to bind on 0.0.0.0
>> which will fail inside the gear.
>> 
>> We thought the workaround would be simply replacing the 0.0.0.0 with
>> OPENSHIFT_RUBY_IP, however it leads to other problem with DNS
>> resolving then.
>> 
>>  -- Michal
>> 
>>> Hi,
>>> 
>>> Trying to setup a Ruby chat bot named ‘Lita’ on an Origin instance.  Loading the jabber adapter, the code errors out when attempting to resolve the server:
>>> 
>>> D, [2014-03-04T09:17:50.770525 #11252] DEBUG -- : RESOLVING:
>>>    _xmpp-client._tcp.XXXX.XXXX.com (SRV)
>>> /var/lib/openshift/531517a59e7f3b3f1b00000f/app-root/data/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:647:in `bind': Permission denied - bind(2) (Errno::EACCES)
>>> 	from /var/lib/openshift/531517a59e7f3b3f1b00000f/app-root/data/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/resolv.rb:647:in `bind_random_port’
>>> 
>>> The code is here:
>>> 
>>> def self.bind_random_port(udpsock, bind_host="0.0.0.0") # :nodoc:
>>>      begin
>>>        port = rangerand(1024..65535)
>>>        udpsock.bind(bind_host, port)
>>>      rescue Errno::EADDRINUSE
>>>        retry
>>>      end
>>>    end
>>> 
>>> 
>>> Is there any way I can work around this?
>>> 
>>> _______________________________________________
>>> users mailing list
>>> users lists openshift redhat com
>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>> 
>> -- 
>> 
>> _______________________________________________
>> users mailing list
>> users lists openshift redhat com
>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
> 
> -- 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]