Charcoal-SE / SmokeDetector

Headless chatbot that detects spam and posts links to it in chatrooms for quick deletion.
https://metasmoke.erwaysoftware.com
Apache License 2.0
477 stars 182 forks source link

CI is failing because cannot login to stackexchange.com #2498

Closed tripleee closed 5 years ago

tripleee commented 6 years ago

CI failures like https://circleci.com/gh/Charcoal-SE/SmokeDetector/32364?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link have been happening with irregular regularity during today.

test/test_chatcommunicate.py:78: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

username = 'shoutouts', password = 'to simpleflips', try_cookies = False

    def init(username, password, try_cookies=True):
        global _clients
        global _rooms
        global _room_data
        global _last_messages

        for site in _clients.keys():
            client = Client(site)
            logged_in = False

            if try_cookies:
                if GlobalVars.cookies is None:
                    datahandling._remove_pickle("cookies.p")
                else:
                    cookies = GlobalVars.cookies
                    try:
                        if cookies[site] is not None:
                            client.login_with_cookie(cookies[site])
                            logged_in = True
                            log('debug', 'Logged in using cached cookies')
                    except LoginError as e:
                        exc_type, exc_obj, exc_tb = sys.exc_info()
                        log('debug', 'Login error {}: {}'.format(exc_type.__name__, exc_obj))
                        log('debug', 'Falling back to credential-based login')
                        del cookies[site]
                        datahandling.dump_cookies()

            if not logged_in:
                for retry in range(3):
                    try:
                        GlobalVars.cookies[site] = client.login(username, password)
                        break
                    except Exception as e:
                        exc_type, exc_obj, exc_tb = sys.exc_info()
                        log('debug', 'Login error {}: {}'.format(exc_type.__name__, exc_obj))
                else:
>                   raise Exception("Failed to log into " + site + ", max retries exceeded")
E                   Exception: Failed to log into stackexchange.com, max retries exceeded

chatcommunicate.py:100: Exception
----------------------------- Captured stderr call -----------------------------
ArtOfCode- commented 6 years ago

This is the CAPTCHA problem again. If two builds are close enough together, they'll trigger a CAPTCHA from SE and suddenly we can't log in.

iBug commented 5 years ago

If the CAPTCHA isn't something we can solve now, we can close this issue for now - it's been worked around by aborting that very test mid-way if login fails.