KBNLresearch / ipmlab

Image Portable Media Like A Boss
Apache License 2.0
3 stars 1 forks source link

Ipmlab doesn't quit after pressing Quit button #14

Closed bitsgalore closed 2 years ago

bitsgalore commented 2 years ago

Did the following:

After confirmation dialog, Ipmlab doesn't quit (but Quit button is disabled).

Looks like it's waiting for an (non existent) imaging job to complete.

bitsgalore commented 2 years ago

This happens only when SocketAPI is enabled, and is caused by sth going wrong here:

  if config.enableSocketAPI:
      self.t2.join()

Added some debug code:

https://github.com/KBNLresearch/ipmlab/commit/9d543b94744d04f5826e88113beca4334c6b27a4

bitsgalore commented 2 years ago

After commenting out the self.t2.join() statement Ipmlab closes normally, but not sure if this doesn't result in remaining zombie proceses (can't see any in Windows task manager). So do we need this?

If yes, self.t2.join() should also be added to if not config.readyToStart block, since socket server is already running in that case as well.

bitsgalore commented 2 years ago

From the docs:

join([timeout]) Wait until the thread terminates. This blocks the calling thread until the thread whose join() method is called terminates – either normally or through an unhandled exception – or until the optional timeout occurs.

Since this is a server thread that continuously scans for incoming socket requests, it never terminates, and hence the application will freeze indefinitely.

bitsgalore commented 2 years ago

Removed thread join:

https://github.com/KBNLresearch/ipmlab/commit/8bd6746a1efcc407b6e6afb7dc789698f854da70