Circular dependencies cause local expo server to crash on hot reload
OS:
- [ ] Windows
- [x] MacOS
- [ ] Linux
Platform:
- [x] iOS
- [ ] Android
SDK:
- [x]
@sentry/react-native(>= 1.0.0) - [ ]
react-native-sentry(<= 0.43.2)
SDK version: 5.22.0
react-native version: 0.74.5
Are you using Expo?
- [x] Yes
- [ ] No
Are you using sentry.io or on-premise?
- [x] sentry.io (SaaS)
- [ ] on-premise
If you are using sentry.io, please post a link to your issue so we can take a look:
[Link to issue]
Configuration:
(@sentry/react-native)
Sentry.init({
dsn: "XXX",
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
tracesSampleRate: 1.0,
_experiments: {
// profilesSampleRate is relative to tracesSampleRate.
// Here, we'll capture profiles for 100% of transactions.
profilesSampleRate: 1.0,
},
attachScreenshot: true,
});
I have the following issue:
[Description]
Steps to reproduce:
- Add sentry to an expo project
- Start local expo development server (
npx expo start) - Connect to the development server from a mobile device and reload the package a few times
Actual result:
Javascript bundle is generated multiple times, eventually ending in an out of memory error
Expected result:
Javascript bundle is only generated once per refresh per device
The following log shows how many time the bundle is generated per single refresh expo.log
The following log shows the out of memory error which eventually happens after a certain number of reloads over a longer period: expo-2.log
Hi @witalewski, thank you for the message,
sadly, I was not able to reproduce the Out of memory error.
Would you be able to share a reproducible example with us?
We are aware of the cycles coming from Sentry Javascript v7. They are intentional to make transition to Sentry JS v8 simpler. They should not cause any issues, besides the warnings.
The are removed in Sentry React Native v6, currently in alpha version.
The multiple builds are cause by symbolications requests from the Sentry SDK to the dev server, which triggers the web builds.
I am having this too
Hi @beneditomauro, thank you for the message,
are you seeing the cycles, or the multiple builds or the out of memory crash in development?
Hi @krystofwoldrich, we're also encountering this issue and can easily reproduce the crash due to rebundling:
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Steps to reproduce the crash:
In our homepage, we load data within a useEffect. If no data is present (an empty []), we attempt to call captureMessage or captureException. While the message is captured, the app then reloads repeatedly until we get:
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Example code
export default function ExampleComponent() {
...
// useEffect is here
// outside of the useEffect
if (!dataExists) {
Sentry.captureMessage("No data");
}
}
Hi @omervexler-fijoya, thank you for the message,
does removing the DebugSymbolicator integration fixes the issue?
To remove it add the following to your Sentry.init options.
integrations(integrations) {
return integrations.filter(i => i.name !== 'DebugSymbolicator');
},
Hi @omervexler-fijoya, thank you for the message,
does removing the
DebugSymbolicatorintegration fixes the issue?To remove it add the following to your
Sentry.initoptions.integrations(integrations) { return integrations.filter(i => i.name !== 'DebugSymbolicator'); },
This did the trick for me.
Today, we have relased https://github.com/getsentry/sentry-react-native/releases/tag/6.3.0-beta.1!
This version updated the DebugSymbolicator implementation (mainly how source context is loaded). This should solve the Expo/Metro development server crash.
Please try the beta version and let us know if it helped.
https://github.com/getsentry/sentry-react-native/releases/tag/6.3.0 with the fix was released.
The DebugSymbolicator no long trigger web build in the Metro/Expo dev server.