Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Segfault: 11 using node platform #3678

Closed

Description

@buchanae

On Mac OSX 10.11.2
Node v5.0.0 (also tried v4.2.6)

This is the script: https://gist.github.com/abuchanan/5f3c3737469661314975

Error:

node js/init.js
PID 62870 received SIGSEGV for address: 0x880
0   segfault-handler.node               0x00000001049f1ecb _ZL16segfault_handleriP9__siginfoPv + 283
1   libsystem_platform.dylib            0x00007fff9b963eaa _sigtramp + 26
2   ???                                 0x0000000500000100 0x0 + 21474836736
3   mapbox-gl-native.node               0x0000000103a0af75 _ZN9node_mbgl15NodeLogObserverD0Ev + 53
4   libsystem_c.dylib                   0x00007fff97e6246b __cxa_finalize_ranges + 345
5   libsystem_c.dylib                   0x00007fff97e6276f exit + 55
6   node                                0x000000010000263b start + 59
7   ???                                 0x0000000000000002 0x0 + 2

Directory:

tree -I node_modules .
.
├── crash.log
├── fixtures
│   └── tiles
│       └── 0-0-0.vector.pbf
├── image.png
├── js
│   └── init.js
└── package.json

I've tried both plain npm install mapbox-gl-native and downloading/building the code. npm test passes, but when I pull the test code (from "renders image") out, it does segfault also, that's just not reflected by the test results.

It does write image.png but it's not an actual PNG and can't be opened.

I'm stumped.

Activity

  1. added
    Node.js
    on Jan 24, 2016
  2. self-assigned this
    on Jan 25, 2016
  3. mikemorris commented on Jan 25, 2016

    @mikemorris
    Contributor

    I think this was an issue introduced in v3.0.0, I'm working on tracking this down.

  4. jfirebaugh commented on Jan 25, 2016

    @jfirebaugh
    Contributor

    There's a bug in the node README that presumably got propagated to the script.

    map.render({}, function(err, image) {
        if (err) throw err;
        fs.writeFileSync('image.png', image);
    });
    

    This doesn't write a valid PNG file, because map.render produces a raw RGBA buffer. You need to encode it to the desired image format yourself.

  5. mikemorris commented on Jan 25, 2016

    @mikemorris
    Contributor

    Oops, yea, thought this was a different issue. map.render used to return a PNG, looks like the examples were never updated to reflect that it returns raw RGBA now.

  6. buchanae commented on Feb 9, 2016

    @buchanae
    Author

    Thanks guys. I am able to write an image now (although it took me awhile to find an image library that worked. I ended up with picha)

    Still segfaults though.

  7. mikemorris commented on Apr 7, 2016

    @mikemorris
    Contributor

    Sorry for the slow response, finally got some time to look into this and I was able to reproduce the segfault you're seeing - it looks like we're not cleaning up properly when the script exits and trying to improperly Reset() a v8::Persistent in the NodeLog destructor.

    * thread #1: tid = 0x393cb, 0x00000001002e6bed node`v8::internal::GlobalHandles::Node::Release() + 173, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x880)
      * frame #0: 0x00000001002e6bed node`v8::internal::GlobalHandles::Node::Release() + 173
        frame #1: 0x0000000104002515 mapbox-gl-native.node`node_mbgl::NodeLogObserver::~NodeLogObserver() [inlined] v8::PersistentBase<v8::Object>::Reset() + 53 at v8.h:7234
        frame #2: 0x0000000104002507 mapbox-gl-native.node`node_mbgl::NodeLogObserver::~NodeLogObserver() [inlined] Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >::Reset() at nan_persistent_12_inl.h:24
        frame #3: 0x0000000104002507 mapbox-gl-native.node`node_mbgl::NodeLogObserver::~NodeLogObserver() [inlined] node_mbgl::NodeLogObserver::~NodeLogObserver(this=<unavailable>) + 30 at node_log.cpp:55
        frame #4: 0x00000001040024e9 mapbox-gl-native.node`node_mbgl::NodeLogObserver::~NodeLogObserver() [inlined] node_mbgl::NodeLogObserver::~NodeLogObserver(this=<unavailable>) at node_log.cpp:53
        frame #5: 0x00000001040024e9 mapbox-gl-native.node`node_mbgl::NodeLogObserver::~NodeLogObserver(this=0x0000000101712eb0) + 9 at node_log.cpp:53
        frame #6: 0x00007fff90cee46b libsystem_c.dylib`__cxa_finalize_ranges + 345
        frame #7: 0x00007fff90cee76f libsystem_c.dylib`exit + 55
        frame #8: 0x000000010000103b node`start + 59
    
  8. added this to the milestone on Apr 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Node.jsbugdocumentation

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions