File tree 5 files changed +39
-3
lines changed
5 files changed +39
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @atlaspack/core ' : patch
3
+ ---
4
+
5
+ Fix segmentation fault on exit on certain cases
Original file line number Diff line number Diff line change @@ -58,11 +58,16 @@ import {
58
58
fromProjectPathRelative ,
59
59
} from './projectPath' ;
60
60
import { tracer } from '@atlaspack/profiler' ;
61
- import { setFeatureFlags , DEFAULT_FEATURE_FLAGS } from '@atlaspack/feature-flags' ;
61
+ import {
62
+ getFeatureFlag ,
63
+ setFeatureFlags ,
64
+ DEFAULT_FEATURE_FLAGS ,
65
+ } from '@atlaspack/feature-flags' ;
62
66
import { AtlaspackV3 , FileSystemV3 } from './atlaspack-v3' ;
63
67
import createAssetGraphRequestJS from './requests/AssetGraphRequest' ;
64
68
import { createAssetGraphRequestRust } from './requests/AssetGraphRequestRust' ;
65
69
import type { AssetGraphRequestResult } from './requests/AssetGraphRequest' ;
70
+ import { loadRustWorkerThreadDylibHack } from './rustWorkerThreadDylibHack' ;
66
71
67
72
registerCoreWithSerializer ( ) ;
68
73
@@ -117,6 +122,10 @@ export default class Atlaspack {
117
122
} ;
118
123
setFeatureFlags ( featureFlags ) ;
119
124
125
+ if ( getFeatureFlag ( 'enableRustWorkerThreadDylibHack' ) ) {
126
+ loadRustWorkerThreadDylibHack ( ) ;
127
+ }
128
+
120
129
await initSourcemaps ;
121
130
await initRust ?. ( ) ;
122
131
Original file line number Diff line number Diff line change
1
+ // @flow strict-local
2
+
3
+ /**
4
+ * This is a workaround for https://github.com/rust-lang/rust/issues/91979
5
+ * when running atlaspack with parcel bindings, it is possible that the parcel
6
+ * dylib will be loaded from a node worker thread, which causes a crash on exit.
7
+ *
8
+ * This is a workaround to ensure that the parcel dylib is loaded in the main
9
+ * thread, which fixes the crash.
10
+ */
11
+ export function loadRustWorkerThreadDylibHack ( ) {
12
+ try {
13
+ // $FlowFixMe
14
+ require ( '@parcel/rust' ) ; // eslint-disable-line
15
+ } catch ( err ) {
16
+ /* ignore */
17
+ }
18
+ }
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ export const DEFAULT_FEATURE_FLAGS: FeatureFlags = {
20
20
inlineBundlesSourceMapFixes : false ,
21
21
conditionalBundlingNestedRuntime : false ,
22
22
patchProjectPaths : false ,
23
- inlineStringReplacementPerf : false ,
23
+ enableRustWorkerThreadDylibHack : false ,
24
+ inlineStringReplacementPerf : true ,
24
25
} ;
25
26
26
27
let featureFlagValues : FeatureFlags = { ...DEFAULT_FEATURE_FLAGS } ;
Original file line number Diff line number Diff line change @@ -58,7 +58,10 @@ export type FeatureFlags = {|
58
58
* This feature is experimental and should not be used in production. It will used to test downloadble cache artefacts.
59
59
*/
60
60
patchProjectPaths : boolean ,
61
-
61
+ /**
62
+ * Enable loading of the parcel dylib in the main thread.
63
+ */
64
+ enableRustWorkerThreadDylibHack : boolean ,
62
65
/**
63
66
* Enables optimized inline string replacement perf for the packager.
64
67
* Used heavily for inline bundles.
You can’t perform that action at this time.
0 commit comments