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

Open
opened 2018-07-05 05:21:12 +02:00 by stayen · 3 comments
stayen commented 2018-07-05 05:21:12 +02:00 (Migrated from github.com)

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
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). - [x] when closing using "File / Quit" - [ ] when closing by closing the window
g1itch commented 2018-07-06 11:21:46 +02:00 (Migrated from github.com)

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

What if I often have a couple of dozen objects to be synced? This expression will wait forever: [`__init__.py`#L2764](../blob/v0.6/src/bitmessageqt/__init__.py#L2764).
g1itch commented 2018-07-06 11:54:30 +02:00 (Migrated from github.com)

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.

We can use something like ```patch 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.
navjotcis commented 2020-09-18 14:45:58 +02:00 (Migrated from github.com)

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) /

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) / ```
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Bitmessage/PyBitmessage-2024-12-10#1298
No description provided.