meliorence / meliorence/react-native-snap-carousel

iOS app crashes when suspended after viewing a carousel

Open
#661 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.5k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

BUG REPORT

Have you followed the required steps before opening a bug report?

(Check the step you've followed - put an x character between the square brackets ([]).)

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

Bug can be reproduced on iOS. Not used in Android, so cannot report that as an issue.

Is the bug reproductible in a production environment (not a debug one)?

Yes

Environment

Environment:
"react": "16.9.0",
"react-native": "0.61.3",
"react-native-snap-carousel": "^3.8.4",

Target Platform:
iOS (13.x)

Expected Behavior

After the app is brought to the foreground from a suspended state, it should show the last viewed screen.

Actual Behavior

If the Carousel is showing on a screen and the app is backgrounded, and then subsequently brought back to the foreground, the previous content is shown.

However, if the app is backgrounded, and then goes into the suspended state, and then brought back to the foreground, the previous content is not shown.

Looking through the console logs, as soon as the app becomes suspended, the app crashes on the system. This only happens after the Carousel has been loaded into memory.

Reproducible Demo

Create a screen containing code like the following:

 <Carousel
                renderItem={this._renderImage}
                data={imageSrc}
                itemWidth={ settings.width - 32 }
                sliderWidth={ settings.width - 32 }
                loop={ true }
                autoplay={ true }
                containerCustomStyle={{ flex: 1 }}
                slideStyle={{ flex: 1 }}
 />

Where this._renderImage is:

_renderImage ({item, index}) {
        return (
            <Image
                key={`unit_image_${index}`}    
                style={styles.imageDisplay}
                resizeMethod='scale'
                resizeMode='contain'
                source={ item }
            />
        );
    }

and imageSrc is an array of images. e.g.

const image1 = require('./image1.png');
const image2 = require('./image2.png');
const imageSrc = [ image1, image2 ]
Steps to Reproduce
  1. Open the app to the screen containing the carousel.
  2. Press the home button, or swipe up the home bar to background the app.
  3. Wait 30+ seconds for the app to be suspended.
  4. The app will start from scratch (e.g. show the splash screen)

If you look at the logs in the console, you'll see shortly after the app was suspended, something similar will be logged:

default	12:47:21.492097 +0000	nsurlsessiond	Application com.example.app was suspended
default	12:47:21.493392 +0000	nsurlsessiond	Removing session with identifier: com.twitter.crashlytics.ios.crash.background-session for bundle id: com.example.app
default	12:47:21.493988 +0000	nsurlsessiond	<com.example.app>.<com.twitter.crashlytics.ios.crash.background-session> Lost connection to app -- connection interrupted or invalidated
default	12:47:21.496819 +0000	runningboardd	[application<com.example.app>:8774] Set darwin role to: None
default	12:47:21.496941 +0000	runningboardd	[application<com.example.app>:8774] Terminating with context: <RBSTerminateContext: 0x7fbd8d71dc90; code: 0x2182BAAD; explanation: "Timed-out waiting for process [application<com.example.app>:8774] to invalidate assertion with identifier 4605-8774-2595 and explanation 'Shared Background Assertion 13 for com.example.app'. Direct this report to owners of that process"; reportType: 0; maxRole: 7; maxTerminationResistance: 3>
default	12:47:21.497366 +0000	backboardd	Connection removed: IOHIDEventSystemConnection uuid:32474055-25B6-4918-9AF2-F9F0D9B40420 pid:8774 process:SmartLink type:Passive entitlements:0x0 caller:BackBoardServices: ___getHIDEventSystemClient_block_invoke + 362 attributes:{
    HighFrequency = 0;
    bundleID = "com.example.app";
    pid = 8774;
} inactive:0 events:261 mask:0x800
default	12:47:21.497380 +0000	SpringBoard	[application<com.example.app>:8774] Now flagged as pending exit for reason: workspace client connection invalidated
default	12:47:21.500681 +0000	runningboardd	XPC connection invalidated: [application<com.example.app>:8774]
default	12:47:21.501574 +0000	runningboardd	[application<com.example.app>:8774] terminate_with_reason() success
error	12:47:21.501756 +0000	runningboardd	RBSStateCapture remove item called for untracked item <RBProcessMonitorObserver: 0x7fbd8e015120; <RBProcess: 0x7fbd8d61aa80; 8774; identity: application<com.example.app>>; configCount: 0>
default	12:47:21.521596 +0000	runningboardd	[application<com.example.app>:8774] Death sentinel fired!
default	12:47:21.650949 +0000	runningboardd	Removing process: [application<com.example.app>:8774]
default	12:47:21.651363 +0000	runningboardd	[application<com.example.app>:8774] Deleting job: UIKitApplication:com.example.app[6fc3][rb-legacy]

Again, this only happens on screens where the Carousel appears (or after in the stack).

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

The payload names no repository files or tests. Start by reproducing the supplied Carousel example on iOS 13.x, backgrounding the app for 30+ seconds and reviewing the suspension logs. Done means the app resumes showing the last viewed screen without being terminated.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript, react-native
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.