3170: RBTools: A critical bug for handling P4Proxy

eyu****@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
Jan. 17, 2014
What version are you running?
RBTools 0.5.2

We have multiple sites in our company where each site has a local proxy set up for central Perforce servers. This means the proxy server has a hostname and an IP address whereas the central Perforce server has a different hostname and a different IP address.

In PerforceClient() in rbtools/clients/perforce.py, your code tries to construct the actual repository_path by the lookup result from socket.gethostbyaddr(). This is incorrect *unless* we also register the proxy server in Review Board's repository table.

This following code should be commented out to make things work:

182             info = socket.gethostbyaddr(hostname)                               
183                                                                                 
184             # If aliases exist for hostname, create a list of alias:port        
185             # strings for repository_path.                                      
186             if info[1]:                                                         
187                 servers = [info[0]] + info[1]                                   
188                 repository_path = ["%s:%s" % (server, port)                     
189                                    for server in servers]                       
190             else:                                                               
191                 repository_path = "%s:%s" % (info[0], port)           

Following is my debugging info:

/mts/home1/wange/devel/bin/reviewboard/rbtools/lib/python2.6/site-packages/rbtools/clients/perforce.py(182)get_repository_info()
(Pdb) hostname
'perforce-server.....com'
(Pdb) socket.gethostbyaddr(hostname)
('perforce-proxy-server....com', [], ['10.17.193.71']) 

We only register perforce-server....com in Review Board, this will cause local users who interact with perforce-proxy-server....com not able to post-review.

If you need detailed debugging information, I can send you offline emails.

Thanks
/Eric
chipx86
#1 chipx86
We can't delete that code, as other companies depend on it, but what we should probably do is make sure that 'hostname' is first in the the list of repository paths. That way, it'll be included in the lookup.

Can you try that on your end? Just do:

    servers = [hostname, info[0]] + info[1]

I believe that'll work.

We're doing an RBTools release later today, so if you can verify that, we'll get it into the release.
  • +NeedInfo
  • +Component-RBTools
chipx86
#2 chipx86
Actually, let me get you a more detailed patch to try.
chipx86
#3 chipx86
Apply this patch and see if things work better.
chipx86
#4 chipx86
This was fixed in 0.5.3.
  • -NeedInfo
    +Fixed
  • +chipx86