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 using wildcard in ignore option on Node.js 22.7.0 #184

Open
mtsmfm opened this issue Aug 26, 2024 · 5 comments
Open

Segmentation fault using wildcard in ignore option on Node.js 22.7.0 #184

mtsmfm opened this issue Aug 26, 2024 · 5 comments

Comments

@mtsmfm
Copy link

mtsmfm commented Aug 26, 2024

Description

ref: #170 (comment)

The following code causes segmentation fault

import watcher from "@parcel/watcher";

watcher.subscribe(
  process.cwd(),
  () => {
    console.log("src changed");
  },
  { ignore: [".git/*"] }
);

Steps to reproduce

  1. Clone https://github.com/mtsmfm/parcel-watcher-segv
  2. npm install
  3. node index.mjs

Actual result

$ node -v
v22.7.0

$ node index.mjs
[1]    2710 segmentation fault  node index.mjs

Expectation

node index.mjs keeps subscribing current dir

Other info

I can reproduce this issue with v2.4.2-alpha.0

@mtsmfm

This comment was marked as resolved.

@devongovett
Copy link
Member

This does not reproduce on my system (macOS 14.1). What OS are you using?

Can you try running in a debugger (e.g. lldb or gdb) and report the backtrace where the segfault is occurring? We have not changed anything in @parcel/watcher so I'm wondering if it is our bug or Node's.

lldb `which node` index.mjs

Then type run and press enter. Once it crashes, run bt to show the backtrace and paste the result here.

@joshmossas
Copy link

joshmossas commented Aug 26, 2024

@devongovett
Not OP but I'm running into this issue on Linux. (Pop!_OS 22.04 LTS)

Here's the output from the debugger

lldb `which node` index.mjs
(lldb) target create "/home/joshmossas/.nvm/versions/node/v22.7.0/bin/node"
Current executable set to '/home/joshmossas/.nvm/versions/node/v22.7.0/bin/node' (x86_64).
(lldb) settings set -- target.run-args  "index.mjs"
(lldb) run
Process 151458 launched: '/home/joshmossas/.nvm/versions/node/v22.7.0/bin/node' (x86_64)
Process 151458 stopped and restarted: thread 1 received signal: SIGCHLD
Process 151458 stopped
* thread #1, name = 'node', stop reason = signal SIGSEGV: address access protected (fault address: 0x665d290)
    frame #0: 0x000000000665d290
->  0x665d290: lock   
    0x665d291: andl   %ebp, (%rax)
    0x665d293: int    $0xff
    0x665d295: jg     0x665d297
