basho / erlang_js

A linked-in driver for Erlang to Mozilla's Spidermonkey Javascript runtime.
Apache License 2.0
238 stars 88 forks source link

beam.smp coredump when exiting riak #22

Closed jonmeredith closed 12 years ago

jonmeredith commented 12 years ago

When run with R15B against the current master branch, beam.smp coredumps on emulator exit.

jonmeredith commented 12 years ago

Reproducer, run with erl +A1 from the top level erlang_js dir t:run(). q(). will trigger

-module(t).
-compile([export_all]).

run() ->
    code:add_path("ebin"),
    ok = application:start(sasl),
    ok = application:start(erlang_js),
    true = (erlang:system_info(thread_pool_size) > 0),
    ThreadStack = 1,
    HeapSize = 1,
    js_driver:new(ThreadStack, HeapSize). 
jonmeredith commented 12 years ago

Smaller reproducer


% Have to add -compile([export_all]) to js_driver.erl
-module(t).
-compile([export_all]).
-define(DRIVER_NAME, "erlang_js_drv").

run() ->
    code:add_path("ebin"),
    ok = application:start(sasl),
    ok = application:start(erlang_js),
    true = (erlang:system_info(thread_pool_size) > 0),
    ThreadStack = 1,
    HeapSize = 1,
    js_driver:load_driver(),
    Port = open_port({spawn, ?DRIVER_NAME}, [binary]),
    js_driver:call_driver(Port, "ij", [ThreadStack, HeapSize], 5000),
    js_driver:define_js(Port, <<"avar.js">>, <<"var v;">>, 5000). %% This call is critical

No coredump unless define_js is called.

jonmeredith commented 12 years ago

Fixed in #25