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

upgrade to NAN v2 #195

Merged
merged 2 commits into from
Aug 13, 2015
Merged

upgrade to NAN v2 #195

merged 2 commits into from
Aug 13, 2015

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Jul 12, 2015

I haven't been involved in the NAN v2 work and it's a major departure from <= v1. Overall the approaches are quite nice because it makes it feel much more like working with V8 than some hacked macro soup (well done @kkoopa et. al.). This is my first attempt at actually using NAN v2 and I'm trying this because I'm pushing to get io.js v3.0 out. We have release candidates dropping at https://iojs.org/download/rc/ but getting NAN v2 into npm is the holdup because it's going to break every native addon in npm and the delta between NAN v1 and v2 is so big that it's going to be major trauma for all and I'm trying to help find an approach to ease the pain (likely it'll be about documentation and a tutorial of sorts).

Anyway, I've finally managed to get it to compile, I haven't checked that it works on anything other than io.js v2 and io.js v3-rc.3 and I have segfaults in iterators still so this absolutely isn't ready to merge. If someone has time to help that would be greatly appreciated, I feel like I'm wasting valuable time on C++ rabbit holes that could be better used trying to get io.js v3 out!

@kkoopa
Copy link

kkoopa commented Jul 12, 2015

I had a look at the the diff and it all looks good (which should come as no greater surprise, since it compiles). Minor details are that HandleScope is unnecessary in V8-exposed methods (though it is still fully correct to have it there as well). In the past they were strictly necessary due to the way NanReturnValue was defined.

GetReturnValue().SetUndefined() is also unnecessary, since it is implicitly initialized to Undefined. Again, it is not incorrect. just not a necessity.

This error appears to come from a double free of a Buffer buffer. Unfortunately, the other error does not come with a stack trace, but an initial guess would be that it occurs for the same reason as the first.

@mcollina
Copy link
Member

Great work @rvagg! I have little time now, but I would like to get some time in the C++ land for Nan 2 (given it's going to break some of my stuff too).

@ralphtheninja
Copy link
Member

Cool. Having a look to see if I can get some more information on why it crashes.

@rvagg
Copy link
Member Author

rvagg commented Jul 13, 2015

I tracked down a couple of bugs, one of them was this when cleaning up hanging iterators:

          v8::Local<v8::Value> argv[] = {
              Nan::New<v8::FunctionTemplate>()->GetFunction() // empty callback
          };

EndWorker calls callback when it's done but making an empty function doesn't seem to work, at least on io.js v2 where I was testing this. So I made an empty C++ method and wrapped that in a FunctionTemplate and got rid of that bug.

Now, this is what's left on io.js v2:

Program received signal SIGABRT, Aborted.
0x00007ffff6bed267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
55  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) backtrace 
#0  0x00007ffff6bed267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1  0x00007ffff6beeeca in __GI_abort () at abort.c:89
#2  0x00007ffff6c30c53 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7ffff6d491a8 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007ffff6c3c9f8 in malloc_printerr (ptr=<optimised out>, str=0x7ffff6d491d0 "munmap_chunk(): invalid pointer", action=<optimised out>)
    at malloc.c:4965
#4  munmap_chunk (p=<optimised out>) at malloc.c:2820
#5  __GI___libc_free (mem=<optimised out>) at malloc.c:2945
#6  0x0000000000d05c9b in node::smalloc::CallbackInfo::WeakCallback(v8::WeakCallbackData<v8::Object, node::smalloc::CallbackInfo> const&) ()
#7  0x00000000009b073a in v8::internal::GlobalHandles::PostScavengeProcessing(int) ()
#8  0x00000000009b0fa7 in v8::internal::GlobalHandles::PostGarbageCollectionProcessing(v8::internal::GarbageCollector) ()
#9  0x00000000009dfee4 in v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) ()
#10 0x00000000009e04a8 in v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, char const*, char const*, v8::GCCallbackFlags) ()
#11 0x000000000098c40d in v8::internal::Factory::NewUninitializedFixedArray(int) ()
#12 0x00000000008785f6 in v8::internal::Builtin_ArrayPush(int, v8::internal::Object**, v8::internal::Isolate*) ()

