Merge lp://qastaging/~mikemc/ubuntuone-control-panel/fix-slow-quit into lp://qastaging/ubuntuone-control-panel

Proposed by Mike McCracken
Status: Merged
Approved by: Mike McCracken
Approved revision: 401
Merged at revision: 397
Proposed branch: lp://qastaging/~mikemc/ubuntuone-control-panel/fix-slow-quit
Merge into: lp://qastaging/ubuntuone-control-panel
Diff against target: 183 lines (+58/-37)
2 files modified
ubuntuone/controlpanel/gui/qt/main/darwin.py (+14/-3)
ubuntuone/controlpanel/gui/qt/main/tests/test_darwin.py (+44/-34)
To merge this branch: bzr merge lp://qastaging/~mikemc/ubuntuone-control-panel/fix-slow-quit
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
dobey (community) Approve
Review via email: mp+145554@code.qastaging.launchpad.net

Commit message

- Change quit handler to quit immediately. (LP: #1042834)

Description of the change

- Change quit handler to quit immediately. (LP: #1042834)

Two main changes:

- Ignore ReactorNotRunning when quitting. We want quitting to always work, and if we bail with an exception when trying to tell the reactor to stop, we never do the necessary cleanup later in the function.
I don't completely understand the reasons why we occasionally see this error, but I am confident that it's harmless to ignore and continue on with the quitting.

- Call reactor.iterate() directly. This is called on a timer which can occasionally be scheduled for very far in the future. So, because the qtreactor does not wake when we stop it, it waits for the timer to fire before quitting its event loop and really dying. Since qtreactor doesn't listen for a quit event, we need to call it directly to wake it at the right time.

(also tests updated and simplified using mock.)

TO TEST IRL:

run control-panel, preferably from the terminal with U1_DEBUG=1 wait ~20 seconds after it loads fully, so that the SSO helper process has exited. Sometime shortly after SSO has exited, quit control panel via cmd-q.

- without the direct call to iterate(), control panel will then stall for many seconds before quitting cleanly.
* What's going on? The qtreactor has been told to stop, and is waiting until the next call to iterate() to actually call quit() on the Qapplication instance. A fun thing to do here is to put a print in some Qt event handler, like FoldersPanel.focus_changed() in folders.py -- and switch applications. Or a timer would do - if you comment out the hideEvent method in loadingoverlay.py, for example. The Qt events are flying around just fine while we wait for iterate() to be called.

- with this change, things quit right away.

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Good detective work fixing this. +1

review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (168.7 KiB)

The attempt to merge lp:~mikemc/ubuntuone-control-panel/fix-slow-quit into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.

*** Running DBus test suite ***
ubuntuone.controlpanel.dbustests.test_dbus_service
  BaseTestCase
    runTest ... [OK]
  DBusServiceMainTestCase
    test_dbus_service_cant_register ... Control panel backend already running.
                                   [OK]
    test_dbus_service_main ... [OK]
  DBusServiceTestCase
    test_cant_register_twice ... [SKIPPED]
    test_dbus_busname_created ... [OK]
    test_error_handler_default ... [OK]
    test_error_handler_with_exception ... [OK]
    test_error_handler_with_failure ... [OK]
    test_error_handler_with_non_string_dict ... [OK]
    test_error_handler_with_string_dict ... [OK]
    test_register_service ... [OK]
  FileSyncTestCase
    test_file_sync_status_changed ... [OK]
    test_file_sync_status_disabled ... [OK]
    test_file_sync_status_disconnected ... [OK]
    test_file_sync_status_error ... [OK]
    test_file_sync_status_idle ... [OK]
    test_file_sync_status_starting ... [OK]
    test_file_sync_status_stopped ... [OK]
    test_file_sync_status_syncing ... [OK]
    test_file_sync_status_unknown ... [OK]
    test_status_changed_handler ... [OK]
    test_status_changed_handler_after_status_requested ... [OK]
    test_status_changed_handler_after_status_requested_twice ... [OK]
  OperationsAuthErrorTestCase
    test_account_info_returned ... [OK]
    test_change_device_settings ... [OK]
    test_change_replication_settings ... [OK]
    test_change_volume_settings ... [OK]
    test_connect_files ... [OK]
    test_devices_info_returned ... [OK]
    test_disable_files ... [OK]
    test_disconnect_files ... [OK]
    test_enable_files ... [OK]
    test_remove_device ... [OK]
    test_replications_info ... [OK]
    test_restart_files ... [OK]
    test_sta...

401. By Mike McCracken

removed unused import

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches