Skip to content
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

Merged
merged 2 commits into from
Nov 14, 2017

Conversation

rjarry
Copy link
Contributor

@rjarry rjarry commented Nov 8, 2017

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.

@rjarry rjarry changed the title Fix 3462 Fix UnauthorizedLogin errors during buildbot start Nov 8, 2017
@codecov
Copy link

codecov bot commented Nov 8, 2017

Codecov Report

Merging #3747 into master will increase coverage by <.01%.
The diff coverage is 88.46%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3747      +/-   ##
==========================================
+ Coverage   88.46%   88.46%   +<.01%     
==========================================
  Files         323      323              
  Lines       34036    34044       +8     
==========================================
+ Hits        30110    30118       +8     
  Misses       3926     3926
Impacted Files Coverage Δ
master/buildbot/master.py 86.19% <100%> (+0.34%) ⬆️
master/buildbot/pbmanager.py 91.96% <72.72%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01dbe64...a923162. Read the comment docs.

@rjarry rjarry force-pushed the fix-3462 branch 2 times, most recently from 4412fc0 to dadadeb Compare November 9, 2017 16:06
@rjarry
Copy link
Contributor Author

rjarry commented Nov 9, 2017

I changed the approach following @tardyp advice. It works :)

Copy link
Member

@tardyp tardyp left a 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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's another PR..

self.reconfig_active = self.reactor.seconds()
metrics.MetricCountEvent.log("loaded_config", 1)

# notify every 10 seconds that the reconfig is still going on, although
Copy link
Member

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

metrics.MetricCountEvent.log("loaded_config", 1)
yield self.doReconfig()
finally:
yield self.initLock.release()
Copy link
Member

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

@rjarry
Copy link
Contributor Author

rjarry commented Nov 10, 2017

This should look better now. I added a newsfragment and a simple unit test for pbmanager.

@rjarry
Copy link
Contributor Author

rjarry commented Nov 10, 2017

BTW, the smoke tests failed but it looks unrelated to these changes:

...
error An unexpected error occurred: "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz: ENOENT: no such file or directory, utime '/home/buildbot/.cache/yarn/v1/npm-async-1.5.2-ec6a61ae56480c0c3cb241c95618e20892f9672a/README.md'".
info If you think this is a bug, please open a bug report with the information provided in "/buildbot/buildbot-job/build/www/waterfall_view/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Running command: /buildbot/buildbot-job/build/www/waterfall_view/node_modules/.bin/gulp prod --notests
error An unexpected error occurred: "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz: EEXIST: file already exists, mkdir '/home/buildbot/.cache/yarn/v1/npm-async-1.5.2-ec6a61ae56480c0c3cb241c95618e20892f9672a'".
...

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`).
Copy link
Member

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`)

Copy link
Contributor Author

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>
@tardyp tardyp merged commit aeaeb38 into buildbot:master Nov 14, 2017
@rjarry
Copy link
Contributor Author

rjarry commented Nov 14, 2017

thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants