Richard Smith a écrit :
I have been using haxe & neko on my quadcore WinXPProSP2 PC for a couple of years now. I always occasionally got a "Fatal error in gc / SuspendThread failed" dialog window when running a neko executable (incl. the haxe compiler). The haxe compile command reports "Error : Neko compilation failure".

However, since upgrading to neko 1.8, it seems to have a lot worse. I would say that for every 5 times I invoke the haxe compiler, it successfully completes only once .. the other times I get the Fatal error message. If I try the simple "neko test" command, I get approx 1 failure for every 6 or 7 invocations (although the console reports "Test successful" when the fatal error message is shown"). I have disabled my virus checker (eset NOD32), then removed the virus checker completely, with no effect.

Aside from the annoyance / inconvenience factor whilst developing, I am now getting concerned that any neko vm - based software I develop may exhibit this same problem on installed client machines. I cannot see another reference to this in the neko list .. has anyone else encountered this ? Happy to share any error dumps you think might be useful....

That's indeed a strange issue, and you're not the first one to experience it.

I'm forwarding it to GC author as well with my opinion.

Here's some background infos :

- the Boehm GC that NekoVM is using can handle multiple threads

- however "nekoc" itself (and most of the neko applications) only use the main thread

- since we don't know if/when we will use threads, the GC needs anyway to know which threads are created, and track them.

On Windows, in order to detect thread creation (which is needed for mod_neko since Apache creates the threads for us) we are using the GC_use_DllMain() command (in neko/vm/alloc.c).

The GC DLL is then notified when a new thread is created or a thread is stopped through it DllMain() function (see Windows API for more details).

It seems that some external programs (in general Antivirus or Debuggers) are attaching themselves to the running neko process, thus notifying the GC of their presence.

When a GC collection is needed, the GC will try then to pause these threads, and will fail to do so (maybe because windows security doesn't allow it to do so). It will then exit.

I can think of several possible fixes :

- disable GC_use_DllMain(), but for mod_neko were Apache creates the threads for us, we would need a GC api to be able to register the current thread (in case it's not already known by the GC). For our own threads, we are using GC_CreateThread anyway. This would guarantee us a more fine control on which threads get GC awareness, and also enable neko to link the GC statically.

 or otherwise :

- the GC shouldn't handle a failure on SleepThread as fatal errors. And instead consider the thread to be "protected", and thus most likely not to manipulate any GC memory.

As for your application, if you're not using mod_neko you can ship a Neko version with the GC_use_DllMain() commented out and it should work like a charm.

Hope that helps,

Best,
Nicolas


--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to