-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing libhermes.so causes crashes in Release Build #675
Comments
Hi @vlak-koder, thanks for providing the steps to reproduce! How reliable is the method you've provided? A prepared reproduction repository with your setup would be ideal 🙏 |
Hi @jbroma , so I tried to create a new project with repack to simulate my app in production but It was taking time then I resolved to using the SuperApp showcase APP and I was able to replicate - So the clone is almost the same as the super App but I hardcoded the urls instead of fetching from the server and I've hosted all the bundles in my repo. and the bundles are mainly for Android screenshot -Steps to Reproduce
On my phone, with the above steps, the bug re-surfaces. I also have caching issue as seen in this Super App clone repo but I've seen your response on another issue, I'd apply accordingly. Thank you for your support |
Hi @jbroma , where you able to recreate this bug? It's the same repo as the one I shared in the caching issue but it's on the main branch |
@jbroma could you please provide a fix for this? it seems not to allow 2 mini apps to load/bundle the same for the first time |
Hi @vlak-koder, @Nazehs, I've looked at the demo but realised it's on Re.Pack on 3.4.0 - please try to reproduce on the problem using repack v4. I've added a branch to the super-app-showcase which uses V4 here. If you decide to make a reproducer based on this branch try to structure your commits so that it's easier to spot what has been added on top of existing code - this saves a lot of time. Note:I was not able to reproduce the issue you were having, is this limited to prod? Haven't check prod yet |
Hi @jbroma sorry for the delay.. I've updated to 4.2 since yesterday. Forgot to update you here |
Hi @vlak-koder, I was able to reproduce the problem on the main branch of your repo but after switching to updated Can you verify that it's still occurring there? |
@jbroma It works now on the superapp demo but when I installed 4.2.0 in my project, It crashes on launch (release/production build, it's fine with debug build) when I revert back to 3.7.0, it works again. import * as Repack from '@callstack/repack';
import path from 'path';
import TerserPlugin from 'terser-webpack-plugin';
// import {getSharedDependencies} from 'super-app-showcase-sdk';
/**
* More documentation, installation, usage, motivation and differences with Metro is available at:
* https://github.com/callstack/repack/blob/main/README.md
*
* The API documentation for the functions and plugins used in this file is available at:
* https://re-pack.netlify.app/
*/
/**
* Webpack configuration.
* You can also export a static object or a function returning a Promise.
*
* @param env Environment options passed from either Webpack CLI or React Native CLI
* when running with `react-native start/bundle`.
*/
export default env => {
const {
mode = 'development',
context = Repack.getDirname(import.meta.url),
// context = dirname,
entry = './index.js',
platform = process.env.PLATFORM,
// platform,
minimize = mode === 'production',
devServer = undefined,
bundleFilename = undefined,
sourceMapFilename = undefined,
assetsPath = undefined,
reactNativePath = new URL('./node_modules/react-native', import.meta.url)
.pathname,
// reactNativePath = require.resolve('react-native'),
} = env;
const dirname = Repack.getDirname(import.meta.url);
if (!platform) {
throw new Error('Missing platform');
}
/**
* Using Module Federation might require disabling hmr.
* Uncomment below to set `devServer.hmr` to `false`.
*
* Keep in mind that `devServer` object is not available
* when running `webpack-bundle` command. Be sure
* to check its value to avoid accessing undefined value,
* otherwise an error might occur.
*/
// if (devServer) {
// devServer.hmr = false;
// }
/**
* Depending on your Babel configuration you might want to keep it.
* If you don't use `env` in your Babel config, you can remove it.
*
* Keep in mind that if you remove it you should set `BABEL_ENV` or `NODE_ENV`
* to `development` or `production`. Otherwise your production code might be compiled with
* in development mode by Babel.
*/
process.env.BABEL_ENV = mode;
return {
mode,
/**
* This should be always `false`, since the Source Map configuration is done
* by `SourceMapDevToolPlugin`.
*/
devtool: false,
context,
/**
* `getInitializationEntries` will return necessary entries with setup and initialization code.
* If you don't want to use Hot Module Replacement, set `hmr` option to `false`. By default,
* HMR will be enabled in development mode.
*/
entry: [
...Repack.getInitializationEntries(reactNativePath, {
hmr: devServer && devServer.hmr,
}),
entry,
],
resolve: {
/**
* `getResolveOptions` returns additional resolution configuration for React Native.
* If it's removed, you won't be able to use `<file>.<platform>.<ext>` (eg: `file.ios.js`)
* convention and some 3rd-party libraries that specify `react-native` field
* in their `package.json` might not work correctly.
*/
...Repack.getResolveOptions(platform),
conditionNames: ['default', 'exports'],
// conditionNames: ['default'],
// conditionNames: ['default', 'exports', 'require', 'node'],
/**
* Uncomment this to ensure all `react-native*` imports will resolve to the same React Native
* dependency. You might need it when using workspaces/monorepos or unconventional project
* structure. For simple/typical project you won't need it.
*/
// alias: {
// 'react-native': reactNativePath,
// },
alias: {
// 'react-native': reactNativePath,@hookform/resolvers
immer: path.resolve(dirname, 'node_modules/immer'),
'@hookform/resolvers': path.resolve(
dirname,
'node_modules/@hookform/resolvers',
),
// zod: path.resolve(dirname, 'node_modules/zod/lib'),
zod: path.resolve(dirname, 'node_modules/zod'),
entities: path.resolve(dirname, 'node_modules/entities'),
domelementtype: path.resolve(dirname, 'node_modules/domelementtype'),
'dom-serializer': path.resolve(dirname, 'node_modules/dom-serializer'),
domhandler: path.resolve(dirname, 'node_modules/domhandler'),
'nth-check': path.resolve(dirname, 'node_modules/nth-check'),
domutils: path.resolve(dirname, 'node_modules/domutils'),
'css-select': path.resolve(dirname, 'node_modules/css-select'),
// 'freerasp-react-native': path.resolve(dirname, 'node_modules/freerasp-react-native/lib/module/index.js'),
'react-hook-form': path.resolve(
dirname,
'node_modules/react-hook-form/dist/index.cjs.js',
),
},
},
/**
* Configures output.
* It's recommended to leave it as it is unless you know what you're doing.
* By default Webpack will emit files into the directory specified under `path`. In order for the
* React Native app use them when bundling the `.ipa`/`.apk`, they need to be copied over with
* `Repack.OutputPlugin`, which is configured by default inside `Repack.RepackPlugin`.
*/
output: {
clean: true,
hashFunction: 'xxhash64',
path: path.resolve(dirname, 'build/generated', platform),
filename: 'index.bundle',
chunkFilename: '[name].chunk.bundle',
publicPath: Repack.getPublicPath({ platform, devServer }),
},
/**
* Configures optimization of the built bundle.
*/
optimization: {
/** Enables minification based on values passed from React Native CLI or from fallback. */
minimize,
/** Configure minimizer to process the bundle. */
minimizer: [
new TerserPlugin({
test: /\.(js)?bundle(\?.*)?$/i,
/**
* Prevents emitting text file with comments, licenses etc.
* If you want to gather in-file licenses, feel free to remove this line or configure it
* differently.
*/
extractComments: false,
terserOptions: {
format: {
comments: false,
},
},
}),
],
chunkIds: 'named',
},
module: {
/**
* This rule will process all React Native related dependencies with Babel.
* If you have a 3rd-party dependency that you need to transpile, you can add it to the
* `include` list.
*
* You can also enable persistent caching with `cacheDirectory` - please refer to:
* https://github.com/babel/babel-loader#options
*/
rules: [
{
test: /\.[jt]sx?$/,
include: [
/node_modules(.*[/\\])+react/,
/node_modules(.*[/\\])+react-native/,
/node_modules(.*[/\\])+react-freeze/,
/node_modules(.*[/\\])+@react-native/,
/node_modules(.*[/\\])+@react-navigation/,
/node_modules(.*[/\\])+@react-native-community/,
/node_modules(.*[/\\])+@expo/,
/node_modules(.*[/\\])+pretty-format/,
/node_modules(.*[/\\])+metro/,
/node_modules(.*[/\\])+abort-controller/,
// /node_modules(.*[/\\])+@callstack\/repack/,
/node_modules(.*[/\\])+@callstack[/\\]repack/,
/node_modules(.*[/\\])+superstruct/,
/node_modules(.*[/\\])+zod/,
/node_modules(.*[/\\])+appcenter-analytics/,
/node_modules(.*[/\\])+react-hook-form/,
/node_modules(.*[/\\])+freerasp-react-native/,
/node_modules(.*[/\\])+rn-qr-generator/,
],
use: 'babel-loader',
},
{
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
native: true,
dimensions: false,
},
},
],
},
/**
* Here you can adjust loader that will process your files.
*
* You can also enable persistent caching with `cacheDirectory` - please refer to:
* https://github.com/babel/babel-loader#options
*/
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
/** Add React Refresh transform only when HMR is enabled. */
plugins:
devServer && devServer.hmr
? ['module:react-refresh/babel']
: undefined,
},
},
},
{
test: /\.[jt]sx?$/,
// include: [
// /node_modules(.*[/\\])+axios\//,
// ],
include: [/node_modules(.*[/\\])+(axios|redux-toolkit)\//],
use: {
loader: 'babel-loader',
options: {
presets: [
[
'module:metro-react-native-babel-preset',
{ disableImportExportTransform: true },
],
],
},
},
},
{
test: /\.[jt]sx?$/,
// include: [
// /node_modules(.*[/\\])+axios\//,
// ],
include: [/node_modules(.*[/\\])+(react-hook-form)\//],
use: {
loader: 'babel-loader',
options: {
presets: [
[
'module:metro-react-native-babel-preset',
{ disableImportExportTransform: true },
],
],
},
},
},
/**
* This loader handles all static assets (images, video, audio and others), so that you can
* use (reference) them inside your application.
*
* If you wan to handle specific asset type manually, filter out the extension
* from `ASSET_EXTENSIONS`, for example:
*
* Repack.ASSET_EXTENSIONS.filter((ext) => ext !== 'svg')
*
*/
{
test: Repack.getAssetExtensionsRegExp(
Repack.ASSET_EXTENSIONS.filter(ext => ext !== 'svg'),
// Repack.ASSET_EXTENSIONS
),
use: {
loader: '@callstack/repack/assets-loader',
options: {
platform,
devServerEnabled: Boolean(devServer),
/**
* Defines which assets are scalable - which assets can have
* scale suffixes: `@1x`, `@2x` and so on.
* By default all images are scalable.
*/
scalableAssetExtensions: Repack.SCALABLE_ASSETS,
},
},
},
],
},
plugins: [
/**
* Configure other required and additional plugins to make the bundle
* work in React Native and provide good development experience with
* sensible defaults.
*
* `Repack.RepackPlugin` provides some degree of customization, but if you
* need more control, you can replace `Repack.RepackPlugin` with plugins
* from `Repack.plugins`.
*/
new Repack.RepackPlugin({
context,
mode,
platform,
devServer,
output: {
bundleFilename,
sourceMapFilename,
assetsPath,
},
}),
new Repack.plugins.ModuleFederationPlugin({
name: 'new_pack',
shared: {
react: {
singleton: true,
eager: true,
requiredVersion: '18.2.0',
},
'react-native': {
singleton: true,
eager: true,
requiredVersion: '0.72.5',
},
'./src/component/molecule': {
singleton: true,
eager: true,
requiredVersion: '1',
},
'./src/api/nodeApi': {
singleton: true,
eager: true,
requiredVersion: '1',
},
'./src/api/cmsApi': {
singleton: true,
eager: true,
requiredVersion: '1',
},
'./src/component/atom': {
singleton: true,
eager: true,
requiredVersion: '1',
},
'react-native-click-outside': {
singleton: true,
eager: true,
requiredVersion: '^0.1.1',
},
'react-native-outside-press': {
singleton: true,
eager: true,
requiredVersion: '^1.2.2'
},
'react-native-svg': {
singleton: true,
eager: true,
requiredVersion: '15.1.0',
},
'@react-navigation/native': {
singleton: true,
eager: true,
requiredVersion: '6.1.6',
},
'react-native-gesture-handler': {
singleton: true,
eager: true,
requiredVersion: '2.13.1',
},
'@react-navigation/native-stack': {
singleton: true,
eager: true,
requiredVersion: '6.9.26',
},
'react-native-fast-image': {
singleton: true,
eager: true,
requiredVersion: '8.6.3',
},
'react-native-safe-area-context': {
singleton: true,
eager: true,
requiredVersion: '4.9.2',
},
'react-native-screens': {
singleton: true,
eager: true,
requiredVersion: '3.22.1',
},
'@hookform/resolvers': {
singleton: true,
eager: true,
requiredVersion: '3.3.1',
},
'@react-native-async-storage/async-storage': {
singleton: true,
eager: true,
requiredVersion: '1.19.3',
},
"@shopify/flash-list": {
eager: true,
requiredVersion: "1.6.4",
singleton: true
},
"react-native-permissions": {
singleton: true,
eager: true,
requiredVersion: '3.10.1',
},
"react-native-contacts": {
singleton: true,
eager: true,
requiredVersion: '7.0.8',
},
"react-native-raw-bottom-sheet": {
singleton: true,
eager: true,
requiredVersion: "2.2.0",
},
'@reduxjs/toolkit': {
singleton: true,
eager: true,
requiredVersion: '1.9.6',
},
'@react-native-community/checkbox': {
singleton: true,
eager: true,
requiredVersion: '0.5.16',
},
'@shopify/restyle': {
singleton: true,
eager: true,
requiredVersion: '2.4.2',
},
axios: { singleton: true, eager: true, requiredVersion: '1.6.7' },
'react-hook-form': {
singleton: true,
eager: true,
requiredVersion: '7.49.3',
},
'react-native-modal': {
singleton: true,
eager: true,
requiredVersion: '13.0.1',
},
'react-native-reanimated': {
singleton: true,
eager: true,
requiredVersion: '3.8.1',
},
'react-native-size-matters': {
singleton: true,
eager: true,
requiredVersion: '0.4.2',
},
'react-redux': {
singleton: true,
eager: true,
requiredVersion: '8.1.3',
},
"react-native-fast-shadow": {
singleton: true,
eager: true,
requiredVersion: "0.1.0"
},
'redux-persist': {
singleton: true,
eager: true,
requiredVersion: '6.0.0',
},
"node-forge": {
singleton: true,
eager: true,
requiredVersion: "1.3.1"
},
zod: { singleton: true, eager: true, requiredVersion: '^3.21.4' },
},
}),
],
};
}; Crash LogsLevel Time PID Tag Message TypeError: undefined is not a function Screenshot |
@vlak-koder can you try |
Hi @jbroma , I'm getting this now |
@vlak-koder, fixed this right now, please try |
@jbroma works like magic. Thank you for the support, I appreciate. |
Environment
Description
When I open a mini app and it is still loading, then I go back and try to open another mini app. The app crashes.
So, it does not happen everytime but it happens once in a while.
Also since it's a SIGBUS error, I suspect memory issue on phone.
How can I mitigate against this crash
CRASH THREAD From Firebase
Crashed: Thread: SIGBUS 0x00000071d180a000
#00 pc 0x1d17cc libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#1 pc 0x1d1790 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#2 pc 0x1d25c4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#3 pc 0x1d26c0 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#4 pc 0x1bef18 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#5 pc 0x1bed88 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#6 pc 0x1bf074 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#7 pc 0x196028 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#8 pc 0x1a7a78 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#9 pc 0x176088 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#10 pc 0x88730 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#11 pc 0x97e44 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#12 pc 0x975d4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#13 pc 0x85aac libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#14 pc 0x8564c libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#15 pc 0x965f4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#16 pc 0x97dcc libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#17 pc 0x975d4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#18 pc 0x85aac libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#19 pc 0x8564c libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#20 pc 0x965f4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#21 pc 0x97dcc libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#22 pc 0x975d4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#23 pc 0x862d8 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#24 pc 0xfbe60 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#25 pc 0x859a0 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#26 pc 0x965d0 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#27 pc 0x97dcc libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#28 pc 0x975d4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#29 pc 0x85aac libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#30 pc 0x84ba4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#31 pc 0x11e290 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#32 pc 0x859a0 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#33 pc 0x965d0 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#34 pc 0x97dcc libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#35 pc 0x975d4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#36 pc 0x85aac libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#37 pc 0x8564c libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#38 pc 0x965f4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#39 pc 0x97dcc libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#40 pc 0x975d4 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#41 pc 0x85aac libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#42 pc 0x8564c libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#43 pc 0x781d8 libhermes.so (BuildId: c5e2c3b69efab3b36a67a30259ba77d3856176e5)
#44 pc 0x131f88 libhermes_executor.so (BuildId: 57e4e5e068460e51)
#45 pc 0xab1a4 libreactnativejni.so (BuildId: 768f3e0508321b44)
#46 pc 0xabcc4 libreactnativejni.so (BuildId: 768f3e0508321b44)
#47 pc 0x81150 libreactnativejni.so (BuildId: 768f3e0508321b44)
#48 pc 0x15e84 libfbjni.so (BuildId: 27496b9e5551bff5c79496b936b663bf8868c68b)
#49 pc 0x15dfc libfbjni.so (BuildId: 27496b9e5551bff5c79496b936b663bf8868c68b)
Screenshot of Device details when crash happened
Reproducible Demo
Step to Reproduce
The app crashes as we open MiniApp 3.
So it's not just as it is stated above because it happens once in a while and I suspect it's a memory issue from the crash logs.
How can I resolve this issue? Thanks
The text was updated successfully, but these errors were encountered: