Fix R11B-2 SMP timer race condition bug.

Obtained from:	Rickard Green <rickard.s.green(at)ericsson.com>
This commit is contained in:
Jimmy Olgeni 2006-12-31 23:27:18 +00:00
parent 1099229a2a
commit 67ee9077e7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=181175
4 changed files with 74 additions and 2 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= erlang
PORTVERSION= r11b2
PORTREVISION= 1
PORTREVISION= 2
PORTEPOCH= 1
CATEGORIES= lang parallel
MASTER_SITES= http://www.erlang.org/download/ \

View file

@ -0,0 +1,36 @@
$FreeBSD$
--- erts/emulator/beam/utils.c.orig
+++ erts/emulator/beam/utils.c
@@ -2999,15 +2999,16 @@
static void
ptimer_timeout(ErtsSmpPTimer *ptimer)
{
- if (!(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
if (is_internal_pid(ptimer->timer.id)) {
Process *p;
- p = erts_pid2proc(NULL,
- 0,
- ptimer->timer.id,
- ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS);
+ p = erts_pid2proc_opt(NULL,
+ 0,
+ ptimer->timer.id,
+ ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS,
+ ERTS_P2P_FLG_ALLOW_OTHER_X);
if (p) {
- if (!(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
+ if (!p->is_exiting
+ && !(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
ASSERT(*ptimer->timer.timer_ref == ptimer);
*ptimer->timer.timer_ref = NULL;
(*ptimer->timer.timeout_func)(p);
@@ -3028,7 +3029,6 @@
erts_smp_io_unlock();
}
}
- }
free_ptimer(ptimer);
}

View file

@ -7,7 +7,7 @@
PORTNAME= erlang
PORTVERSION= r11b2
PORTREVISION= 1
PORTREVISION= 2
PORTEPOCH= 1
CATEGORIES= lang parallel
MASTER_SITES= http://www.erlang.org/download/ \

View file

@ -0,0 +1,36 @@
$FreeBSD$
--- erts/emulator/beam/utils.c.orig
+++ erts/emulator/beam/utils.c
@@ -2999,15 +2999,16 @@
static void
ptimer_timeout(ErtsSmpPTimer *ptimer)
{
- if (!(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
if (is_internal_pid(ptimer->timer.id)) {
Process *p;
- p = erts_pid2proc(NULL,
- 0,
- ptimer->timer.id,
- ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS);
+ p = erts_pid2proc_opt(NULL,
+ 0,
+ ptimer->timer.id,
+ ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS,
+ ERTS_P2P_FLG_ALLOW_OTHER_X);
if (p) {
- if (!(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
+ if (!p->is_exiting
+ && !(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
ASSERT(*ptimer->timer.timer_ref == ptimer);
*ptimer->timer.timer_ref = NULL;
(*ptimer->timer.timeout_func)(p);
@@ -3028,7 +3029,6 @@
erts_smp_io_unlock();
}
}
- }
free_ptimer(ptimer);
}