[erlang-questions] erl using 99% CPU while idle

Rickard Green <>
Wed Mar 28 10:01:47 CEST 2012


> On Tue, Mar 27, 2012 at 9:37 AM, Frank Hunleth
> <>  wrote:
>> I was wondering if anyone had seen erl, specifically the
>> erts-5.9/bin/beam process, run at 99% CPU while at the shell prompt.
>
> Finally found the issue! This was caused by passing the
> "--disable-threads" option to ./configure when compiling erlang.
> Removing the option (the default is --enable-threads) and recompiling
> fixes the problem.
>

The following fix for this has successfully passed one daily build, and 
will probably appear as it is in R15B01. As you noted, this bug does not 
appear unless you disable thread support. This bug was first introduced 
in R15B.

diff --git a/erts/emulator/sys/common/erl_poll.c 
b/erts/emulator/sys/common/erl_poll.c
index 3817b1e..2685805 100644
--- a/erts/emulator/sys/common/erl_poll.c
+++ b/erts/emulator/sys/common/erl_poll.c
@@ -2143,7 +2143,7 @@ ERTS_POLL_EXPORT(erts_poll_wait)(ErtsPollSet ps,
  void
  ERTS_POLL_EXPORT(erts_poll_interrupt)(ErtsPollSet ps, int set)
  {
-#if defined(USE_THREADS)
+#if defined(USE_THREADS) || ERTS_POLL_ASYNC_INTERRUPT_SUPPORT
      if (!set)
         reset_wakeup_state(ps);
      else


> One last question: Besides fixing the above issue, I'm a little
> confused on what --enable-threads does for me.

This only enable thread support for the runtime system (builds runtime 
system with -D_REENTRANT etc).

 > I see "[async-threads:
> 0]", so does that mean that even though they're enabled, they won't be
> used by default?
>

No they will not be enabled by default. You enable them by passing 
+A<NoAsyncThreads> as a command line argument to erl.

> Thanks,
> Frank
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

Regards,
Rickard Green, Erlang/OTP, Ericsson AB.



More information about the erlang-questions mailing list