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

Segfault with async methods #33

Open
rcoup opened this issue Jul 16, 2014 · 3 comments
Open

Segfault with async methods #33

rcoup opened this issue Jul 16, 2014 · 3 comments

Comments

@rcoup
Copy link

rcoup commented Jul 16, 2014

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 ()
@kashif
Copy link
Owner

kashif commented Jul 16, 2014

Thanks @rcoup I will have a look at it. Report back soon!

@kashif
Copy link
Owner

kashif commented Aug 4, 2014

Ok under OSX, node v0.10.30 and geos 3.4.2 it does not crash:

...
20446 'calling'
20446 'callback' false
20447 'calling'
20447 'callback' false
20448 'calling'
20448 'callback' false
20449 'calling'
20449 'callback' false
20450 'calling'
20450 'callback' false
20451 'calling'
20451 'callback' false
^C

@rcoup
Copy link
Author

rcoup commented Aug 4, 2014

Interesting. Will see if I can reproduce with Geos 3.4.2 or Node 0.10.30.

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

No branches or pull requests

2 participants