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

test: [email protected] segmentation fault #3

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

test: [email protected] segmentation fault #3

wants to merge 6 commits into from

Conversation

yisibl
Copy link
Owner

@yisibl yisibl commented Mar 14, 2022

How to debug in macOS?

Preparation

  1. resvg-js add debug = true to Cargo.toml
[profile.release]
debug = true
lto = true
opt-level = 3
codegen-units = 1
  1. npm run build:debug
  2. Copy resvgjs.darwin-x64.node from the resvg-js root directory to svg-sprite/node_modules/@resvg/resvg-js-darwin-x64/
  3. Switch to Node 12, for example, using nvm nvm use v12.22.10
  4. Streamline the test cases and see if errors can occur. run npm test
> mocha "test/**/*.test.js"

  calculateSvgDimensions
    ✔ should return the expected dimensions from 46x46 fixture

  1 passing (41ms)

[1]    10147 segmentation fault  npm test
  1. Enable coredump

See also: https://stackoverflow.com/questions/9412156/how-to-generate-core-dumps-in-mac-os-x

sudo sysctl -w kern.coredump=1
ulimit -c unlimited
ls /cores # The dumped files will be in this directory, so please empty it if you have any files currently.
  1. Run npm test again, wait for the error to be reported, and the dump file will be generated.
  2. Install lldb use brew install llvm
lldb -v
lldb-1100.0.30.12
Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)

ls /cores
core.10147  core.10148  core.10149  core.10150
  1. lldb -c core.10149 and input bt
$ lldb -c core.10147
(lldb) target create --core "core.10147"
bt
Core file '/cores/core.10147' (x86_64) was loaded.
(lldb) bt
* thread #1, stop reason = signal SIGSTOP
  * frame #0: 0x00007fff7588bbfa libsystem_kernel.dylib`__kill + 10
    frame #1: 0x0000000100974139 node`uv_kill + 9
    frame #2: 0x0000000100118748 node`node::Kill(v8::FunctionCallbackInfo<v8::Value> const&) + 280
    frame #3: 0x000000010025b6c8 node`v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) + 616
    frame #4: 0x000000010025ac89 node`v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) + 521
    frame #5: 0x000000010025a3f2 node`v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) + 258
    frame #6: 0x0000000100a04279 node`Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 57
    frame #7: 0x0000000100989a04 node`Builtins_InterpreterEntryTrampoline + 676
    frame #8: 0x0000000100989a04 node`Builtins_InterpreterEntryTrampoline + 676
    frame #9: 0x0000000100989a04 node`Builtins_InterpreterEntryTrampoline + 676
    frame #10: 0x000000010098305c node`Builtins_ArgumentsAdaptorTrampoline + 188
    frame #11: 0x0000000100989a04 node`Builtins_InterpreterEntryTrampoline + 676
    frame #12: 0x0000000100989a04 node`Builtins_InterpreterEntryTrampoline + 676
    frame #13: 0x000000010098305c node`Builtins_ArgumentsAdaptorTrampoline + 188
    frame #14: 0x0000000100989a04 node`Builtins_InterpreterEntryTrampoline + 676
    frame #15: 0x0000000100989a04 node`Builtins_InterpreterEntryTrampoline + 676
    frame #16: 0x0000000100986f7d node`Builtins_JSEntryTrampoline + 93
    frame #17: 0x0000000100986d58 node`Builtins_JSEntry + 120
    frame #18: 0x000000010032394f node`v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) + 863
    frame #19: 0x00000001003235db node`v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) + 203
    frame #20: 0x000000010020cad0 node`v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) + 432
    frame #21: 0x0000000100002290 node`node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) + 800
    frame #22: 0x00000001000165a8 node`node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) + 200
    frame #23: 0x0000000100158c6a node`node::(anonymous namespace)::ProcessWrap::OnExit(uv_process_s*, long long, int) + 282
    frame #24: 0x0000000100973b67 node`uv__chld + 231
    frame #25: 0x0000000100975602 node`uv__signal_event + 242
    frame #26: 0x000000010097ef51 node`uv__io_poll + 2241
    frame #27: 0x000000010096b651 node`uv_run + 433
    frame #28: 0x00000001000e9527 node`node::NodeMainInstance::Run() + 375
    frame #29: 0x000000010007b309 node`node::Start(int, char**) + 313
    frame #30: 0x00007fff757503d5 libdyld.dylib`start + 1
    frame #31: 0x00007fff757503d5 libdyld.dylib`start + 1

@coveralls
Copy link

coveralls commented Mar 14, 2022

Pull Request Test Coverage Report for Build 2034392438

  • 106 of 108 (98.15%) changed or added relevant lines in 8 files are covered.
  • 19 unchanged lines in 6 files lost coverage.
  • Overall coverage increased (+4.4%) to 85.036%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/svg-sprite/config.js 16 18 88.89%
Files with Coverage Reduction New Missed Lines %
lib/svg-sprite/mode/base.js 1 82.18%
lib/svg-sprite/mode/standalone.js 1 94.29%
lib/svg-sprite.js 4 92.02%
lib/svg-sprite/mode/css.js 4 96.75%
lib/svg-sprite/mode/view.js 4 95.69%
lib/svg-sprite/shape.js 5 85.88%
Totals Coverage Status
Change from base Build 1973866481: 4.4%
Covered Lines: 3505
Relevant Lines: 4079

💛 - Coveralls

@yisibl yisibl changed the title fix: segmentation fault test: [email protected] segmentation fault Mar 14, 2022
@yisibl yisibl force-pushed the resvg2 branch 4 times, most recently from 889b63a to d23dcad Compare March 14, 2022 14:40
@yisibl yisibl force-pushed the resvg2 branch 5 times, most recently from 0136b3c to 8f80706 Compare April 1, 2022 03:52
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

Successfully merging this pull request may close these issues.

3 participants