Skip to content

Segfault with async methods #33

Description

@rcoup

The following reliably segfaults within 10 iterations under Linux, Node v0.10.24, GEOS 3.3.3.

Using .intersects() synchronously doesn't appear to segfault...

var geos = require('../src');

var WKT1 = "MULTIPOLYGON (((-20037508 -307339, -12022505 -307339, -12022505 -7114301, -15760404 -7114301, -15760404 -7792636, -15779537 -7827998, -17263217 -7827998, -17263217 -14879925, -20037508 -14879925, -20037508 -307339)), ((15807367 -3245709, 17506729 -3245709, 17506729 -2487462, 17525862 -2466868, 18167688 -2466868, 18167688 -307339, 20037508 -307339, 20037508 -8411006, 18470338 -8411006, 18470338 -9891468, 19508740 -9891468, 19527873 -9938767, 19527873 -14879925, 18299880 -14879925, 18299880 -12026586, 17922438 -12026586, 17903304 -11962397, 17903304 -9986389, 17790246 -9986389, 17771113 -9938767, 17771113 -8411006, 17525862 -8411006, 17506729 -8372781, 17506729 -7114301, 15807367 -7114301, 15807367 -3245709)))";
var WKT2 = "POLYGON ((11271098 626172, 11271098 1252344, 11897270 1252344, 11897270 626172, 11271098 626172))";

var geom = (new geos.WKTReader()).read(WKT1);

var i=0;
function x() {
  var geom2 = (new geos.WKTReader()).read(WKT2);

  console.log(i, "calling");
  geom.intersects(geom2, function(err, intersects) {
    console.log(i, "callback", intersects);
    i++;
    x(i);
  });
}
x();

GDB backtrace:

Program received signal SIGSEGV, Segmentation fault.
0xb7ce9926 in Geometry::_ref (this=0x87dee78) at ../src/cpp/geometry.hpp:164
warning: Source file is more recent than executable.
164     static Handle<Value> New(geos::geom::Geometry* geometry);
(gdb) bt
#0  0xb7ce9926 in Geometry::_ref (this=0x87dee78) at ../src/cpp/geometry.hpp:164
#1  0xb7ce6187 in Geometry::Intersects (args=...) at ../src/cpp/geometry.cpp:166
#2  0x0821bb25 in ?? ()
#3  0x3da0a236 in ?? ()
#4  0x3da5a630 in ?? ()
#5  0x3da536bd in ?? ()
#6  0x3da141a5 in ?? ()
#7  0x3da53017 in ?? ()
#8  0x3da4f119 in ?? ()
#9  0x3da4c0bf in ?? ()
#10 0x3da3f337 in ?? ()
#11 0x3da3ee93 in ?? ()
#12 0x3da298f6 in ?? ()
#13 0x3da2910b in ?? ()
#14 0x3da0fe19 in ?? ()
#15 0x3da0a0aa in ?? ()
#16 0x08247b7e in ?? ()
#17 0x082482dd in v8::internal::Execution::Call(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*, bool*, bool) ()
#18 0x081e9da2 in v8::Function::Call(v8::Handle<v8::Object>, int, v8::Handle<v8::Value>*) ()
#19 0x084982c3 in node::Load(v8::Handle<v8::Object>) ()
#20 0x08498488 in node::Start(int, char**) ()
#21 0x084b0a5b in main ()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions