Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

node 9.6.+ crashes with custom importer test #2293

Closed
saper opened this issue Mar 16, 2018 · 8 comments
Closed

node 9.6.+ crashes with custom importer test #2293

saper opened this issue Mar 16, 2018 · 8 comments

Comments

@saper
Copy link
Member

saper commented Mar 16, 2018

  • NPM version (npm -v):
    5.7.1
  • Node version (node -v):
    v9.8.0
    (also v9.7.1, v9.6.1)
  • Node Process (node -p process.versions):
{ http_parser: '2.7.0',
  node: '9.8.0',
  v8: '6.2.414.46-node.21',
  uv: '1.19.2',
  zlib: '1.2.8',
  ares: '1.12.0',
  modules: '59',
  nghttp2: '1.29.0',
  napi: '2',
  openssl: '1.0.2n',
  icu: '60.2',
  unicode: '10.0',
  cldr: '32.0.1',
  tz: '2017c' }
  • Node Platform (node -p process.platform):
    freebsd
  • Node architecture (node -p process.arch):
    ia32
    (also 64-bit)
  • node-sass version (node -p "require('node-sass').info"):
# node -p "require( './' ) .info"
node-sass       4.8.2   (Wrapper)       [JavaScript]
libsass         3.5.1   (Sass Compiler) [C/C++]
  • npm node-sass versions (npm ls node-sass):
