react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

SIGSEV crash on setPace

Open tanujtiwari98 opened this issue 3 years ago • 7 comments

Your Environment

  • Plugin version: 4.7.1
  • Platform: iOS
  • OS version: 15.6.1
  • Device manufacturer / model: iphone
  • React Native version (react-native -v): 0.68.2
  • Plugin config
reset: true,
            debug: false,
            logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
            distanceFilter: 0,
            locationUpdateInterval: 5000,
            stopOnTerminate: false,
            startOnBoot: true,
            disableStopDetection: true,
            pausesLocationUpdatesAutomatically: false,
            url: `${BASE_URL}/carrier/locationsV2`,
            batchSync: true,
            autoSyncThreshold: 5,
            headers: {
                'Authorization': `Bearer ${token}`,
            },
            disableLocationAuthorizationAlert: true,
            locationAuthorizationAlert: {
                titleWhenNotEnabled: "Location services are enabled for auto check in functionality",
                titleWhenOff: "Location services disabled",
                instructions: "You must enable 'Always' in location-services to allow for auto check in",
                cancelButton: "Disable auto check in",
                settingsButton: "Settings"
            }

Expected Behavior

App should not crash

Actual Behavior

App crashes with sigsev. Stack trace attached

Steps to Reproduce

Context

Debug logs

Logs

tanujtiwari98 avatar Aug 29 '22 19:08 tanujtiwari98

Plugin version: latest

Meaningless. Provide exact version

christocracy avatar Aug 29 '22 19:08 christocracy

Create for me a simple Hello World app which reproduces this crash.

christocracy avatar Aug 29 '22 19:08 christocracy

Also, if .changePace is causing a crash, you should show all your javascript involved with that.

christocracy avatar Aug 29 '22 19:08 christocracy

const App =  () => {
    const appState = useRef(AppState.currentState);
    React.useEffect(() => {
        initBackgroundGeolocation();
    }, []);

    /// Configure the BackgroundGeolocation plugin.
    const initBackgroundGeolocation = async () => {
        const authToken = await AsyncStorageNative.getItem('token');
        let token = ''
        try {
            if (token != null) {
                const parsed = JSON.parse(authToken);
                token = parsed.token;
            }
        } catch (e) {
            console.log(e)
        }

        let config = {
            reset: true,
            debug: false,
            logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
            distanceFilter: 0,
            locationUpdateInterval: 5000,
            stopOnTerminate: false,
            startOnBoot: true,
            disableStopDetection: true,
            pausesLocationUpdatesAutomatically: false,
            url: `${BASE_URL}/carrier/locationsV2`,
            batchSync: true,
            autoSyncThreshold: 5,
            headers: {
                'Authorization': `Bearer ${token}`,
            },
            disableLocationAuthorizationAlert: true,
            locationAuthorizationAlert: {
                titleWhenNotEnabled: "Location services are enabled for auto check in functionality",
                titleWhenOff: "Location services disabled",
                instructions: "You must enable 'Always' in location-services to allow for auto check in",
                cancelButton: "Disable auto check in",
                settingsButton: "Settings"
            }
        }

        BackgroundGeolocation.onMotionChange((event) => {
            event.isMoving ? BackgroundGeolocation.setConfig({
                autoSyncThreshold: 20,
            }) : BackgroundGeolocation.setConfig({
                autoSyncThreshold: 5,
                }
            )
        })

        BackgroundGeolocation.onProviderChange((event) => {
            NewRelic.setAttribute('location_permission', event.status)
        });


        BackgroundGeolocation.onHttp((event) => {
            if (event.status === 401) {
                AsyncStorageNative.getItem('token').then((token) => {
                    if (token == null) {
                        return;
                    }

                    const parsed = JSON.parse(authToken);
                    token = parsed.token;
                    BackgroundGeolocation.getState().then(() => {
                        BackgroundGeolocation.setConfig({
                            headers: {
                                'Authorization': `Bearer ${token}`,
                            }
                        })  
                    });
                });
            }
            NewRelic.setAttribute('location_permission', event.status)
        });

        BackgroundGeolocation.ready(config, (async state => {
            await BackgroundGeolocation.start()
            await BackgroundGeolocation.changePace(true)
            if (state.isMoving) {
                await BackgroundGeolocation.setConfig({
                    autoSyncThreshold: 20,
                })
            }
                }));
    };

    if(appState.current === "background") {
        return null
    }

  return (
    <Home />
  );
};

export default App;

tanujtiwari98 avatar Aug 29 '22 20:08 tanujtiwari98

Create for me a simple Hello World app which reproduces this crash.

I will try.

tanujtiwari98 avatar Aug 29 '22 20:08 tanujtiwari98

I am not able to repro on a sample app. Is there any glaring you see in code?

tanujtiwari98 avatar Aug 30 '22 03:08 tanujtiwari98

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 07 '24 01:06 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 22 '24 01:06 github-actions[bot]