Skip to content

After user chooses "Quit" and allows Bitmessage to wait till sync is done, app can only be stopped via "kill" #1298

Open

Description

@stayen

When I press "Quit", PyBitmessage offers to wait till all the sync is done, then quit.

If I need to quit it anyway and click "Quit" again, nothing happens. The only means to kill the app at that moment is by using "kill" command (in my case, Ubuntu 16.04.4, only "kill -9" worked).

  • when closing using "File / Quit"
  • when closing by closing the window

Activity

  1. changed the title [-]After user chooses "Quit" and allows Bitmesasge to wait till sync is done, app can only be stopped via "kill"[/-] [+]After user chooses "Quit" and allows Bitmessage to wait till sync is done, app can only be stopped via "kill"[/+] on Jul 5, 2018
  2. added
    bugSomething isn't working as it's supposed to
    on Jul 6, 2018
  3. g1itch commented on Jul 6, 2018

    @g1itch
    Collaborator

    What if I often have a couple of dozen objects to be synced? This expression will wait forever: __init__.py#L2764.

  4. g1itch commented on Jul 6, 2018

    @g1itch
    Collaborator

    We can use something like

    diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py
    index 5e4c18fd..6c7b2e7e 100644
    --- a/src/bitmessageqt/__init__.py
    +++ b/src/bitmessageqt/__init__.py
    @@ -627,8 +627,8 @@ class MyForm(settingsmixin.SMainWindow):
             self.replyFromTab = None
     
             # so that quit won't loop
    -        self.quitAccepted = False
    -        
    +        self.quitAccepted = self.wait = False
    +
             self.init_file_menu()
             self.init_inbox_popup_menu()
             self.init_identities_popup_menu()
    @@ -2703,7 +2703,7 @@ class MyForm(settingsmixin.SMainWindow):
                 return
             '''
     
    -        if self.quitAccepted:
    +        if self.quitAccepted and not self.wait:
                 return
     
             self.show()
    @@ -2731,7 +2731,7 @@ class MyForm(settingsmixin.SMainWindow):
                         _translate("MainWindow", "Bitmessage hasn't synchronised with the network, %n object(s) to be downloaded. If you quit now, it may cause delivery delays. Wait until the synchronisation finishes?", None, QtCore.QCoreApplication.CodecForTr, pendingDownload()),
                         QtGui.QMessageBox.Yes|QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel)
                 if reply == QtGui.QMessageBox.Yes:
    -                waitForSync = True
    +                self.wait = waitForSync = True
                 elif reply == QtGui.QMessageBox.Cancel:
                     return
     
    @@ -2741,7 +2741,7 @@ class MyForm(settingsmixin.SMainWindow):
                         _translate("MainWindow", "Bitmessage isn't connected to the network. If you quit now, it may cause delivery delays. Wait until connected and the synchronisation finishes?"),
                         QtGui.QMessageBox.Yes|QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel)
                 if reply == QtGui.QMessageBox.Yes:
    -                waitForConnection = True
    +                self.wait = waitForConnection = True
                     waitForSync = True
                 elif reply == QtGui.QMessageBox.Cancel:
                     return

    to show msgbox again if user selected to wait at first.

  5. added a commit that references this issue on Nov 11, 2018
  6. added a commit that references this issue on Nov 25, 2018
  7. added this to the v0.6.4 milestone on Aug 27, 2020
  8. navjotcis commented on Sep 18, 2020

    @navjotcis
    Contributor

    I am facing the same issue which is posted above here whenever I am starting the app and closing(by pressing quit) it before the connection message shows then it stuck in the process and did not close the app so only user can kill the process for closing or maybe we need to wait for few minutes then it will automatically close.
    and another issue is there if it does not stuck in connection issue then sometimes it stuck in synchronization issue here when the user press quit then app asks to press ok in the popup and when you press ok then app start showing Waiting for finishing synchronization message and the same thing happens it did not close the app no matter how many time you try to close it but it stuck in a loop because there is a condition
    pendingDownload() > 0. so sometimes pendingDownload() method returns large no. which take time to reduce due to that loop call n no. of times so in this case app only close when pendingDownload() method return 0 so I have done some changes which
    makes the process better and then app will not stuck in these conditions.

    diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py
    index 2f1a6e7..558e1dd 100644
    --- a/src/bitmessageqt/__init__.py
    +++ b/src/bitmessageqt/__init__.py
    @@ -2719,11 +2719,10 @@ class MyForm(settingsmixin.SMainWindow):
     
             self.updateStatusBar(_translate(
                 "MainWindow", "Shutting down PyBitmessage... %1%").arg(0))
    -
             if waitForConnection:
                 self.updateStatusBar(_translate(
                     "MainWindow", "Waiting for network connection..."))
    -            while state.statusIconColor == 'red':
    +            while state.statusIconColor == 'red' and not self.quitAccepted:
                     time.sleep(0.5)
                     QtCore.QCoreApplication.processEvents(
                         QtCore.QEventLoop.AllEvents, 1000
    @@ -2735,7 +2734,7 @@ class MyForm(settingsmixin.SMainWindow):
             if waitForSync:
                 self.updateStatusBar(_translate(
                     "MainWindow", "Waiting for finishing synchronisation..."))
    -            while pendingDownload() > 0:
    +            while pendingDownload() > 0 and not self.quitAccepted:
                     time.sleep(0.5)
                     QtCore.QCoreApplication.processEvents(
                         QtCore.QEventLoop.AllEvents, 1000
    @@ -2750,7 +2749,7 @@ class MyForm(settingsmixin.SMainWindow):
                     curWorkerQueue = powQueueSize()
                     if curWorkerQueue > maxWorkerQueue:
                         maxWorkerQueue = curWorkerQueue
    -                if curWorkerQueue > 0:
    +                if curWorkerQueue > 0 and not self.quitAccepted:
                         self.updateStatusBar(_translate(
                             "MainWindow", "Waiting for PoW to finish... %1%"
                         ).arg(50 * (maxWorkerQueue - curWorkerQueue) /
    
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working as it's supposed tousability

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions