niccokunzmann / python_dhcp_server

a dhcp server in python
MIT License
91 stars 32 forks source link

DelayWorker keeping server alive #7

Closed vitormhenrique closed 5 years ago

vitormhenrique commented 5 years ago

Hello,

I'm using your code to create a dhcp server but I'm running on a problem... It's been a while since you don't change this source code so I don't know if you are going to see this...

but the issue is the following, after creating the server object the DelayWorker is inited and generate a thread with a priority queue to run... but if I try to stop the server calling the .close command, setting the delayworker to closed is not releasing that thread, making the code "locked" on a state that it's only possible by sending and singint to the program (ctrl + c)

Do you have any idea how to fix this?

vitormhenrique commented 5 years ago

found a solution: self.queue.get() as actually the culprit, if the queue is empty it would seat there doing nothing, keeping the object locked... adding if not self.queue.empty(): before that section fixed the issue...

niccokunzmann commented 5 years ago

Wow, cool. Thanks for coming up with this and initiating the conversation. I am happy if you supply a pull request as I would need to read into he code myself to do this fix.

On 12/28/18 12:16 AM, Vitor de Miranda Henrique wrote:

found a solution: |self.queue.get()| as actually the culprit, if the queue is empty it would seat there doing nothing, keeping the object locked... adding |if not self.queue.empty():| before that section fixed the issue...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/niccokunzmann/python_dhcp_server/issues/7#issuecomment-450250514, or mute the thread https://github.com/notifications/unsubscribe-auth/AAieIK7FFAkvWUUex-uHe-GjIrTXRK38ks5u9VTdgaJpZM4ZjROJ.

niccokunzmann commented 5 years ago

I think, we can close this now. I left a comment with another issue I see and wonder what you think about it. We can continue the discussion in the pull request if it does not belong to the issue.