aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
AgeCommit message (Collapse)Author
2018-09-11erts: Fix "Prevent inconsistent node lists" fixSverker Eriksson
done in a31216200bdee2c04b3fb3ae5e26607674715c8a that could cause a new pending connection to be incorrectly aborted.
2018-09-05Merge branch 'rickard/dist-entry-gc-fix/OTP-15279' into maint-21Erlang/OTP
* rickard/dist-entry-gc-fix/OTP-15279: Prevent inconsistent node lists
2018-09-05Prevent inconsistent node listsRickard Green
If net_kernel "forgets" to abort a connection (as it currently might), the garbage collection of a distribution entry could cause node lists to enter an inconsistent state.
2018-08-31Fix an endless rescheduling loop when a process is executing ↵Maxim Fedorov
process_info(self(), ...) It is possible that a process has to yield before completing process_info BIF when it runs out of reductions. If this BIF is called by the process itself, it does not send a signal but executes in the context of a process. If it has to yield, it turns F_LOCAL_SIGS_ONLY flag on, which means new signals won't be fetched from the outer message queue. When the same process needs to execute dirty system code (e.g. dirty GC) it has to be run on a dirty scheduler. However signals enqueued into outer queue cause it to be rescheduled on a normal scheduler. F_LOCAL_SIGS_ONLY prevent outer queue signals delivery, creating an endless rescheduling loop. This commit disengages F_LOCAL_SIG_ONLY if process needs to execute dirty code in order to complete signal delivery and allow process to be moved to dirty run queue.
2018-08-29Merge branch 'rickard/running-trace-fix/ERL-713/OTP-15269' into maint-21Erlang/OTP
* rickard/running-trace-fix/ERL-713/OTP-15269: Fix missing 'in' trace events during 'running' trace
2018-08-27Fix missing 'in' trace events during 'running' traceRickard Green
'in' trace events could be lost when a process had to be rescheduled on another scheduler type (normal <-> dirty).
2018-08-20Fix incoming suspend monitor downRickard Green
An incoming suspend monitor down wasn't handled correct when the local monitor half had been removed with an emulator crash as result.
2018-08-10Merge branch 'rickard/full-cache-nif-env/OTP-15223/ERL-695' into maint-21Erlang/OTP
* rickard/full-cache-nif-env/OTP-15223/ERL-695: Fix caching of NIF environment when executing dirty # Conflicts: # erts/emulator/beam/erl_nif.c
2018-08-10Merge branch 'dotsimon/ref_ordering_bug/OTP-15225' into maint-21Erlang/OTP
* dotsimon/ref_ordering_bug/OTP-15225: Fixed #Ref ordering bug Test #Ref ordering in lists and ets
2018-08-09Fix caching of NIF environment when executing dirtyRickard Green
2018-08-09Fixed #Ref ordering bugSimon Cornish
2018-08-09Test #Ref ordering in lists and etsSimon Cornish
2018-07-18Merge branch 'john/erts/kqueue-stdin-polling/OTP-15169/ERL-647' into maint-21Erlang/OTP
* john/erts/kqueue-stdin-polling/OTP-15169/ERL-647: Use fallback pollset for stdin and friends when using kqueue
2018-07-18Merge branch 'john/erts/fix-literal-map-elements/OTP-15184' into maint-21Erlang/OTP
* john/erts/fix-literal-map-elements/OTP-15184: Fix a rare crash when matching on literal maps
2018-07-13Fix a rare crash when matching on literal mapsJohn Högberg
When matching on a literal map, the map is placed into the general scratch register first. This is fine in isolation, but when the key to be matched was in a Y register it would also be placed in the scratch register, overwriting the map and crashing the emulator.
2018-07-12Merge branch 'john/erts/fix-dirty-reschedule-bug/OTP-15154' into maint-21Erlang/OTP
* john/erts/fix-dirty-reschedule-bug/OTP-15154: Move to a dirty scheduler even when we have pending system tasks
2018-07-12Fix trace_info/2Rickard Green
2018-07-03Use fallback pollset for stdin and friends when using kqueueJohn Högberg
This is a hack to make the "noshell" option work; kqueue can poll these fds but will not report EV_EOF. This may be common to all all pipes but we have no way to tell whether an fd is a pipe or not.
2018-06-29Merge branch 'john/erts/inet-drv-race/OTP-15158/ERL-654' into maint-21Erlang/OTP
* john/erts/inet-drv-race/OTP-15158/ERL-654: Fix a race condition when generating async operation ids
2018-06-29Merge branch 'john/erts/merge-OTP-15067' into maint-21Erlang/OTP
* john/erts/merge-OTP-15067: Don't enqueue system tasks if target process is in fail_state Fix erroneous schedule of freed/exiting processes Fix deadlock in run queue evacuation Fix memory leak of processes that died in the run queue
2018-06-28Fix a race condition when generating async operation idsJohn Högberg
The counter used for generating async operation ids was a plain int shared between all ports, which was incorrect but mostly worked fine since the ids only had to be unique on a per-port basis. However, some compilers (notably GCC 8.1.1) generated code that assumed that this value didn't change between reads. Using a shortened version of enq_async_w_tmo as an example: int id = async_ref++; op->id = id; //A return id; //B In GCC 7 and earlier, `async_ref` would be read once and assigned to `id` before being incremented, which kept the values at A and B consistent. In GCC 8, `async_ref` was read when assigned at A and read again at B, and then incremented, which made them inconsistent if we raced with another port. This commit fixes the issue by removing `async_ref` altogether and replacing it with a per-port counter which makes it impossible to race with someone else.
2018-06-27Move to a dirty scheduler even when we have pending system tasksJohn Högberg
When a system task was enqueued on a process between being scheduled and the check altered in this commit, we'd run dirty code on a normal scheduler as the RUNNING_SYS flag wasn't set and we wouldn't migrate back. This change migrates us to a dirty scheduler instead, which will immediately bounce us back to a normal scheduler where RUNNING_SYS will be set appropriately. This is caught fairly reliably by process_SUITE:system_task_failed_enqueue on machines with a lot of cores.
2018-06-21Fix environment case sensitivity issues on WindowsJohn Högberg
2018-06-18Update copyright yearHenrik Nord
2018-06-14Merge branch 'john/erts/fix-process-schedule-after-free/OTP-15067/ERL-573' ↵John Högberg
into john/erts/merge-OTP-15067
2018-06-14Don't enqueue system tasks if target process is in fail_stateJohn Högberg
The fail state wasn't re-checked in the state change loop; only the FREE state was checked. In addition to that, we would leave the task in the queue when bailing out which could lead to a double-free. This commit backports active_sys_enqueue from master to make it easier to merge onwards.
2018-06-14Fix erroneous schedule of freed/exiting processesJohn Högberg
When scheduled out, the process was never checked for the FREE state before rescheduling, which meant that a system task could sneak in and cause a double-free later on.
2018-06-13erts: Fix MacOS pollset bugSverker Eriksson
that could cause clearing of fd-bits past allocated bit-vectors. Bug introduced on master by 988f5f5e8061ce2e135a314ca782788eda478a06
2018-06-13Merge branch 'sverker/ets-auto-unfix-delete-race/OTP-15109' into maint-20Erlang/OTP
* sverker/ets-auto-unfix-delete-race/OTP-15109: erts: Fix race between ets table deletion and auto-unfix
2018-06-12erts: Fix monitor_SUITE:remote_remove_monitorSverker Eriksson
to actually run remote on the slave node that it starts.
2018-06-11Merge branch 'sverker/process-info-exiting'Sverker Eriksson
* sverker/process-info-exiting: erts: Fix incoming signal handling for exiting process
2018-06-11erts: Fix incoming signal handling for exiting processSverker Eriksson
Seen symptom: handle_process_info() called with is_alive=1 on exiting process, reading broken Process.u.initial.module atom overwritten by Process.u.terminate pointer. Solution: Let erts_proc_sig_handle_incoming() do nothing if process is already exiting.
2018-06-11Merge branch 'lukas/kernel/logger-config/OTP-13295'Lukas Larsson
* lukas/kernel/logger-config/OTP-13295: erts: Fix emulator log messages to use erlang:system_time kernel: Add LOGGER_SERVER_TAG to logger_server
2018-06-07Merge branch 'sverker/ets-auto-unfix-delete-race/OTP-15109'Sverker Eriksson
* sverker/ets-auto-unfix-delete-race/OTP-15109: erts: Fix race between ets table deletion and auto-unfix
2018-06-07erts: Fix race between ets table deletion and auto-unfixSverker Eriksson
Bug exists since ets-refs were introduced in 20.0 0d6dc895744c34c9c52fd42f4801a8a941864ae3. Problem: 1. Process A fixates table T. 2. Process B starts deleting table T (either by ets:delete or exit) and does tid_clear(). 3. Process A exits and does proc_cleanup_fixed_table() and get NULL from btid2tab() and deallocates DbFixation. 4. Process B continues deleting table in free_fixations_locked() and finds the deallocated DbFixation in the fixing_procs tree. Solution: Wait with tid_clear() until after free_fixations_locked() has traversed the fixing_procs tree.
2018-06-05Merge branch 'sverker/broken-sig-queue'Sverker Eriksson
* sverker/broken-sig-queue: erts: Cleanup in proc_queue_signal erts: Fix broken signal queue
2018-06-05erts: Cleanup in proc_queue_signalSverker Eriksson
* Remove 'last' arg to sig_enqueue_trace_cleanup * Only notify 'rp' if enqueue succeeded
2018-06-05erts: Fix broken signal queueSverker Eriksson
broken on master by 613cde66c25464121f2f6dace99782bad0e07d9b Scenario: proc_queue_signal() fails to send switched pending signal due to state & ERTS_PSFLG_FREE, and then calls erts_proc_sig_send_monitor_down() to enqueue to self followed by sig_enqueue_trace_cleanup() that destroyed 'next' pointer of enqueued signal. Solution: Switch order and do sig_enqueue_trace_cleanup() first.
2018-06-05Merge branch 'sverker/system-profile-bug/OTP-15085' into maint-20Erlang/OTP
* sverker/system-profile-bug/OTP-15085: erts: Fix bug in system_profile
2018-06-05Merge branch 'sverker/enif_binary_to_term-bug/OTP-15080' into maint-20Erlang/OTP
* sverker/enif_binary_to_term-bug/OTP-15080: erts: Fix bug in enif_binary_to_term for immediates
2018-06-05mikpe/erts-port_task-invalid-call/PR-1828/ERL-621/OTP-15108Lukas Larsson
do not call abort_signal_task() with invalid data
2018-06-05erts: Fix emulator log messages to use erlang:system_timeLukas Larsson
This was changed in the logger in 8aa64c90ddd20ec0ca8cc5fe92a6124324c51da5.
2018-06-04erts: Fix race between ets table deletion and auto-unfixSverker Eriksson
Problem: 1. Process A fixates table T. 2. Process B starts deleting table T (either by ets:delete or exit) and does tid_clear(). 3. Process A exits and does proc_cleanup_fixed_table() and get NULL from btid2tab() and deallocates DbFixation. 4. Process B continues deleting table in free_fixations_locked() and finds the deallocated DbFixation in the fixing_procs tree. Solution: Wait with tid_clear() until after free_fixations_locked() has traversed the fixing_procs tree.
2018-06-04Merge branch 'sverker/pooled-age-order'Sverker Eriksson
* sverker/pooled-age-order: erts: Let allocator pooled_tree also use Age Order
2018-06-04Merge branch 'sverker/erlang-memory-fix'Sverker Eriksson
* sverker/erlang-memory-fix: erts: Purge unused allocation types erts: Fix erlang:memory for 'processes' and 'processes_used'
2018-06-04Merge branch 'sverker/ets-count/OTP-14987'Sverker Eriksson
* sverker/ets-count/OTP-14987: erts,stdlib: Improve docs about obsolete ets_limit erts: Reduce test log noise from ets_SUITE erts: Increase scalability of ets name lookup erts: Rename one of delete_trap to select_delete_trap erts: Refactor usage of am_atom_put to ERTS_MAKE_AM erts: Add system_info(ets_count) erts: Fix narrow race between ets:new and ets:delete
2018-06-04erts: Increase scalability of ets name lookupSverker Eriksson
by expanding the default size of the hash table and increase number of locks.
2018-06-04erts: Rename one of delete_trap to select_delete_trapSverker Eriksson
2018-06-04erts: Refactor usage of am_atom_put to ERTS_MAKE_AMSverker Eriksson
and let compiler determine string lengths. These were actually wrong in erl_db.c: count_trap\0 replace_tra select_tra
2018-06-04erts: Add system_info(ets_count)Sverker Eriksson