HaxeFoundation/hashlink

SIGNAL 11 Segmentation fault

sebthom opened this issue · 7 comments

Now that we have recent binaries of HashLink for linux at https://github.com/HaxeFoundation/hashlink/releases/download/latest/hashlink-a505e25-linux-amd64.tar.gz I enabled unit testing for some libraries against HashLink via GitHub Actions.

Unfortunately HashLink crashes repeatedly somewhere in the middle of the tests (involving threading I guess).

SIGNAL 11
Segmentation fault (core dumped)
Error: Process completed with exit code 139.

See https://github.com/vegardit/haxe-concurrent/actions/runs/4015485217/jobs/6897266435#step:15:439

Unfortunately I cannot reproduce this locally. I also tried to run the GitHub workflow locally using https://github.com/nektos/act but HashLink doesn't crash there either.

Any ideas how to get closer to the root of this?

In another run I got this stack trace:

| SIGNAL 11
| sys.thread.EventLoop.loop(/opt/hostedtoolcache/haxe/4.2.5/x64/std/sys/thread/EventLoop.hx:177)
| sys.thread._Thread.$HaxeThread.~create.0(/opt/hostedtoolcache/haxe/4.2.5/x64/std/hl/_std/sys/thread/Thread.hx:133)
| Segmentation fault (core dumped)
Error: Process completed with exit code 139.

I tried HL 1.13 with 4.3.0-rc.1+a985681 and still get Segmentation faults. The issue seems to be related to std/hl/_std/sys/thread/Thread.hx

SIGNAL 11
sys.thread._Thread.$HaxeThread.~create.0(/home/runner/work/_temp/haxe/sdk/haxe-nightly/std/hl/_std/sys/thread/Thread.hx:151)
/home/runner/work/_temp/929e66e4-d1ec-466e-8644-da4d42b7910d.sh: line 8:  3307 Segmentation fault      (core dumped) hl target/tests.hl
SIGNAL 11
sys.thread.EventLoop.loop(/home/runner/work/_temp/haxe/sdk/haxe-nightly/std/sys/thread/EventLoop.hx:183)
sys.thread._Thread.$HaxeThread.~create.0(/home/runner/work/_temp/haxe/sdk/haxe-nightly/std/hl/_std/sys/thread/Thread.hx:153)
/home/runner/work/_temp/931bfa2f-514e-4183-9cb5-9e1d6bda5b10.sh: line 8:  3272 Segmentation fault      (core dumped) hl target/tests.hl

I'm running into the same issues with github action runner on ubuntu running the latest hashlink. Is there a version you are reverting to until it is fixed @sebthom ?

@PXshadow no, I am marking the test step with Hashlink as "continue-on-error: true" and rely on other targets (neko/cpp/jvm) for the time being. But I feel the issues got worse as of HashLink 1.13

I have a reproducible occurrence of this issue.

repo
commands:

haxe build.hxml
hl test.hl

I've just had the exact same error and stackstrace as sabthom

After I run the update function below, a few ms later I receive the stacktrace above.

    1 import sys.db.Mysql;
    2 using result.ResultTools;
    3
    4 typedef MysqlOps = { user : String, ?socket : Null<String>, ?port : Null<Int>, pass : String, host : String, ?database : Null<String> }
    5
    6 class MysqlConfigUpdate {
    7         public static function get_crads():MysqlOps{
    8                 var crads=SafeResult.read("./env.json");
    9                 if (crads.isError()){
   10                         trace("unable to connect load credentials for mysql, please update config.json and try again");
   11                 }
   12                 return new json2object.JsonParser<MysqlOps>().fromJson(crads.unwrap());
   13
   14         }
   15         public static function update(?key:String) {
   16                 var cnx=Mysql.connect(get_crads());
   17                 var configs=cnx.request("select * from HA.sip_route_config").results();
   18                 var result=SafeResult.save("config.json",configs);
   19                 switch result {
   20                         case Error(e):trace( e);
   21                         case _:
   22                 }
   23                 var servers=cnx.request("select * from HA.sip_servers").results();
   24                 var result=SafeResult.save("servers.json",servers);
   25                 trace(switch result {
   26                         case Ok(_):"configs have been saved successfully";
   27                         case Error(e):'error while saving configsi $e';
   28                 });
   29
   30                 return true;
   31
   32         }
   33         static function main() {
   34                 update();
   35         }
   36 }
   37