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

Aborting worker is not working #762

Closed
saganshul opened this issue Oct 10, 2016 · 11 comments
Closed

Aborting worker is not working #762

saganshul opened this issue Oct 10, 2016 · 11 comments

Comments

@saganshul
Copy link
Contributor

Aborting worker on worker panel is not working.
Link to screenvideo:
https://www.dropbox.com/s/90atwivjpkhzfkq/out.mp4?dl=0

Expected Behavior

It should stop the current job.

Your Environment

  • Installation method used: python install/install.py
  • Version/branch used: Develop
  • Operating System and version (like Kali, Debian, ArchLinux, etc): Ubuntu 16.04
  • pip/setuptools version: 8.1.2
  • sudo access: Yes
@DarKnight24
Copy link
Contributor

@saganshul I am not able to reproduce the same.

@saganshul
Copy link
Contributor Author

@DarKnight24 , try to test on plugin which takes time to run and try to abort the same.

@viyatb
Copy link
Member

viyatb commented Dec 29, 2016

@saganshul @DarKnight24 the request to kill the worker is sent successfully but sometimes the worker does not die immediately. Need to check the function in https://github.com/owtf/owtf/blob/develop/framework/plugin/worker_manager.py#L242.

@viyatb viyatb added this to the OWTF 2.0 "Tikka Masala" milestone Jan 16, 2017
@jack17529
Copy link

I am working on this issue can someone please tell me what's the meaning of -
return True in [worker['busy'] for worker in self.workers]
https://github.com/owtf/owtf/blob/develop/framework/plugin/worker_manager.py#L141

@viyatb
Copy link
Member

viyatb commented Jan 25, 2017

@jack17529 self.workers is a list of workers. The line for worker in self.workers iterates over every worker in that list and gets the status of the worker using worker['busy']. The function returns True if any worker is 'busy'.

The idiom used is a list comprehension - it is a syntactic way to write:

status = []
for worker in self.workers:
    status.append(worker['busy'])
return True in status

@jack17529
Copy link

Thank you @delta24

@DePierre DePierre added the Bug label Jan 26, 2017
@jack17529
Copy link

jack17529 commented Jan 26, 2017

Can someone explain meaning of "NA" in self.workers[k]["start_time"] = "NA" in context to code.
https://github.com/owtf/owtf/blob/develop/framework/plugin/worker_manager.py#L119

and also- del self.workers[pseudo_index - 1] in context to the code.
https://github.com/owtf/owtf/blob/develop/framework/plugin/worker_manager.py#L252

@DePierre
Copy link
Contributor

DePierre commented Jan 27, 2017

@jack17529 I would assume that 'NA' is a start_time error value used when the worker is idling. Since start_time cannot have any meaningful value if the worker is not working, 'NA' is used instead.

About your second question, you can get more meaning by running git grep delete_worker. You'll see that the pseudo_index refers to the index provided via the REST API. When the user clicks on the red cross to delete a worker, the URL /api/workers/<id>/abort is fetched. This API will then call delete_worker(<id>) (therefore corresponding to pseudo_index, -1 to have the index starting from 0 and not 1). Then, as explained in the docstring, it Remove it from self.workers so that is is not restarted by manager cron.

Do you need more information? We'll be happy to give you more details ;)

@jack17529
Copy link

jack17529 commented Feb 20, 2017

@delta24 I have already looked all the code ,can't find any problem with code. But I think can be a problem related to the api used.What to do now ?
furthermore can you provide your email please.

@DePierre
Copy link
Contributor

@jack17529 I am not convinced that the API is at fault here and I would find it more likely that the issue is in our multiprocess system.

It is possible that the worker_manager.py is not the culprit here. Because a worker can run a shell command (to run w3af for instance), it is possible that when trying to send a SIGINT the worker does not receive it because w3af is freezing.

@viyatb viyatb removed this from the OWTF 2.1 "Chicken Korma" milestone Aug 27, 2017
@viyatb
Copy link
Member

viyatb commented Oct 22, 2017

Resolved by 2b2bd22.

@viyatb viyatb closed this as completed Oct 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants