Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-[SPExportController cancelExport:] does not wait until queue is actually empty #2192

Closed
dmoagx opened this issue Aug 2, 2015 · 0 comments
Closed
Labels

Comments

@dmoagx
Copy link
Member

dmoagx commented Aug 2, 2015

Code in question:

    // Cancel all of the currently running operations
    [operationQueue cancelAllOperations];

    // Loop the cached export file paths and remove them from disk if they exist
    for (SPExportFile *file in exportFiles)
    {
        [file delete];
    }

cancelAllOperations is async and whether an operation actually reacts to cancellation is still up to the operation. This means while [file delete] is running another thread could still be writing to that file.

Reports:
(all erroneously grouped with other issues – feedback reporter causes a crash and hides the real issue ;see console log)
http://log.sequelpro.com/view/4878
http://log.sequelpro.com/view/4400
http://log.sequelpro.com/view/2036

Exception:

Cannot write to a file handle after it has been closed
(
    0   CoreFoundation                      0x00007fff8629f25c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff836b2e75 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8629f10c +[NSException raise:format:] + 204
    3   Sequel Pro                          0x00000001000f7dc9 -[SPFileHandle writeData:] + 70
    4   Sequel Pro                          0x00000001000d0971 -[SPSQLExporter main] + 5468
    5   Foundation                          0x00007fff8a7788a1 -[__NSOperationInternal _start:] + 631
    6   Foundation                          0x00007fff8a77854b __NSOQSchedule_f + 64
    7   libdispatch.dylib                   0x00007fff8a0ff28d _dispatch_client_callout + 8
    8   libdispatch.dylib                   0x00007fff8a1037e3 _dispatch_async_redirect_invoke + 154
    9   libdispatch.dylib                   0x00007fff8a0ff28d _dispatch_client_callout + 8
    10  libdispatch.dylib                   0x00007fff8a101082 _dispatch_root_queue_drain + 326
    11  libdispatch.dylib                   0x00007fff8a102177 _dispatch_worker_thread2 + 40
    12  libsystem_pthread.dylib             0x00007fff8e087ef8 _pthread_wqthread + 314
    13  libsystem_pthread.dylib             0x00007fff8e08afb9 start_wqthread + 13
)
@dmoagx dmoagx added the Bug label Aug 2, 2015
@dmoagx dmoagx changed the title -[SPExportController cancelExport:] does not wait until until queue is actually empty -[SPExportController cancelExport:] does not wait until queue is actually empty Aug 2, 2015
@dmoagx dmoagx closed this as completed in 9728737 Aug 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant