-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UnauthorizedLogin errors during buildbot start #3747
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3747 +/- ##
==========================================
+ Coverage 88.46% 88.46% +<.01%
==========================================
Files 323 323
Lines 34036 34044 +8
==========================================
+ Hits 30110 30118 +8
Misses 3926 3926
Continue to review full report at Codecov.
|
4412fc0
to
dadadeb
Compare
I changed the approach following @tardyp advice. It works :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need newsfragment.
Would be good to make at least one unit test for pbmanager
delimiter = unicode2bytes(os.linesep) | ||
|
||
def __init__(self, logfile): | ||
def __init__(self, logfile, timeout_delay=10.0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's another PR..
master/buildbot/master.py
Outdated
self.reconfig_active = self.reactor.seconds() | ||
metrics.MetricCountEvent.log("loaded_config", 1) | ||
|
||
# notify every 10 seconds that the reconfig is still going on, although |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should still keep the long reconfig warning timer.
Also, if you send 10 SIGHUP in a row, you'll get 10 reconfig, while the previous implementation, only 2
master/buildbot/master.py
Outdated
metrics.MetricCountEvent.log("loaded_config", 1) | ||
yield self.doReconfig() | ||
finally: | ||
yield self.initLock.release() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe the better implementation is to just keep reconfig as is, and to change doReconfig to take the lock
This should look better now. I added a newsfragment and a simple unit test for pbmanager. |
BTW, the smoke tests failed but it looks unrelated to these changes:
|
Use a twisted DeferredLock to avoid concurrent reconfigs (or reconfig while the server is starting up). This will allow for other services to wait until the master is ready before doing certain actions. Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
@@ -0,0 +1 @@ | |||
Fixed UnauthorizedLogin errors during buildbot restart. Fixes (:issue:`3462`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think warn here that there is a new lock.
Worker authentication is now delayed via a DeferredLock until Buildbot configuration is finished. This fixes UnauthorizedLogin errors during buildbot restart (:issue:`3462`)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the news fragment accordingly 👍
When restarting the master with connected workers, as soon as the TCP port is open, the said workers will try to reconnect. This may happen before all workers have been registered (user+password) into the pbmanager. When that happens, we see (non fatal) errors such as follows appear in twistd.log: 2017-11-09 11:50:14+0100 [Broker,0,1.1.0.1] invalid login from unknown user 'bot1' 2017-11-09 11:50:14+0100 [Broker,0,1.1.0.1] Peer will receive following PB traceback: 2017-11-09 11:50:14+0100 [Broker,0,1.1.0.1] Unhandled Error twisted.cred.error.UnauthorizedLogin: Fix the problem by waiting for the master to be fully configured before trying to authenticate anyone. Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
thanks :) |
This should fix issue #3462.
I did not add any news fragments for now. I'd like some feedback on whether this is the correct way to go or if I have it all backwards.