sparkle-project / Sparkle

A software update framework for macOS
https://sparkle-project.org
Other
7.37k stars 1.05k forks source link

Assertion failure when using releaseNotesLink: _releaseNotesSpinner != nil #2434

Closed kdrag0n closed 12 months ago

kdrag0n commented 1 year ago

Summary

I saw this rare crash in the wild:

OS Version: macOS 13.3.1 (22E261)
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Crashed Thread: 0

Application Specific Information:
-[SUUpdateAlert _createReleaseNotesViewPreferringPlainText:] > Assertion failed: (_releaseNotesSpinner != nil), function -[SUUpdateAlert _createReleaseNotesViewPreferringPlainText:], file SUUpdateAlert.m, line 342.

Thread 0 Crashed:
0   libsystem_kernel.dylib          0x32806f724         __pthread_kill
1   libsystem_pthread.dylib         0x3280e0c24         pthread_kill
2   libsystem_c.dylib               0x327e8cae4         abort
3   libsystem_c.dylib               0x327e8be40         __assert_rtn
4   Sparkle                         0x10338b720         SPUMakeUserAgentWithHost
5   Sparkle                         0x1033872d8         SPUSystemNeedsAuthorizationAccessForBundlePath
6   Sparkle                         0x1033879b0         SPUSystemNeedsAuthorizationAccessForBundlePath
7   Sparkle                         0x10336f520         <redacted>
8   Sparkle                         0x103372290         <redacted>
9   Sparkle                         0x10337179c         <redacted>
10  Sparkle                         0x103367f84         <redacted>
11  libdispatch.dylib               0x327d82870         _dispatch_call_block_and_release
12  libdispatch.dylib               0x327d843fc         _dispatch_client_callout
13  libdispatch.dylib               0x327d92bf4         _dispatch_main_queue_drain
14  libdispatch.dylib               0x327d92844         _dispatch_main_queue_callback_4CF
15  CoreFoundation                  0x328266c84         __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
16  CoreFoundation                  0x3282244a4         __CFRunLoopRun
17  CoreFoundation                  0x328223588         CFRunLoopRunSpecific
18  HIToolbox                       0x33b2dadf0         RunCurrentEventLoopInMode
19  HIToolbox                       0x33b2dac2c         ReceiveNextEventCommon
20  HIToolbox                       0x33b2da984         _BlockUntilNextEventMatchingListInModeWithFilter
21  AppKit                          0x32e6a6f54         _DPSNextEvent
22  AppKit                          0x32e6a60f0         -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
23  AppKit                          0x32e69a554         -[NSApplication run]
24  AppKit                          0x32e6719a4         NSApplicationMain
25  SwiftUI                         0x3786b6970         OUTLINED_FUNCTION_8
26  SwiftUI                         0x379815f9c         OUTLINED_FUNCTION_14
27  SwiftUI                         0x379097438         OUTLINED_FUNCTION_1

I don't know how to reproduce the crash, but as you can see here, I'm using an external release notes link instead of embedding it in the appcast:

            <sparkle:fullReleaseNotesLink>https://docs.orbstack.dev/release-notes</sparkle:fullReleaseNotesLink>
            <description />
            <sparkle:releaseNotesLink>https://cdn-updates.orbstack.dev/release-notes.html</sparkle:releaseNotesLink>

Version

v2.4.2

zorgiepoo commented 1 year ago

Backtrace is wrong like the other issue again. In this case it's important. Please attach full crash log or get the base address of Sparkle at least.

kdrag0n commented 1 year ago

This should be correct:

-[SUUpdatePermissionPrompt initPromptWithHost:request:reply:].cold.1 (in Sparkle) (SUUpdatePermissionPrompt.m:0)
-[SUUpdateAlert _createReleaseNotesViewPreferringPlainText:] (in Sparkle) (SUUpdateAlert.m:356)
-[SUUpdateAlert showUpdateReleaseNotesWithDownloadData:] (in Sparkle) (SUUpdateAlert.m:270)
-[SPUStandardUserDriver showUpdateReleaseNotesWithDownloadData:] (in Sparkle) (SPUStandardUserDriver.m:432)
__87-[SPUUIBasedUpdateDriver basicDriverDidFindUpdateWithAppcastItem:secondaryAppcastItem:]_block_invoke.78 (in Sparkle) (SPUUIBasedUpdateDriver.m:0)
-[SPUReleaseNotesDriver downloadDriverDidDownloadData:] (in Sparkle) (SPUUIBasedUpdateDriver.m:58)
__66-[SPUDownloadDriver downloaderDidFinishWithTemporaryDownloadData:]_block_invoke (in Sparkle) (SPUDownloadDriver.m:0)
zorgiepoo commented 1 year ago

Backtrace looks right (except for the initPromptWithHost line, that is wrong) but I don't see how this assert can trigger logically. So this is probably not actionable / not enough information to make sense of it.

Assuming this is a version of Sparkle with #2381 but still I bet you aren't setting SUShowReleaseNotes.

kdrag0n commented 1 year ago

I'm not setting SUShowReleaseNotes explicitly, but I've just added it for the next release.

Looking at the code though, I'm not seeing how the lack of that setting would change the behavior if releaseNotesLink is set in the update item: https://github.com/sparkle-project/Sparkle/blob/06edf5695d99437b3831d483a29b1920f3ba81a4/Sparkle/SUUpdateAlert.m#L291

zorgiepoo commented 1 year ago

I wasn't recommending to set it to be clear. I would not set it unless you want to hide showing release notes. There was an issue such that if you were trying to hide release notes but the app cast item contained a release notes link the assert could have been hit.

zorgiepoo commented 12 months ago

Not currently actionable.