Skip to content
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

Segmentation Fault building with nightlies 56x #5773

Closed
ittaibaratz opened this issue Feb 4, 2021 · 31 comments
Closed

Segmentation Fault building with nightlies 56x #5773

ittaibaratz opened this issue Feb 4, 2021 · 31 comments

Comments

@ittaibaratz
Copy link
Contributor

🐛 bug report

When building our project using the latest nightlies (Tried 562 - 566), the build fails on segmentation fault 11.

🎛 Configuration (.babelrc, package.json, cli command)

parcel build src/index.html --dist-dir ./dist --public-url=$$PUBLIC_PATH --cache-dir ./.parcel-cache --detailed-report

🤔 Expected Behavior

The build should complete successfully.

😯 Current Behavior

The build fails with a segmentation fault as follows:

PID 29707 received SIGSEGV for address: 0x10
0   segfault-handler.node               0x0000000104de1fe0 _ZL16segfault_handleriP9__siginfoPv + 304
1   libsystem_platform.dylib            0x00007fff7289a5fd _sigtramp + 29
2   ???                                 0x0000000000000013 0x0 + 19
3   node.napi.glibc.node                0x0000000106f5adac _ZN16SourceMapBinding18findClosestMappingERKN4Napi12CallbackInfoE + 404
4   node.napi.glibc.node                0x0000000106f5cfa4 _ZN4Napi12InstanceWrapI16SourceMapBindingE29InstanceMethodCallbackWrapperEP10napi_env__P20napi_callback_info__ + 176
5   node.napi.glibc.node                0x0000000106f5cf1a _ZN4Napi12InstanceWrapI16SourceMapBindingE29InstanceMethodCallbackWrapperEP10napi_env__P20napi_callback_info__ + 38
6   node                                0x000000010007b82a _ZN6v8impl12_GLOBAL__N_123FunctionCallbackWrapper6InvokeERKN2v820FunctionCallbackInfoINS2_5ValueEEE + 122
7   node                                0x00000001002a2718 _ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE + 616
8   node                                0x00000001002a1cac _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE + 524
9   node                                0x00000001002a13b7 _ZN2v88internalL26Builtin_Impl_HandleApiCallENS0_16BuiltinArgumentsEPNS0_7IsolateE + 263
10  node                                0x0000000100ac53b9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 57
11  node                                0x0000000100a5e522 Builtins_InterpreterEntryTrampoline + 194
make: *** [dist] Segmentation fault: 11

💁 Possible Solution

Not sure, but perhaps this is the code responsible?
https://github.com/parcel-bundler/source-map/blob/2fba112dc6b29095aea1af052469d33ec6601c78/src/wasm/SourceMap.cpp#L140

🔦 Context

We have a large mono repo with about 12 sub packages. We use lerna and babel. Some packages are Typescript, some are Javascript.

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel ^2.0.0-nightly.566
Node 14.15.4 / 15.2.1
Yarn 1.22.10
Operating System Centos 7.5 / Mac OS Catalina
@danieltroger
Copy link
Contributor

I got this 3 times today, possibly related?

./build_scripts/build: line 7: 25101 Segmentation fault: 11 parcel build <myargs>

Only happens sometimes tho

@ittaibaratz
Copy link
Contributor Author

@danieltroger you can get the segmentation fault stack using segfault-handler in your build script, i.e:

require('segfault-handler').registerHandler();
require('parcel');

@danieltroger
Copy link
Contributor

danieltroger commented Feb 5, 2021

The build script is a simple shell script. Do you have some command for that too?

Also I just cleaned the cache and now it stopped segfaulting again.

@ittaibaratz
Copy link
Contributor Author

Our build script Is a shell script too. Originally it was just:

parcel build src/index.html --dist-dir ./dist --public-url=$$PUBLIC_PATH --cache-dir ./.parcel-cache --detailed-report

For debugging purposes, I created a file called build.js that includes the two lines in my previous comment, then changed the build command to:

node ./build build src/index.html --dist-dir ./dist --public-url=$$PUBLIC_PATH --cache-dir ./.parcel-cache --detailed-report

Also need to add segfault-handler as a dev dependency to the project.

@danieltroger
Copy link
Contributor

Ah shoot now I understand, thanks.

@danieltroger
Copy link
Contributor

danieltroger commented Feb 5, 2021

Well damn it instantly segfaulted

PID 26184 received SIGSEGV for address: 0x8
0   segfault-handler.node               0x0000000104696fa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff54365f5a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   node                                0x0000000100072932 _ZN10napi_env__D0Ev + 14
4   node                                0x000000010004b442 _ZN4node11Environment10RunCleanupEv + 184
5   node                                0x0000000100006a69 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
6   node                                0x000000010013d9e0 _ZN4node6worker6Worker3RunEv + 1600
7   node                                0x0000000100140ac4 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
8   libsystem_pthread.dylib             0x00007fff5436f661 _pthread_body + 340
9   libsystem_pthread.dylib             0x00007fff5436f50d _pthread_body + 0
10  libsystem_pthread.dylib             0x00007fff5436ebf9 thread_start + 13

Another one:

PID 26519 received SIGSEGV for address: 0x8
0   segfault-handler.node               0x0000000104696fa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff54365f5a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   node                                0x0000000100072932 _ZN10napi_env__D0Ev + 14
4   node                                0x000000010004b442 _ZN4node11Environment10RunCleanupEv + 184
5   node                                0x0000000100006a69 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
6   node                                0x000000010013d9e0 _ZN4node6worker6Worker3RunEv + 1600
7   node                                0x0000000100140ac4 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
8   libsystem_pthread.dylib             0x00007fff5436f661 _pthread_body + 340
9   libsystem_pthread.dylib             0x00007fff5436f50d _pthread_body + 0
10  libsystem_pthread.dylib             0x00007fff5436ebf9 thread_start + 13

@danieltroger
Copy link
Contributor

danieltroger commented Feb 5, 2021

It only segfaults when building for IE11 and for certain scripts

@devongovett
Copy link
Member

Possibly related to source maps? cc @DeMoorJasper

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Feb 5, 2021

@devongovett was gonna look into it this weekend, been pretty busy. So will have a look at this tomorrow.

Might also rewrite sourcemaps in Rust at some point in the future :)

@DeMoorJasper
Copy link
Member

Can anyone create a minimal reproduction for this?

Opened a PR that handles a couple more edge cases: parcel-bundler/source-map#50 but not sure if it actually fixes this issue as I've not been able to reproduce it.

@ittaibaratz
Copy link
Contributor Author

@DeMoorJasper we have hundreds of source files in our monorepo, is there a way to tell which one is causing the segmentation fault? If so I can try to reproduce, thank you.

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Feb 8, 2021

@ittaibaratz not sure as you can't really catch a segmentation fault, will look further into how to actually debug this easily if the mentioned PR didn't fix this.

So please test the updated source-map version for now, #5801

@ittaibaratz
Copy link
Contributor Author

Sounds good @DeMoorJasper - Will test it once the next nightly comes out.

@ittaibaratz
Copy link
Contributor Author

So with the latest nightly (577), I no longer see a segmentation fault, however the build fails on something else:

parcel src/index.html --dist-dir ./dist --public-url=$PUBLIC_PATH --cache-dir ./.parcel-cache --detailed-report --log-level verbose
🚨 Build failed.
@parcel/optimizer-terser: Unexpected line terminator
  13997 |             }]
> 13998 |             /**/*/
>       |                 ^ Unexpected line terminator
  13999 |           }]
  14000 |         }, // */
It's likely that Terser doesn't support this syntax yet.
make: *** [dist] Error 1

I don't see any information for the file where the problem occurs, so not sure what more information I can provide. Any ideas?

@danieltroger
Copy link
Contributor

@ittaibaratz is that this issue #5787 ?

@ittaibaratz
Copy link
Contributor Author

@danieltroger looks very similar indeed. Is there a way for me to find out what code is being minified so I can try to workaround this? Lines 13997-14000 above don't reveal much.

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Feb 9, 2021

@ittaibaratz I'm gonna close this issue as there's already an issue for the minification/babel issue you encountered and the original seems to be resolved. Maybe continue the conversation there

About the error not showing the file, it should, I'll create a PR in a bit to add this.

@ittaibaratz
Copy link
Contributor Author

Thanks for the fix @DeMoorJasper !

@danieltroger
Copy link
Contributor

Hey I'm having segfaults running parcel build again. I didn't have any since your fix @DeMoorJasper but they started reappearing today. Dunno tho if they are related?

PID 16636 received SIGSEGV for address: 0x8
0   segfault-handler.node               0x0000000102b83fa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff625fcf5a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   node                                0x000000010007474c _ZN15node_napi_env__D0Ev + 52
4   node                                0x000000010004b301 _ZN4node11Environment10RunCleanupEv + 173
5   node                                0x00000001000067d1 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
6   node                                0x000000010013f148 _ZN4node6worker6Worker3RunEv + 1600
7   node                                0x000000010014222c _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
8   libsystem_pthread.dylib             0x00007fff62606661 _pthread_body + 340
9   libsystem_pthread.dylib             0x00007fff6260650d _pthread_body + 0
10  libsystem_pthread.dylib             0x00007fff62605bf9 thread_start + 13

@danieltroger
Copy link
Contributor

Just faulted again:

PID 24359 received SIGSEGV for address: 0x8
0   segfault-handler.node               0x00000001046dcfa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff5a857f5a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   node                                0x000000010007474c _ZN15node_napi_env__D0Ev + 52
4   node                                0x000000010004b301 _ZN4node11Environment10RunCleanupEv + 173
5   node                                0x00000001000067d1 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
6   node                                0x000000010013f148 _ZN4node6worker6Worker3RunEv + 1600
7   node                                0x000000010014222c _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
8   libsystem_pthread.dylib             0x00007fff5a861661 _pthread_body + 340
9   libsystem_pthread.dylib             0x00007fff5a86150d _pthread_body + 0
10  libsystem_pthread.dylib             0x00007fff5a860bf9 thread_start + 13

node v15.10.0 and parcel 2.0.0-nightly.610+8a4fa3ee

@danieltroger
Copy link
Contributor

AAaaand again, this time with different message:

⠴ Building is-regexp.js...


#
# Fatal error in , line 0
# unreachable code
#
#
#
#FailureMessage Object: 0x70000194d990
 1: 0x100104406 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 2: 0x100b18660 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 3: 0x1003897e2 v8::internal::Scavenger::Process(v8::internal::OneshotBarrier*) [/usr/local/bin/node]
 4: 0x10038c6bf v8::internal::ScavengingTask::ProcessItems() [/usr/local/bin/node]
 5: 0x10038c4d3 v8::internal::ScavengingTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [/usr/local/bin/node]
 6: 0x10034972c v8::internal::ItemParallelJob::Task::RunInternal() [/usr/local/bin/node]
 7: 0x10010172e node::(anonymous namespace)::PlatformWorkerThread(void*) [/usr/local/bin/node]
 8: 0x7fff5a861661 _pthread_body [/usr/lib/system/libsystem_pthread.dylib]
 9: 0x7fff5a86150d _pthread_body [/usr/lib/system/libsystem_pthread.dylib]
10: 0x7fff5a860bf9 thread_start [/usr/lib/system/libsystem_pthread.dylib]
./build_scripts/build: line 8: 24661 Illegal instruction: 4 

@mischnic
Copy link
Member

mischnic commented Mar 1, 2021

Regarding the "unreachable code" one: nodejs/node#34506

@danieltroger
Copy link
Contributor

Ah shoot, that sucks. Seems like all of these are errors that are impossible to debug? Can I install something that writes everything to disk so there's more information when it segfaults? I have an empty 8TB drive.

I got my special segfault again btw:

PID 87540 received SIGSEGV for address: 0x8
0   segfault-handler.node               0x00000001046dcfa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff5c050f5a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   node                                0x000000010007474c _ZN15node_napi_env__D0Ev + 52
4   node                                0x000000010004b301 _ZN4node11Environment10RunCleanupEv + 173
5   node                                0x00000001000067d1 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
6   node                                0x000000010013f148 _ZN4node6worker6Worker3RunEv + 1600
7   node                                0x000000010014222c _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
8   libsystem_pthread.dylib             0x00007fff5c05a661 _pthread_body + 340
9   libsystem_pthread.dylib             0x00007fff5c05a50d _pthread_body + 0
10  libsystem_pthread.dylib             0x00007fff5c059bf9 thread_start + 13

@mischnic
Copy link
Member

mischnic commented Mar 2, 2021

Are you able to trigger this somewhat consistently? Getting a reproduction for that would be great.

One way to debug this is starting Node inside a debugger (gdb or lldb).

@danieltroger
Copy link
Contributor

Are you able to trigger this somewhat consistently?

It happens randomly around once a day :(
Am currently building all my JS in a while loop and hoping for it to trigger but it doesn't want to.

One way to debug this is starting Node inside a debugger (gdb or lldb).

Do you happen to know what I can prefix node in my package.json's scripts so that it always runs in lldb and just breaks when it segfaults?

@danieltroger
Copy link
Contributor

I tried to ctrl+c my parcel running in a loop because I wanted to run set -e and got surprised by a new segfault!

I suppose it happens when one ctrl+c's too early?

BTW earlier today I got parcel serve to ignore ctrl+c by deleting the cache while it ran. It printed "parcel is exiting" eagerly but didn't do anything.

Further BTW: when moving away the main file that parcel serve watches and moving it back it's not redetected.

Just writing here for my conscience and your information, am too lazy to report as closing my terminal window and rerunning serve solved it.

FATAL ERROR: v8::FromJust Maybe value is Nothing.
 1: 0x10009c868 node::Abort() [/usr/local/bin/node]
 2: 0x10009c9ca void node::FPrintF<char const*&, char const*&>(__sFILE*, char const*, char const*&&&, char const*&&&) [/usr/local/bin/node]
 3: 0x1001f560e v8::Utils::ReportApiFailure(char const*, char const*) [/usr/local/bin/node]
 4: 0x1000089c8 node::UVException(v8::Isolate*, int, char const*, char const*, char const*, char const*) [/usr/local/bin/node]
 5: 0x1000a4c52 node::fs::FSReqAfterScope::Reject(uv_fs_s*) [/usr/local/bin/node]
 6: 0x1000a4def node::fs::AfterInteger(uv_fs_s*) [/usr/local/bin/node]
 7: 0x1007a46f8 uv__work_done [/usr/local/bin/node]
 8: 0x1007a7f1d uv__async_io [/usr/local/bin/node]
 9: 0x1007b9149 uv__io_poll [/usr/local/bin/node]
10: 0x1007a839c uv_run [/usr/local/bin/node]
11: 0x1000042c3 node::SpinEventLoop(node::Environment*) [/usr/local/bin/node]
12: 0x10013f0ac node::worker::Worker::Run() [/usr/local/bin/node]
13: 0x10014222c node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/usr/local/bin/node]
14: 0x7fff5c05a661 _pthread_body [/usr/lib/system/libsystem_pthread.dylib]
15: 0x7fff5c05a50d _pthread_body [/usr/lib/system/libsystem_pthread.dylib]
16: 0x7fff5c059bf9 thread_start [/usr/lib/system/libsystem_pthread.dylib]

@danieltroger
Copy link
Contributor

danieltroger commented Mar 2, 2021

Yeah the default segfault is definitely reproducible. It takes like 10 mintues so it's not possible to attach a debugger manually to every run, but if it can be automated it should be debuggable.

PID 9630 received SIGSEGV for address: 0x8
0   segfault-handler.node               0x00000001046dcfa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff5c050f5a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   node                                0x000000010007474c _ZN15node_napi_env__D0Ev + 52
4   node                                0x000000010004b301 _ZN4node11Environment10RunCleanupEv + 173
5   node                                0x00000001000067d1 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
6   node                                0x000000010013f148 _ZN4node6worker6Worker3RunEv + 1600
7   node                                0x000000010014222c _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
8   libsystem_pthread.dylib             0x00007fff5c05a661 _pthread_body + 340
9   libsystem_pthread.dylib             0x00007fff5c05a50d _pthread_body + 0
10  libsystem_pthread.dylib             0x00007fff5c059bf9 thread_start + 13
./build_scripts/build: line 8:  9630 Segmentation fault: 11

Edit: slightly different variant from a day later:

PID 1439 received SIGSEGV for address: 0x0
0   segfault-handler.node               0x00000001046e9fa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff52162f5a _sigtramp + 26
2   ???                                 0x00007000113bfdf0 0x0 + 123145591455216
3   node                                0x0000000100075044 _ZZN15node_napi_env__13CallFinalizerEPFvP10napi_env__PvS2_ES2_S2_ENKUlPN4node11EnvironmentEE_clES7_ + 36
4   node                                0x000000010004b761 _ZZN4node11Environment27RunAndClearNativeImmediatesEbENK3$_5clEPNS_13CallbackQueueIvJPS0_EEE + 165
5   node                                0x000000010004b1c4 _ZN4node11Environment27RunAndClearNativeImmediatesEb + 166
6   node                                0x000000010004b03e _ZN4node11Environment14CleanupHandlesEv + 86
7   node                                0x000000010004b44d _ZN4node11Environment10RunCleanupEv + 201
8   node                                0x00000001000067d5 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
9   node                                0x0000000100143193 _ZN4node6worker6Worker3RunEv + 1603
10  node                                0x0000000100146282 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
11  libsystem_pthread.dylib             0x00007fff5216c661 _pthread_body + 340
12  libsystem_pthread.dylib             0x00007fff5216c50d _pthread_body + 0
13  libsystem_pthread.dylib             0x00007fff5216bbf9 thread_start + 13
./build_scripts/build: line 8:  1439 Segmentation fault: 11

Edit: a week later on parcel 2.0.0-nightly.619+28eec7be node v15.11.0:

0   segfault-handler.node               0x00000001046e9fa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff68ce6f5a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   node                                0x0000000100075053 _ZZN15node_napi_env__13CallFinalizerEPFvP10napi_env__PvS2_ES2_S2_ENKUlPN4node11EnvironmentEE_clES7_ + 51
4   node                                0x000000010004b761 _ZZN4node11Environment27RunAndClearNativeImmediatesEbENK3$_5clEPNS_13CallbackQueueIvJPS0_EEE + 165
5   node                                0x000000010004b1c4 _ZN4node11Environment27RunAndClearNativeImmediatesEb + 166
6   node                                0x000000010004b03e _ZN4node11Environment14CleanupHandlesEv + 86
7   node                                0x000000010004b44d _ZN4node11Environment10RunCleanupEv + 201
8   node                                0x00000001000067d5 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
9   node                                0x0000000100143193 _ZN4node6worker6Worker3RunEv + 1603
10  node                                0x0000000100146282 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
11  libsystem_pthread.dylib             0x00007fff68cf0661 _pthread_body + 340
12  libsystem_pthread.dylib             0x00007fff68cf050d _pthread_body + 0
13  libsystem_pthread.dylib             0x00007fff68cefbf9 thread_start + 13
./build_scripts/build: line 8: 28374 Segmentation fault: 11 

Edit: another one, 9 days later:

PID 1132 received SIGSEGV for address: 0x0
0   segfault-handler.node               0x00000001046e9fa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff6ef50f5a _sigtramp + 26
2   ???                                 0x00007000143f1df0 0x0 + 123145641991664
3   node                                0x0000000100075044 _ZZN15node_napi_env__13CallFinalizerEPFvP10napi_env__PvS2_ES2_S2_ENKUlPN4node11EnvironmentEE_clES7_ + 36
4   node                                0x000000010004b761 _ZZN4node11Environment27RunAndClearNativeImmediatesEbENK3$_5clEPNS_13CallbackQueueIvJPS0_EEE + 165
5   node                                0x000000010004b1c4 _ZN4node11Environment27RunAndClearNativeImmediatesEb + 166
6   node                                0x000000010004b03e _ZN4node11Environment14CleanupHandlesEv + 86
7   node                                0x000000010004b44d _ZN4node11Environment10RunCleanupEv + 201
8   node                                0x00000001000067d5 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
9   node                                0x0000000100143193 _ZN4node6worker6Worker3RunEv + 1603
10  node                                0x0000000100146282 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
11  libsystem_pthread.dylib             0x00007fff6ef5a661 _pthread_body + 340
12  libsystem_pthread.dylib             0x00007fff6ef5a50d _pthread_body + 0
13  libsystem_pthread.dylib             0x00007fff6ef59bf9 thread_start + 13
./build_scripts/build: line 8:  1132 Segmentation fault: 11

Edit: new one from same day as last one

PID 6459 received SIGSEGV for address: 0x0
0   segfault-handler.node               0x00000001046e9fa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff6ef50f5a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   node                                0x0000000100075053 _ZZN15node_napi_env__13CallFinalizerEPFvP10napi_env__PvS2_ES2_S2_ENKUlPN4node11EnvironmentEE_clES7_ + 51
4   node                                0x000000010004b761 _ZZN4node11Environment27RunAndClearNativeImmediatesEbENK3$_5clEPNS_13CallbackQueueIvJPS0_EEE + 165
5   node                                0x000000010004b1c4 _ZN4node11Environment27RunAndClearNativeImmediatesEb + 166
6   node                                0x000000010004b03e _ZN4node11Environment14CleanupHandlesEv + 86
7   node                                0x000000010004b44d _ZN4node11Environment10RunCleanupEv + 201
8   node                                0x00000001000067d5 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
9   node                                0x0000000100143193 _ZN4node6worker6Worker3RunEv + 1603
10  node                                0x0000000100146282 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
11  libsystem_pthread.dylib             0x00007fff6ef5a661 _pthread_body + 340
12  libsystem_pthread.dylib             0x00007fff6ef5a50d _pthread_body + 0
13  libsystem_pthread.dylib             0x00007fff6ef59bf9 thread_start + 13
./build_scripts/build: line 8:  6459 Segmentation fault: 11 

Edit: new one after 13 days:

PID 8763 received SIGSEGV for address: 0x0
0   segfault-handler.node               0x00000001046e9fa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff50873f5a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   node                                0x0000000100075053 _ZZN15node_napi_env__13CallFinalizerEPFvP10napi_env__PvS2_ES2_S2_ENKUlPN4node11EnvironmentEE_clES7_ + 51
4   node                                0x000000010004b761 _ZZN4node11Environment27RunAndClearNativeImmediatesEbENK3$_5clEPNS_13CallbackQueueIvJPS0_EEE + 165
5   node                                0x000000010004b1c4 _ZN4node11Environment27RunAndClearNativeImmediatesEb + 166
6   node                                0x000000010004b03e _ZN4node11Environment14CleanupHandlesEv + 86
7   node                                0x000000010004b44d _ZN4node11Environment10RunCleanupEv + 201
8   node                                0x00000001000067d5 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
9   node                                0x0000000100143193 _ZN4node6worker6Worker3RunEv + 1603
10  node                                0x0000000100146282 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
11  libsystem_pthread.dylib             0x00007fff5087d661 _pthread_body + 340
12  libsystem_pthread.dylib             0x00007fff5087d50d _pthread_body + 0
13  libsystem_pthread.dylib             0x00007fff5087cbf9 thread_start + 13
./build_scripts/build: line 8:  8763 Segmentation fault: 11

Edit: 16 days later, parcel 2.0.0-nightly.628+dc09f125, node v15.11.0:

PID 45543 received SIGSEGV for address: 0x0
0   segfault-handler.node               0x00000001046e9fa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff58b98f5a _sigtramp + 26
2   ???                                 0x0000700008fc6df0 0x0 + 123145453071856
3   node                                0x0000000100075044 _ZZN15node_napi_env__13CallFinalizerEPFvP10napi_env__PvS2_ES2_S2_ENKUlPN4node11EnvironmentEE_clES7_ + 36
4   node                                0x000000010004b761 _ZZN4node11Environment27RunAndClearNativeImmediatesEbENK3$_5clEPNS_13CallbackQueueIvJPS0_EEE + 165
5   node                                0x000000010004b1c4 _ZN4node11Environment27RunAndClearNativeImmediatesEb + 166
6   node                                0x000000010004b03e _ZN4node11Environment14CleanupHandlesEv + 86
7   node                                0x000000010004b44d _ZN4node11Environment10RunCleanupEv + 201
8   node                                0x00000001000067d5 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
9   node                                0x0000000100143193 _ZN4node6worker6Worker3RunEv + 1603
10  node                                0x0000000100146282 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
11  libsystem_pthread.dylib             0x00007fff58ba2661 _pthread_body + 340
12  libsystem_pthread.dylib             0x00007fff58ba250d _pthread_body + 0
13  libsystem_pthread.dylib             0x00007fff58ba1bf9 thread_start + 13
./build_scripts/build: line 8: 45543 Segmentation fault: 11  node ./build_scripts/parcel build

Edit: 17 days later, I'm starting to see a pattern - everytime I switch branches without clearing cache it segfaults

PID 15889 received SIGSEGV for address: 0x0
0   segfault-handler.node               0x00000001046edfa8 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff7ebfff5a _sigtramp + 26
2   ???                                 0x000070000b242df0 0x0 + 123145489231344
3   node                                0x00000001000759d6 _ZZN15node_napi_env__13CallFinalizerEPFvP10napi_env__PvS2_ES2_S2_ENKUlPN4node11EnvironmentEE_clES7_ + 36
4   node                                0x000000010004b555 _ZZN4node11Environment27RunAndClearNativeImmediatesEbENK3$_5clEPNS_13CallbackQueueIvJPS0_EEE + 165
5   node                                0x000000010004afb8 _ZN4node11Environment27RunAndClearNativeImmediatesEb + 166
6   node                                0x000000010004ae32 _ZN4node11Environment14CleanupHandlesEv + 86
7   node                                0x000000010004b241 _ZN4node11Environment10RunCleanupEv + 201
8   node                                0x00000001000067d5 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 116
9   node                                0x00000001001430ac _ZN4node6worker6Worker3RunEv + 1600
10  node                                0x00000001001461c2 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 50
11  libsystem_pthread.dylib             0x00007fff7ec09661 _pthread_body + 340
12  libsystem_pthread.dylib             0x00007fff7ec0950d _pthread_body + 0
13  libsystem_pthread.dylib             0x00007fff7ec08bf9 thread_start + 13
./build_scripts/build: line 8: 15889 Segmentation fault: 11  node

@GauBen
Copy link

GauBen commented Mar 4, 2021

I have a consistant segfault on cold builds, it's reproducible:
https://github.com/GauBen/gauben.github.io/runs/2025608512

When the cache folder exists, there is no such problem:
https://github.com/GauBen/gauben.github.io/runs/2025668435

How to reproduce

Versions: node v15.11.0, yarn v1.22.5, parcel v2.0.0-nightly.612

git clone git@github.com:GauBen/gauben.github.io.git
yarn build

Current workaround

git clone git@github.com:GauBen/gauben.github.io.git
yarn build || yarn build

(Only the first one segfaults)

Package.json: https://github.com/GauBen/gauben.github.io/blob/source/package.json

@mischnic
Copy link
Member

mischnic commented Mar 4, 2021

Let's handle this in a new issue: #5961

@danieltroger
Copy link
Contributor

Hey, what should I do for all my errors in the future?

Should I open separate issues?
They're all very random so I doubt they're going to be fixed anytime soon. Just had a new one:

$ npx parcel --version
2.0.0-nightly.610+8a4fa3ee
$ node --version
v15.11.0
#
# Fatal error in , line 0
# unreachable code
#
#
#
#FailureMessage Object: 0x70000f697990