Something about smalloc, a double-free of a buffer perhaps? I have no idea.

Anyway, on io.js v3 it works now, compile & test passes fine. I haven't tested anything below v2 yet.

@rvagg
Copy link
Member Author

rvagg commented Jul 13, 2015

OK, a couple more minor changes and this compiles on 0.10, 0.12 and io.js 2 & 3. But I'm getting segfaults on all but io.js v3. This is the 0.10 form of the error (the others all come from smalloc):

Program received signal SIGABRT, Aborted.
0x00007ffff6bed267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
55  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) backtrace 
#0  0x00007ffff6bed267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1  0x00007ffff6beeeca in __GI_abort () at abort.c:89
#2  0x00007ffff6c30c53 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7ffff6d491a8 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007ffff6c3c9f8 in malloc_printerr (ptr=<optimised out>, str=0x7ffff6d491d0 "munmap_chunk(): invalid pointer", action=<optimised out>)
    at malloc.c:4965
#4  munmap_chunk (p=<optimised out>) at malloc.c:2820
#5  __GI___libc_free (mem=<optimised out>) at malloc.c:2945
#6  0x000000000095f36b in node::Buffer::Replace(char*, unsigned long, void (*)(char*, void*), void*) ()
#7  0x000000000095f911 in node::Buffer::~Buffer() ()
#8  0x000000000095f981 in node::Buffer::~Buffer() ()
#9  0x00000000009607b7 in node::ObjectWrap::WeakCallback(v8::Persistent<v8::Value>, void*) ()
#10 0x00000000007483f5 in v8::internal::GlobalHandles::PostGarbageCollectionProcessing(v8::internal::GarbageCollector) ()
#11 0x000000000075ebff in v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GCTracer*) ()
#12 0x00000000007607df in v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollector, char const*, char const*) ()
#13 0x00000000007331f2 in v8::internal::Factory::BaseNewFunctionFromSharedFunctionInfo(v8::internal::Handle<v8::internal::SharedFunctionInfo>, v8::internal::Handle<v8::internal::Map>, v8::internal::PretenureFlag) ()
#14 0x000000000073344e in v8::internal::Factory::NewFunctionFromSharedFunctionInfo(v8::internal::Handle<v8::internal::SharedFunctionInfo>, v8::internal::Handle<v8::internal::Context>, v8::internal::PretenureFlag) ()
#15 0x0000000000876bee in v8::internal::Runtime_NewClosure(v8::internal::Arguments, v8::internal::Isolate*) ()

I got not ideas at this stage, happy for others to have a look too!

@rvagg rvagg force-pushed the iojs-v3-nan-next branch 2 times, most recently from 2c291ec to 459ca81 Compare July 13, 2015 07:31
@kkoopa
Copy link

kkoopa commented Jul 13, 2015

I find it interesting that ObjectWrap is near the top of that chain. It seems like something ObjectWrapped is getting double-freed.

@rvagg
Copy link
Member Author

rvagg commented Jul 17, 2015

All fixed, @kkoopa pointed out that Nan::NewBuffer() does a reuse of a char array while Nan::CopyBuffer() does a copy which is what we've been doing in the past. I've left some TODOs in the code to switch to NewBuffer but it'll need some careful memory management.

[email protected]: PASS wrote output to /tmp/leveldown-dnt-v0.10.40.out
[email protected] : PASS wrote output to /tmp/leveldown-dnt-v0.12.7.out
[email protected]  : PASS wrote output to /tmp/leveldown-dnt-v1.8.4.out
[email protected]  : PASS wrote output to /tmp/leveldown-dnt-v2.3.4.out
[email protected]  : PASS wrote output to /tmp/leveldown-dnt-v2.0.1.out
[email protected]: PASS wrote output to /tmp/leveldown-dnt-v3.0.0-rc.3.out
Took 104s to run 6 versions of Node

@ralphtheninja
Copy link
Member

Good! I was SOL finding what was causing these problems.

@rvagg rvagg force-pushed the iojs-v3-nan-next branch 2 times, most recently from 9535f10 to bdb6bd2 Compare July 24, 2015 04:24
@rvagg
Copy link
Member Author

rvagg commented Aug 3, 2015

package.json updated for [email protected], this builds and tests pass

using /usr/local/lib/node_modules/npm/node_modules/.bin/node-gyp rebuild because prebuild is grabbing 0.10.40 source when I'm running a 3.0.0-rc

compiled and tested on 0.10, 0.12, 1.x, 2.x and 3.x (pre, supposed to be released today)

Imma leave this to someone else to merge and release this, @ralphtheninja?

@ralphtheninja
Copy link
Member

@rvagg Np. I need to check with @mafintosh as well, since he builds all binaries :)

@mafintosh
Copy link
Member

@ralphtheninja i'm ready to do the builds so lets merge this

@mafintosh
Copy link
Member

i cannot get this build on ubuntu (travis fails as well) on iojs 3.0.0. does anyone know what the issue might be? here is my output

make: Entering directory `/home/ubuntu/leveldown/build'
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/builder.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/db_impl.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/db_iter.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/filename.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/dbformat.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/leveldb_main.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/log_reader.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/log_writer.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/memtable.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/repair.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/table_cache.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/version_edit.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/version_set.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/write_batch.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/helpers/memenv/memenv.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/block.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/block_builder.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/filter_block.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/format.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/iterator.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/merger.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/table.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/table_builder.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/two_level_iterator.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/arena.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/bloom.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/cache.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/coding.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/comparator.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/crc32c.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/env.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/filter_policy.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/hash.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/logging.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/options.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/status.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/port/port_posix.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/env_posix.o
  AR(target) Release/obj.target/deps/leveldb/leveldb.a
  COPY Release/leveldb.a
  CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.1/snappy-sinksource.o
  CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.1/snappy-stubs-internal.o
  CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.1/snappy.o
  AR(target) Release/obj.target/deps/snappy/snappy.a
  COPY Release/snappy.a
  CXX(target) Release/obj.target/leveldown/src/batch.o
In file included from ../src/batch.cc:3:0:
../node_modules/nan/nan.h:261:25: error: redefinition of ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Local<T>)’
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
                         ^
../node_modules/nan/nan.h:256:25: error: ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Handle<T>)’ previously declared here
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
                         ^
../node_modules/nan/nan.h:661:13: error: ‘node::smalloc’ has not been declared
     , node::smalloc::FreeCallback callback
             ^
../node_modules/nan/nan.h:661:35: error: expected ‘,’ or ‘...’ before ‘callback’
     , node::smalloc::FreeCallback callback
                                   ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’:
../node_modules/nan/nan.h:665:50: error: ‘callback’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                  ^
../node_modules/nan/nan.h:665:60: error: ‘hint’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                            ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’:
../node_modules/nan/nan.h:672:67: error: call of overloaded ‘New(v8::Isolate*, const char*&, uint32_t&)’ is ambiguous
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
../node_modules/nan/nan.h:672:67: note: candidates are:
In file included from ../src/batch.cc:2:0:
/home/ubuntu/.node-gyp/3.0.0/src/node_buffer.h:35:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Handle<v8::String>, node::encoding) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/ubuntu/.node-gyp/3.0.0/src/node_buffer.h:35:40: note:   no known conversion for argument 3 from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’
/home/ubuntu/.node-gyp/3.0.0/src/node_buffer.h:47:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/ubuntu/.node-gyp/3.0.0/src/node_buffer.h:47:40: note:   no known conversion for argument 2 from ‘const char*’ to ‘char*’
In file included from ../src/batch.cc:3:0:
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../node_modules/nan/nan.h:676:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’
     return node::Buffer::New(v8::Isolate::GetCurrent(), size);
                                                             ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’:
../node_modules/nan/nan.h:683:12: error: ‘Use’ is not a member of ‘node::Buffer’
     return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
            ^
make: *** [Release/obj.target/leveldown/src/batch.o] Error 1
make: Leaving directory `/home/ubuntu/leveldown/build'
prebuild ERR! build `make` failed with exit code: 2

npm ERR! Linux 3.16.0-30-generic
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "i"
npm ERR! node v3.0.0
npm ERR! npm  v2.13.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `prebuild --download`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] install script 'prebuild --download'.
npm ERR! This is most likely a problem with the leveldown package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     prebuild --download
npm ERR! You can get their info via:
npm ERR!     npm owner ls leveldown
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ubuntu/leveldown/npm-debug.log

@kkoopa
Copy link

kkoopa commented Aug 5, 2015

It uses the wrong NAN version for some reason. I checked out the branch and it built just fine on 14.04. Nevermind snappy, it was the actual libsnappy.

@mafintosh
Copy link
Member

@kkoopa oh yea it works for me now as well. i probably messed something up before.

@rvagg
Copy link
Member Author

rvagg commented Aug 5, 2015

@mafintosh this looks similar to a problem I had with prebuild, it's providing src/headers for the wrong version of node during a build, if you use node-gyp you might have better success, or perhaps your ~/.node-gyp is messed up.

@kkoopa the snappy used here is not node-snappy, it's upstream snappy compiled for this package, the two projects are unrelated

@mafintosh
Copy link
Member

@rvagg i wasn't using the right branch on ubuntu hehe so thats why i didn't work. i wonder why it doesn't work on travis though :/

@mafintosh
Copy link
Member

@rvagg actually its consistently failing for me on ubuntu using iojs 2.4.0 now when compiling

$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn python2
gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/ubuntu/leveldown/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/ubuntu/.node-gyp/2.4.0/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/ubuntu/.node-gyp/2.4.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
gyp info spawn args   '-Dmodule_root_dir=/home/ubuntu/leveldown',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/home/ubuntu/leveldown/build'
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/builder.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/db_impl.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/db_iter.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/filename.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/dbformat.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/leveldb_main.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/log_reader.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/log_writer.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/memtable.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/repair.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/table_cache.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/version_edit.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/version_set.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/db/write_batch.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/helpers/memenv/memenv.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/block.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/block_builder.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/filter_block.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/format.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/iterator.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/merger.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/table.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/table_builder.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/table/two_level_iterator.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/arena.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/bloom.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/cache.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/coding.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/comparator.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/crc32c.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/env.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/filter_policy.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/hash.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/logging.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/options.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/status.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/port/port_posix.o
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.18.0/util/env_posix.o
  AR(target) Release/obj.target/deps/leveldb/leveldb.a
  COPY Release/leveldb.a
  CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.1/snappy-sinksource.o
  CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.1/snappy-stubs-internal.o
  CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.1/snappy.o
  AR(target) Release/obj.target/deps/snappy/snappy.a
  COPY Release/snappy.a
  CXX(target) Release/obj.target/leveldown/src/batch.o
  CXX(target) Release/obj.target/leveldown/src/batch_async.o
  CXX(target) Release/obj.target/leveldown/src/database.o
../src/database.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE leveldown::LevelDOWN(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/database.cc:131:60: error: no matching function for call to ‘Nan::ReturnValue<v8::Value>::Set(v8::Handle<v8::Value>)’
   info.GetReturnValue().Set(Database::NewInstance(location));
                                                            ^
../src/database.cc:131:60: note: candidates are:
In file included from ../node_modules/nan/nan_callbacks.h:118:0,
                 from ../node_modules/nan/nan.h:140,
                 from ../src/leveldown.h:11,
                 from ../src/database.cc:12:
../node_modules/nan/nan_callbacks_12_inl.h:27:37: note: template<class S> void Nan::ReturnValue<T>::Set(const v8::Local<S>&) [with S = S; T = v8::Value]
   template <typename S> inline void Set(const v8::Local<S> &handle) {
                                     ^
../node_modules/nan/nan_callbacks_12_inl.h:27:37: note:   template argument deduction/substitution failed:
../src/database.cc:131:60: note:   typename S> inline void Set(const v8::Local<S> &handle) {
                                     ^
../node_modules/nan/nan_callbacks_12_inl.h:27:37: note:   template argument deduction/substitution failed:
../src/database.cc:345:74: note:   ‘v8::Handle<v8::Value>’ is not derived from ‘const v8::Local<T>’
     info.GetReturnValue().Set(Batch::NewInstance(info.This(), optionsObj));
                                                                          ^
In file included from ../node_modules/nan/nan_callbacks.h:118:0,
                 from ../node_modules/nan/nan.h:140,
                 from ../src/leveldown.h:11,
                 from ../src/database.cc:12:
../node_modules/nan/nan_callbacks_12_inl.h:32:37: note: template<class S> void Nan::ReturnValue<T>::Set(const Nan::Global<S>&) [with S = S; T = v8::Value]
   template <typename S> inline void Set(const Global<S> &handle) {
                                     ^
../node_modules/nan/nan_callbacks_12_inl.h:32:37: note:   template argument deduction/substitution failed:
../src/database.cc:345:74: note:   ‘v8::Handle<v8::Value>’ is not derived from ‘const Nan::Global<S>’
     info.GetReturnValue().Set(Batch::NewInstance(info.This(), optionsObj));
                                                                          ^
In file included from ../node_modulemake: *** [Release/obj.target/leveldown/src/database.o] Error 1
make: Leaving directory `/home/ubuntu/leveldown/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.16.0-30-generic
gyp ERR! command "/usr/local/bin/iojs" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/ubuntu/leveldown
gyp ERR! node -v v2.4.0
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok

@mafintosh
Copy link
Member

@rvagg iojs 3.0.0 works though...

@rvagg
Copy link
Member Author

rvagg commented Aug 5, 2015

ah, I think this is because I didn't catch up to the Handle removal

 grep Handle\< src/* | wc
      21     117    1429

I think it might be as easy as replacing every Handle< with Local<, I just had to do that with bignum for the same reason. Do you want to have a go at that @mafintosh? I don't have time right now to fiddle.

@mafintosh
Copy link
Member

@rvagg i'll try to fix it

@mafintosh
Copy link
Member

@rvagg if you want to use prebuild to compile another time use the --compile flag, thats why it was prebuilding for node 0.10.40.

I've fixed this now for all previous versions of node/iojs and it compiles on iojs 3.0.0 on linux/mac for me as well now. travis still complains with some very weird errors when testing on 3.0.0 though.

Unless someone feels strongly about not merging this I'm gonna merge + release this later today.

@kkoopa
Copy link

kkoopa commented Aug 6, 2015

There remains an unidentified memory leak. nodejs/nan#389

@ralphtheninja
Copy link
Member

Sorry, I've been out in the bush with limited access to internet. Should have better connection now.

@mafintosh +1 for merge

mafintosh added a commit that referenced this pull request Aug 13, 2015
@mafintosh mafintosh merged commit ff8a40b into master Aug 13, 2015
@mafintosh mafintosh deleted the iojs-v3-nan-next branch August 13, 2015 16:47
@dominictarr
Copy link
Contributor

can we publish this?

@juliangruber
Copy link
Member

this should be a patch release, right?

@mafintosh
Copy link
Member

yea. lets publish it and i'll do some builds

@mafintosh
Copy link
Member

@juliangruber by "yea" i mean that it should be a patch release.

@juliangruber
Copy link
Member

@mafintosh great!

published as 1.4.1

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.

7 participants