# npm ls node-sass
[email protected] /wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2
`-- (empty)

Observing node crashing during npm test. Node version 8 seems to be fine.

Full log:

https://gist.github.com/60940e4411e6ee3959872f513264c268

    .renderSync(importer)
Stacktrace:
   magic1=bbbbbbbb magic2=bbbbbbbb ptr1=0x2c4050b1 ptr2=0x0 ptr3=0x0 ptr4=0x0 ptr5=0x0 ptr6=0x0 ptr7=0x0 ptr8=0x0


==== JS stack trace =========================================

Security context: 0x2c415fdd <JSObject>#0#
    1: renderSync [/wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2/lib/index.js:425] [bytecode=0x2bed1b1d offset=204](this=0x31ea3401 <Object map = 0x5d63bb51>#1#,opts=0x33f96881 <Object map = 0x5d65154d>#2#)
    2: /* anonymous */ [/wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2/test/api.js:1551] [bytecode=0x2becdd19 offset=32](this=0x31ea4585 <Context map = 0x5d646839>#3#,done=0x33f9685d <JSFunction (sfi = 0x529de921)>#4#)
    3: callFnAsync(aka callFnAsync) [/wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2/node_modules/mocha/lib/runnable.js:371] [bytecode=0x529de995 offset=23](this=0x3a48417d <undefined>,fn=0x31ea9681 <JSFunction (sfi = 0x2becd2f5)>#5#)
    4: run [/wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2/node_modules/mocha/lib/runnable.js:318] [bytecode=0x529dbc3d offset=141](this=0x31ea4f51 <Test map = 0x5d6562d1>#6#,fn=0x33f9649d <JSFunction (sfi = 0x529dd261)>#7#)
    5: runTest [/wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2/node_modules/mocha/lib/runner.js:443] [bytecode=0x529dd599 offset=106](this=0x2d73acf1 <Runner map = 0x5d652c55>#8#,fn=0x33f9649d <JSFunction (sfi = 0x529dd261)>#7#)
    6: /* anonymous */(aka /* anonymous */) [/wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2/node_modules/mocha/lib/runner.js:549] [bytecode=0x529dd2ed offset=128](this=0x3a48417d <undefined>,err=0x3a48417d <undefined>,errSuite=0x3a48417d <undefined>)
    7: arguments adaptor frame: 0->2
    8: next(aka next) [/wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2/node_modules/mocha/lib/runner.js:361] [bytecode=0x529db5a9 offset=27](this=0x3a48417d <undefined>,suite=0x3a48417d <undefined>)
    9: /* anonymous */(aka /* anonymous */) [/wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2/node_modules/mocha/lib/runner.js:371] [bytecode=0x529db6d9 offset=55](this=0x3a48417d <undefined>,err=0x3a48417d <undefined>)
   10: arguments adaptor frame: 0->1
   11: next(aka next) [/wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2/node_modules/mocha/lib/runner.js:295] [bytecode=0x529d9dc9 offset=32](this=0x3a48417d <undefined>,i=0)
   12: _onImmediate [/wrkdirs/usr/ports/textproc/node-sass/work/node-sass-4.8.2/node_modules/mocha/lib/runner.js:339] [bytecode=0x529d9bc1 offset=8](this=0x33f963b5 <Immediate map = 0x5d6626c1>#9#)
   13: runCallback(aka runCallback) [timers.js:763] [bytecode=0x529d9a5d offset=49](this=0x3a48417d <undefined>,timer=0x33f963b5 <Immediate map = 0x5d6626c1>#9#)
   14: tryOnImmediate(aka tryOnImmediate) [timers.js:734] [bytecode=0x529d980d offset=11](this=0x3a48417d <undefined>,immediate=0x33f963b5 <Immediate map = 0x5d6626c1>#9#,oldTail=0x33f963b5 <Immediate map = 0x5d6626c1>#9#,count=1,refCount=1)
   15: processImmediate [timers.js:716] [bytecode=0x529d94e5 offset=139](this=0x43104161 <process map = 0x5d6081a1>#10#)
@saper saper self-assigned this Mar 16, 2018
@saper saper changed the title node 9.6.+ crashes with custom importer test node 9.6.+ crashes with custom async importer test Mar 16, 2018
@saper saper changed the title node 9.6.+ crashes with custom async importer test node 9.6.+ crashes with custom importer test Mar 16, 2018
@saper saper changed the title node 9.6.+ crashes with custom importer test node 9.6.+ crashes with custom importer test [FreeBSD] Mar 16, 2018
@saper
Copy link
Member Author

saper commented Mar 16, 2018

Could not reproduce on Fedora 25 with node v9.6.1

@saper
Copy link
Member Author

saper commented Mar 16, 2018

C++ stack trace:

(gdb) bt
#0  v8::base::OS::Abort () at ../deps/v8/src/base/platform/platform-posix.cc:248
#1  0x0000000000cd3f4e in v8::internal::Isolate::PushCodeObjectsAndDie (this=<optimized out>, magic1=3735929054, ptr1=0x3ecb58083b19, ptr2=0x0, ptr3=0x0, ptr4=0x0, ptr5=0x8, ptr6=<optimized out>,
    ptr7=<optimized out>, ptr8=0x246, magic2=<optimized out>) at ../deps/v8/src/isolate.cc:366
#2  0x0000000000cd3e1a in v8::internal::Isolate::PushStackTraceAndDie (this=0x804c3f000, magic1=<optimized out>, ptr1=0x3ecb58083b19, ptr2=0x0, ptr3=0x0, ptr4=0x0, ptr5=0x0, ptr6=0x0, ptr7=0x0,
    ptr8=0x0, magic2=3149642683) at ../deps/v8/src/isolate.cc:335
#3  0x0000000000cd3d0b in v8::internal::Isolate::PushStackTraceAndDie (this=0x0, magic1=<error reading variable: Value out of range.>, ptr1=0x0, ptr2=0x1, magic2=<optimized out>)
    at ../deps/v8/src/isolate.cc:314
#4  0x0000000000d026eb in v8::internal::LookupIterator::GetRootForNonJSReceiver (isolate=<optimized out>, index=<optimized out>, receiver=..., isolate=<optimized out>, receiver=...,
    index=<optimized out>) at ../deps/v8/src/lookup.cc:226
#5  0x000000000094418b in v8::internal::LookupIterator::GetRoot (index=4294967295, isolate=<optimized out>, receiver=...) at ../deps/v8/src/lookup.h:370
#6  v8::internal::LookupIterator::LookupIterator (this=<optimized out>, isolate=<optimized out>, receiver=..., name=..., configuration=<optimized out>) at ../deps/v8/src/lookup.h:53
#7  v8::internal::LookupIterator::LookupIterator (this=0x7fffffffa3f0, configuration=v8::internal::LookupIterator::PROTOTYPE_CHAIN, receiver=..., name=...) at ../deps/v8/src/lookup.h:49
#8  0x0000000000d01e3c in v8::internal::LookupIterator::PropertyOrElement (isolate=<optimized out>, success=<optimized out>, configuration=<optimized out>, receiver=..., key=...)
    at ../deps/v8/src/lookup.cc:73
#9  0x0000000000e8a55e in v8::internal::Runtime::GetObjectProperty (isolate=0x804c3f000, is_found_out=0x0, object=..., key=...) at ../deps/v8/src/runtime/runtime-object.cc:31
#10 0x00000000008ca7da in v8::Object::Get (this=0x804d396a8, context=..., key=...) at ../deps/v8/src/api.cc:4603
#11 0x0000000807cbccdf in Nan::Get (obj=..., key=...) at ../node_modules/nan/nan_maybe_43_inl.h:152
#12 CustomImporterBridge::get_importer_entry (this=<optimized out>, object=...) at ../src/custom_importer_bridge.cpp:76
#13 0x0000000807cbcb5f in CustomImporterBridge::post_process_return_value (this=0x804c785c0, returned_value=...) at ../src/custom_importer_bridge.cpp:51
#14 0x0000000807cba714 in CallbackBridge<Sass_Import**, void*>::operator() (this=0x804c785c0, argv=...) at ../src/callback_bridge.h:109
#15 0x0000000807cb7d34 in sass_importer (cur_path=<optimized out>, cb=<optimized out>, comp=<optimized out>) at ../src/binding.cpp:19
#16 0x0000000807d0215a in Sass::Context::call_loader (this=0x806c44400, load_path=..., ctx_path=0x804c1b4b0 "stdin", pstate=..., imp=0x804c1c840, importers=..., only_one=<optimized out>)
    at context.cpp:427
#17 0x0000000807dcb8b3 in Sass::Context::call_importers (this=0x806c44400, load_path=..., ctx_path=0x0, pstate=..., imp=0xfffff8003d1c64b0) at ./context.hpp:33
#18 0x0000000807da171c in Sass::Parser::parse_import (this=0x7fffffffbfc8) at parser.cpp:375
#19 0x0000000807d9bc42 in Sass::Parser::parse_block_node (this=0x7fffffffbfc8, is_root=<optimized out>) at parser.cpp:248
#20 0x0000000807d9a342 in Sass::Parser::parse_block_nodes (this=0x7fffffffbfc8, is_root=<optimized out>) at parser.cpp:196
#21 0x0000000807d9993d in Sass::Parser::parse (this=0x7fffffffbfc8) at parser.cpp:122
#22 0x0000000807d002b2 in Sass::Context::register_resource (this=0x806c44400, inc=..., res=..., prstate=<optimized out>) at context.cpp:323
#23 0x0000000807d04284 in Sass::Data_Context::parse (this=0x806c44400) at context.cpp:627
#24 0x0000000807cc6d97 in Sass::sass_parse_block (this=0x804e35298, compiler=0x804e35280, rhs=...) at sass_context.cpp:238
#25 sass_compiler_parse (compiler=0x804e35280) at sass_context.cpp:487
#26 0x0000000807cc6b2a in sass_compile_context (c_ctx=0x804d24500, cpp_ctx=0x0) at sass_context.cpp:375
#27 0x0000000807cb9e9c in render_sync (info=...) at ../src/binding.cpp:290
#28 0x0000000807cba419 in Nan::imp::FunctionCallbackWrapper (info=...) at ../node_modules/nan/nan_callbacks_12_inl.h:174
#29 0x00000000008e9010 in v8::internal::FunctionCallbackArguments::Call (this=0x7fffffffc758, f=0x807cba390 <Nan::imp::FunctionCallbackWrapper(v8::FunctionCallbackInfo<v8::Value> const&)>)
    at ../deps/v8/src/api-arguments.cc:25
#30 0x0000000000946217 in v8::internal::(anonymous namespace)::HandleApiCallHelper<false> (isolate=0x804c3f000, args=..., function=..., new_target=..., fun_data=..., receiver=...)
    at ../deps/v8/src/builtins/builtins-api.cc:112
#31 0x0000000000945894 in v8::internal::Builtin_Impl_HandleApiCall (isolate=0x804c3f000, args=...) at ../deps/v8/src/builtins/builtins-api.cc:142

Looks like crash occurs when trying to get "map" attribute of the importer entry:

Sass_Import* CustomImporterBridge::get_importer_entry(const v8::Local<v8::Object>& object) const {
auto returned_file = Nan::Get(object, Nan::New<v8::String>("file").ToLocalChecked());
auto returned_contents = Nan::Get(object, Nan::New<v8::String>("contents").ToLocalChecked()).ToLocalChecked();
auto returned_map = Nan::Get(object, Nan::New<v8::String>("map").ToLocalChecked());

What is interesting is that returned_map here should be a Maybe<>.

@xzyfer
Copy link
Contributor

xzyfer commented Mar 17, 2018

I've reproduced this with LibSass 3.5.2 on Node 9.8.0 on Windows

https://ci.appveyor.com/project/sass/node-sass/build/2743/job/ek6q44qn4ekmgoj9

@xzyfer
Copy link
Contributor

xzyfer commented Mar 17, 2018

Interesting, rebuilding a previously passing build (also 9.6.0) resulted in a failure. Using LibSass 3.5.1.

@xzyfer
Copy link
Contributor

xzyfer commented Mar 17, 2018

I'm pretty sure this is related to latest Nan release - https://github.com/nodejs/nan/blob/master/CHANGELOG.md#nan-changelog

@xzyfer
Copy link
Contributor

xzyfer commented Mar 17, 2018

Able to reproduce this with [email protected] on OSX. I've filed an issues upstream nodejs/nan#755.

@saper
Copy link
Member Author

saper commented Mar 17, 2018

I am also considering a possibility that we have always had a bug in our code which just got uncovered.

@saper saper changed the title node 9.6.+ crashes with custom importer test [FreeBSD] node 9.6.+ crashes with custom importer test Mar 17, 2018
@kkoopa kkoopa mentioned this issue Mar 17, 2018
@saper
Copy link
Member Author

saper commented Mar 17, 2018

Thank you @kkoopa - it seems to work better now!

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

No branches or pull requests

2 participants