#
# Fatal error in , line 0
# unreachable code
#
#
#
#FailureMessage Object: 0x70000ee94990
PID 7081 received SIGSEGV for address: 0x15900000008


#
# Fatal error in , line 0
# unreachable code
#
#
#
#FailureMessage Object: 0x70000e691990
 1: 0x10010585e node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 1: 0x10010585e node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
⠧ Bundling...
 2: 0x100b1cc98 V8_Fatal(char const*, ...) [/usr/local/bin/node]


#
# Fatal error in , line 0
# unreachable code
#
#
#
#FailureMessage Object: 0x7000132b4f30
 2: 0x100b1cc98 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 2: 0x100b1cc98 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 3: 0x10038e14a v8::internal::Scavenger::Process(v8::internal::OneshotBarrier*) [/usr/local/bin/node]
 1: 0x10010585e node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 3: 0x10038e14a v8::internal::Scavenger::Process(v8::internal::OneshotBarrier*) [/usr/local/bin/node]
 3: 0x10038e14a v8::internal::Scavenger::Process(v8::internal::OneshotBarrier*) [/usr/local/bin/node]
 4: 0x100391027 v8::internal::ScavengingTask::ProcessItems() [/usr/local/bin/node]
 2: 0x100b1cc98 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 4: 0x100391027 v8::internal::ScavengingTask::ProcessItems() [/usr/local/bin/node]
 4: 0x100391027 v8::internal::ScavengingTask::ProcessItems() [/usr/local/bin/node]
 5: 0x100390e3b v8::internal::ScavengingTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [/usr/local/bin/node]
 3: 0x10038e14a v8::internal::Scavenger::Process(v8::internal::OneshotBarrier*) [/usr/local/bin/node]
 5: 0x100390e3b v8::internal::ScavengingTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [/usr/local/bin/node]
 5: 0x100390e3b v8::internal::ScavengingTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [/usr/local/bin/node]
 6: 0x10034e094 v8::internal::ItemParallelJob::Task::RunInternal() [/usr/local/bin/node]
 4: 0x100391027 v8::internal::ScavengingTask::ProcessItems() [/usr/local/bin/node]
 6: 0x10034e094 v8::internal::ItemParallelJob::Task::RunInternal() [/usr/local/bin/node]
 6: 0x10034e094 v8::internal::ItemParallelJob::Task::RunInternal() [/usr/local/bin/node]
 7: 0x100102b86 node::(anonymous namespace)::PlatformWorkerThread(void*) [/usr/local/bin/node]
 5: 0x100390f58 v8::internal::ScavengingTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [/usr/local/bin/node]
 7: 0x100102b86 node::(anonymous namespace)::PlatformWorkerThread(void*) [/usr/local/bin/node]
 7: 0x100102b86 node::(anonymous namespace)::PlatformWorkerThread(void*) [/usr/local/bin/node]
 8: 0x7fff5232c661 _pthread_body [/usr/lib/system/libsystem_pthread.dylib]
 6: 0x10034e094 v8::internal::ItemParallelJob::Task::RunInternal() [/usr/local/bin/node]
 8: 0x7fff5232c661 _pthread_body [/usr/lib/system/libsystem_pthread.dylib]
 8: 0x7fff5232c661 _pthread_body [/usr/lib/system/libsystem_pthread.dylib]
 9: 0x7fff5232c50d _pthread_body [/usr/lib/system/libsystem_pthread.dylib]
 7: 0x10034e430 v8::internal::ItemParallelJob::Run() [/usr/local/bin/node]
 9: 0x7fff5232c50d _pthread_body [/usr/lib/system/libsystem_pthread.dylib]
 9: 0x7fff5232c50d _pthread_body [/usr/lib/system/libsystem_pthread.dylib]
10: 0x7fff5232bbf9 thread_start [/usr/lib/system/libsystem_pthread.dylib]
./build_scripts/build: line 8:  7081 Illegal instruction: 4

@mischnic
Copy link
Member

mischnic commented Mar 5, 2021

Please open one for all "unreachable code", they might all be related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants