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

Selenium processes are not terminated when the importer raises an exception #2

Open
everett-tesobe opened this issue Dec 6, 2012 · 0 comments
Assignees

Comments

@everett-tesobe
Copy link
Contributor

In main.py we have:

while True:
    try:
        transactions_to_obp(login_data[0], login_data[1])
        # TODO: Need another exception for not getting the CSV File.
        # wait 10 minutes
        sleep(10 * 60)

    except KeyboardInterrupt:
            obp_logger.critical("KeyboardInterrupt!")
            obp_logger.critical("Caught Ctrl-C from user")
            raise
    except Exception, e:
        # TODO: need a cleanup as well, just to be sure no sensitive data left on the disk.
        obp_logger.error("Something went wrong")
        obp_logger.error("Error is:\n%s" % e)
        obp_logger.error("restart in 60 seconds")
        print "%s:Something went wrong" % libs.import_helper.date_now_formatted()
        print "%s:Error is:\n%s" % (libs.import_helper.date_now_formatted(), e)
        # When something went wrong wait 1 minute.
        sleep(60)

When an exception is caught, the selenium process created in transactions_to_obp is never shut down, which can result in the creation of more and more selenium processes if the exception occurs again on the next run of transactions_to_obp, eventually crashing the server. A finally clause that could shut selenium down seems like it would fix this.

@ghost ghost assigned tgpfeiffer Dec 6, 2012
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

No branches or pull requests

2 participants