Target 0: (node) stopped.
(lldb) bt
* thread #1, name = 'node', stop reason = signal SIGSEGV: address access protected (fault address: 0x665d290)
  * frame #0: 0x000000000665d290
    frame #1: 0x00007fffcd054505 watcher.node`std::__detail::_Compiler<std::regex_traits<char>>::_M_atom() + 1877
    frame #2: 0x00007fffcd0548a0 watcher.node`std::__detail::_Compiler<std::regex_traits<char>>::_M_alternative() + 192
    frame #3: 0x00007fffcd054816 watcher.node`std::__detail::_Compiler<std::regex_traits<char>>::_M_alternative() + 54
    frame #4: 0x00007fffcd0549ec watcher.node`std::__detail::_Compiler<std::regex_traits<char>>::_M_disjunction() + 28
    frame #5: 0x00007fffcd05517b watcher.node`std::__detail::_Compiler<std::regex_traits<char>>::_Compiler(char const*, char const*, std::locale const&, std::regex_constants::syntax_option_type) + 891
    frame #6: 0x00007fffcd0555be watcher.node`std::enable_if<std::__detail::__is_contiguous_normal_iter<char const*>::value, std::shared_ptr<std::__detail::_NFA<std::regex_traits<char>> const>>::type std::__detail::__compile_nfa<char const*, std::regex_traits<char>>(std::shared_ptr, std::shared_ptr, std::__detail::_NFA<std::regex_traits<char>> const::locale_type const&, std::regex_constants::syntax_option_type) + 46
    frame #7: 0x00007fffcd043e47 watcher.node`Glob::Glob(std::string) + 199
    frame #8: 0x00007fffcd02782d watcher.node`getIgnoreGlobs(Napi::Env, Napi::Value) + 621
    frame #9: 0x00007fffcd02a066 watcher.node`subscribe(Napi::CallbackInfo const&) + 470
    frame #10: 0x00007fffcd02ccea watcher.node`Napi::details::CallbackData<Napi::Value (*)(Napi::CallbackInfo const&), Napi::Value>::Wrapper(napi_env__*, napi_callback_info__*) + 218
    frame #11: 0x0000000000f1ec89 node`v8impl::(anonymous namespace)::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) + 137
    frame #12: 0x0000000003220420 node`vtable for v8impl::(anonymous namespace)::FunctionCallbackWrapper + 16
    frame #13: 0x00007fffefc0f6e2
    frame #14: 0x00007fffefc0d8de
    frame #15: 0x00007fffefc0d8de
    frame #16: 0x00007fffefc4fc0d
    frame #17: 0x00007fffefc0b4dc
    frame #18: 0x00007fffefc0b203
    frame #19: 0x00000000013b11f3 node`v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) + 307
    frame #20: 0x00000000013b20ae node`v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) (.constprop.0) + 78
    frame #21: 0x00000000013b2552 node`v8::internal::Execution::TryCall(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*, v8::internal::Execution::MessageHandling, v8::internal::MaybeHandle<v8::internal::Object>*) + 82
    frame #22: 0x000000000177514c node`v8::internal::SourceTextModule::ExecuteModule(v8::internal::Isolate*, v8::internal::Handle<v8::internal::SourceTextModule>, v8::internal::MaybeHandle<v8::internal::Object>*) + 172
    frame #23: 0x0000000001775744 node`v8::internal::SourceTextModule::InnerModuleEvaluation(v8::internal::Isolate*, v8::internal::Handle<v8::internal::SourceTextModule>, v8::internal::ZoneForwardList<v8::internal::Handle<v8::internal::SourceTextModule>>*, unsigned int*) + 1380
    frame #24: 0x000000000177596d node`v8::internal::SourceTextModule::Evaluate(v8::internal::Isolate*, v8::internal::Handle<v8::internal::SourceTextModule>) + 205
    frame #25: 0x0000000001253b92 node`v8::Module::Evaluate(v8::Local<v8::Context>) + 418
    frame #26: 0x0000000000f39fbf node`node::loader::ModuleWrap::Evaluate(v8::FunctionCallbackInfo<v8::Value> const&) + 1007
    frame #27: 0x00007fffefc0f6e2
    frame #28: 0x00007fffefc0d8de
    frame #29: 0x00007fffefc4cac3
    frame #30: 0x00007fffefd2b375
    frame #31: 0x00007fffefc3ca19
    frame #32: 0x00007fffefc0b403
    frame #33: 0x00000000013b1415 node`v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) + 853
    frame #34: 0x00000000013b264a node`v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) + 138
    frame #35: 0x00000000013e52d9 node`v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) + 217
    frame #36: 0x00000000013e5693 node`v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) + 67
    frame #37: 0x0000000000e8b3ab node`node::InternalCallbackScope::Close() + 251
    frame #38: 0x0000000000e8b5e1 node`node::InternalCallbackScope::~InternalCallbackScope() + 17
    frame #39: 0x0000000001017ae2 node`node::PerIsolatePlatformData::RunForegroundTask(std::unique_ptr<v8::Task, std::default_delete<v8::Task>>) (.part.0) + 210
    frame #40: 0x000000000101b105 node`node::PerIsolatePlatformData::FlushForegroundTasksInternal() + 709
    frame #41: 0x000000000101b638 node`node::NodePlatform::DrainTasks(v8::Isolate*) + 120
    frame #42: 0x0000000000e8c6c1 node`node::SpinEventLoopInternal(node::Environment*) + 369
    frame #43: 0x0000000000fe4391 node`node::NodeMainInstance::Run() + 257
    frame #44: 0x0000000000f4361b node`node::Start(int, char**) + 1003
    frame #45: 0x00007ffff7829d90 libc.so.6`___lldb_unnamed_symbol3139 + 128
    frame #46: 0x00007ffff7829e40 libc.so.6`__libc_start_main + 128
    frame #47: 0x0000000000e8946e node`_start + 46
(lldb) 

@mtsmfm
Copy link
Author

mtsmfm commented Aug 27, 2024

What OS are you using?

@devongovett I'm using Ubuntu 22.04.4 LTS on WSL (5.15.153.1-microsoft-standard-WSL2)

@Amplifiyer
Copy link

It's reproducible on Ubuntu and Fedora workstation as well (Linux 6.8 Fedora Linux 40.20240730.0 (Silverblue)). Works fine on MacOS

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

No branches or pull requests

5 participants
@devongovett @mtsmfm @joshmossas @Amplifiyer and others