aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_ptab.h
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-08-02 15:04:14 +0200
committerSverker Eriksson <[email protected]>2013-08-07 16:07:42 +0200
commitf499b39ddc5025074c5d22f272f1dd55df79f009 (patch)
tree8abc375d0ca4b957c1302bada04d383364e5bdd3 /erts/emulator/beam/erl_ptab.h
parent8cece79b77952c991e62ae595bcf71cde016a052 (diff)
downloadotp-f499b39ddc5025074c5d22f272f1dd55df79f009.tar.gz
otp-f499b39ddc5025074c5d22f272f1dd55df79f009.tar.bz2
otp-f499b39ddc5025074c5d22f272f1dd55df79f009.zip
erts: Fix race in ptab that can cause PID mix-ups
Since: R16B01 Symptom: A spawned process may get the same PID as an existing process. The new process will "steal" the PID and make the old process unreachable through the PID. The problem also applies to port identities but has only been seen for processes. Conditions: SMP emulator with at least two scheduler threads. Rapid spawning and termination of a large number of processes. A small number of free slots in the process table will also increase the risk for this bug. Workaround: Use command line options "+P legacy" and "+Q legacy" Cause: The race happens if a process terminates and gets stalled while releasing its process table slot. The stall has to be so long (due to OS preemptive scheduling most probably) for other schedluer threads to consume all other free slots for newly spawn processes. Fix: Write invalid-markers in the free-pid-table and do atomic exhange operations in retry-loops to make sure each thread gets a unique PID.
Diffstat (limited to 'erts/emulator/beam/erl_ptab.h')
-rw-r--r--erts/emulator/beam/erl_ptab.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_ptab.h b/erts/emulator/beam/erl_ptab.h
index c2d8bd9cad..e3e05f14af 100644
--- a/erts/emulator/beam/erl_ptab.h
+++ b/erts/emulator/beam/erl_ptab.h
@@ -100,7 +100,7 @@ typedef struct {
typedef struct {
erts_smp_atomic_t *tab;
- Uint32 *free_id_data;
+ erts_smp_atomic32_t *free_id_data;
Uint32 max;
Uint32 pix_mask;
Uint32 pix_cl_mask;