wordpress-mobile / wordpress-mobile/WordPress-iOS

Share extension crashes on consecutive uses

Open
#20,873 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Type] Crash Posting/Editing Share Extension
Dominant language
Swift
Stars
3.9k
Forks
1.2k
Avg merge
23h 51m
Merged PRs (30d)
58

Description

Expected behavior

Sharing to the Jetpack app shouldn't cause a crash.

Actual behavior

Sharing causes a crash the 2nd time it's used.

Steps to reproduce the behavior

These are the steps to reproduce the crash (reproducible on 2 out of 2 attempts):

  1. Shared text (highlight text in an online text editor, long-press, Share, choose Jetpack)
  2. Once the JP share sheet opens, close it
  3. Open a different app and shared text (highlighted text in notes field of Contacts app, long-press, Share, choose Jetpack)
  4. Once the JP share sheet opens, close it
  5. Share extension crashes in Xcode
* thread #31, queue = 'com.apple.NSURLSession-delegate', stop reason = EXC_BREAKPOINT (code=1, subcode=0x10c6c11b8)
    frame #0: 0x000000010c6c11b8 CoreData`_PFAssertSafeMultiThreadedAccess_impl + 520
    frame #1: 0x000000010c6c8f90 CoreData`-[NSManagedObjectContext executeRequest:error:] + 2552
    frame #2: 0x000000010c61f488 CoreData`__C.NSManagedObjectContext.fetch<τ_0_0 where τ_0_0: __C.NSFetchRequestResult>(__C.NSFetchRequest<τ_0_0>) throws -> Swift.Array<τ_0_0> + 80
  * frame #3: 0x00000001029d80bc Jetpack`SharedCoreDataStack.fetchSessionUploadOps(taskIdentifier=1, sessionID="group.org.wordpress.06C9B0C5-26E7-427C-9551-6143F857DD49", self=0x00000002951df010) at SharedCoreDataStack.swift:194:44
    frame #4: 0x00000001025d2270 Jetpack`ShareExtensionSessionManager.urlSession(session=0x0000000295cb37f0, task=0x00000002952a2f40, error=nil, self=0x0000000295c8f920) at ShareExtensionSessionManager.swift:338:45
    frame #5: 0x00000001025d3034 Jetpack`@objc ShareExtensionSessionManager.urlSession(_:task:didCompleteWithError:) at <compiler-generated>:0
    frame #6: 0x00000001168540e0 CFNetwork`___lldb_unnamed_symbol2749 + 32
    frame #7: 0x000000011ccec528 libdispatch.dylib`_dispatch_call_block_and_release + 24
    frame #8: 0x000000011ccedd50 libdispatch.dylib`_dispatch_client_callout + 16
    frame #9: 0x000000011ccf6014 libdispatch.dylib`_dispatch_lane_serial_drain + 924
    frame #10: 0x000000011ccf6da4 libdispatch.dylib`_dispatch_lane_invoke + 480
    frame #11: 0x000000011cd04b74 libdispatch.dylib`_dispatch_workloop_worker_thread + 1716
    frame #12: 0x00000001b1834878 libsystem_pthread.dylib`_pthread_wqthread + 284

Tested on iPhone simulator, iOS 16.4, Jetpack iOS 0520842897ec3f11868fef24e3f76d916f4b21c3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read SharedCoreDataStack.swift at fetchSessionUploadOps (line 194) and ShareExtensionSessionManager.swift at the urlSession completion callback (line 338). First reproduce the crash with two consecutive share-extension uses in the iOS 16.4 simulator, then inspect the Core Data access on the NSURLSession-delegate queue. Done means consecutive shares complete without the share extension crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.