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

Delete ooni_home_autorun on hard reset #295

Merged
merged 2 commits into from
Jul 7, 2022
Merged

Conversation

majakomel
Copy link
Contributor

Closes ooni/probe#2071

Do we also need to stop autorun at this point?

@majakomel majakomel requested a review from hellais May 7, 2022 09:05
main/actions.js Outdated
const log = require('electron-log')
const Sentry = require('@sentry/electron')

const hardReset = () => {
const ooni = new Ooniprobe()
log.info('hardReset: performing a hard reset of the installation')
fs.removeSync(getAutorunHomeDir())
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 that what we ought to be doing is calling ooniprobe reset --force with the OONI_HOME environment variable set to getAutorunHomeDir.

That way, if there is any additional cleanup operation that needs to happen on hard reset, we can implement it inside of probe-cli directly and not have to remember to keep it in sync between the two directories.

@hellais
Copy link
Member

hellais commented May 9, 2022

Do we also need to stop autorun at this point?

I don't think we should do that. The autorun home directory will be re-created automatically the next time it runs, but it will be empty.

I guess one thing we need to think about is what is going to happen if the hard reset is executed while the autorun task is currently running.

@bassosimone
Copy link
Contributor

bassosimone commented Jun 17, 2022

@hellais wrote:

I guess one thing we need to think about is what is going to happen if the hard reset is executed while the autorun task is currently running.

Yeah, this would be an interesting scenario

Copy link
Contributor

@bassosimone bassosimone left a comment

Choose a reason for hiding this comment

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

The diff looks good to me. I have spent some time thinking about what could happen if a hard reset occurs while an autorun is running, and I don't know what could happen. 🤷

@hellais
Copy link
Member

hellais commented Jul 7, 2022

I guess the database write operations are going to fail when they are attempted.

I tried to reproduce this by running ooniprobe and deleting the home directory while it's running and got this:

   ⨯ Failed to create the network row error=unable to open database file: no such file or directory
[engine] sessionresolver: failure rate: primary: 0/3; fallback: 0/0
   ⨯ failed to run circumvention error=unable to open database file: no such file or directory

On the second run it worked fine, so I guess it's not so tragic that the running test will fail.

I think we can go ahead and merge this.

@hellais hellais merged commit d91033a into master Jul 7, 2022
@hellais hellais deleted the 2071/reset-ooni-home-autorun branch July 7, 2022 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants