aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
AgeCommit message (Collapse)Author
2019-01-23Merge branch 'maint'Lukas Larsson
2019-01-23Merge branch 'lukas/erts/scheduler-pollset-fixes/OTP-15538' into maintLukas Larsson
* lukas/erts/scheduler-pollset-fixes/OTP-15538: erts: Fix getting of poll events on linux >= 4.15.0 erts: Use reduction based polling for starved poll-set erts: Fix pollset test cases
2019-01-18Merge pull request #2055 from ↵Lukas Larsson
josevalim/jv-no-bin-alloc-on-empty-append/OTP-15535 Do not allocate new bitstring/binary on empty append
2019-01-15Merge branch 'maint'Lukas Larsson
2019-01-15Merge branch 'lukas/erts/spawn_opt_max_heap_tc_fix' into maintLukas Larsson
* lukas/erts/spawn_opt_max_heap_tc_fix: erts: Fix process_SUITE:max_heap tests
2019-01-15Merge branch 'maint'Lukas Larsson
Conflicts: erts/emulator/beam/bif.c erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/prim_file.beam
2019-01-10erts: Add erlang:system_flag(system_logger,_)Lukas Larsson
This flag allows logger and other components to set the process which log messages from ERTS are to be sent.
2019-01-10Merge branch 'maint'John Högberg
* maint: Implement integer_to_list/2 and integer_to_binary/2 as CIFs Accept base in all integer-printing functions Document cleanup semantics for atomics and counters
2019-01-10Accept base in all integer-printing functionsStanislav Mayorov
2019-01-09Do not allocate new bitstring/binary on empty appendJosé Valim
2019-01-07Merge PR-2084 from sverker/erts/enif_select-custom-msg OTP-15349Sverker Eriksson
Custom message format for enif_select
2019-01-07erts: Fix process_SUITE:max_heap testsLukas Larsson
Make sure to flush all queued emulator logger messages before starting the test. The trap_exit_badarg could sometimes leave messages and since the handler and messages now are handled in different processes this becomes a problem.
2019-01-07Merge branch 'maint'Lukas Larsson
2019-01-07erts: Add enif_select_read|write with 'msg_env' argumentSverker Eriksson
2019-01-07erts: Fix pollset test casesLukas Larsson
2018-12-21erts: Fix persistent_term testcasesLukas Larsson
2018-12-20erts: Add ERL_NIF_SELECT_CUSTOM_MSGSverker Eriksson
2018-12-18Merge branch 'maint'Sverker Eriksson
2018-12-18Merge branch 'sverker/big-band-bug/ERL-804/OTP-15487' into maintSverker Eriksson
* sverker/big-band-bug/ERL-804/OTP-15487: erts: Fix bug in 'band' of two negative numbers, one big
2018-12-18Merge branch 'sverker/fix-atomics-get-large-unsigned/PR-2061/OTP-15486' into ↵Sverker Eriksson
maint * sverker/fix-atomics-get-large-unsigned/PR-2061/OTP-15486: erts: Fix possible heap corruption getting atomics
2018-12-18Make length/1 yieldingBjörn Gustavsson
The guard BIF `length/1` would calculate the length of the list in one go without yielding, even if the list was were long. To make it even worse, the call to `length/1` would only cost a single reduction. This commit reimplements `length/1` so that it eats a number of reductions proportional to the length of the list, and yields if the available reductions run out.
2018-12-17erts: Fix bug in 'band' of two negative numbers, one bigSverker Eriksson
Similar bug as for bxor fixed by abc4fd372d476821448dfb9 Ex: 1> io:format("~.16B\n", [-16#1110000000000000000 band (-1)]). -1120000000000000000 Wrong result for (-X bsl WS) band -Y. where X is any positive integer WS is erlang:system_info(wordsize)*8*N where N is 1 or larger Y is any positive integer smaller than (1 bsl WS) Fix: The subtraction of 1 (for 2-complement conversion) must be carried along all the way to the last words.
2018-12-13erts: Fix possible heap corruption getting atomicsTomas Abrahamsson
Due to comparison as a signed integer, when getting an unsigned atomic in the range 2^63-1..2^64-1 (when the most significant bit was set), the heap could get corrupted when the integer was retrieved: hsz would get set to zero, but the code proceeded to build a bignum. Steps to reproduce (at least on x86_64): $ erl 1> A = atomics:new(1,[{signed,false}]). 2> atomics:put(A,1,18446744073709551615). 3> atomics:get(A,1). At the last step, the shell would print some garbage and hang.
2018-12-13Merge branch 'maint'Björn Gustavsson
* maint: Fix reading beyond end of bignum in integer squaring
2018-12-13Fix reading beyond end of bignum in integer squaringBjörn Gustavsson
The multiplication of two bignums is specially optimized when the two operands have the same address, because squaring can be done more efficiently than multiplication of two arbitrary integers. That is, expressions such as `I * I` will be calculated by squaring the value of `I`. The optimized function for squaring would read one word beyond the end of the bignum in the last iteration of a loop. The garbage value would never be used. In almost all circumstances that would be harmless. Only if the read word happened to fall on the start of an unmapped page would the runtime crash. That is unlikely to happen because most bignums are stored on a process heap, and since the stack is located at the other end of the block that the heap is located in, the word beyond the end of bignum is guaranteed to be readable.
2018-12-06Merge branch 'maint'Lukas Larsson
Conflicts: erts/emulator/beam/erl_process.c
2018-12-06Merge branch 'lukas/OTP-21.1.1/scheduler_pollset/OTP-15475' into maintLukas Larsson
* lukas/OTP-21.1.1/scheduler_pollset/OTP-15475: erts: Move fds with active true behaviour to own pollset erts: Fix lists_member_2 reduction count erts: Allow code_model_small to be set in xcomp setting erts: Implement delay_send using timer instead of poll erts: Optimize driver_set_timer(0) to fire at once erts: Optimize the inet driver multi timers for one timer erts: Move all inet tcp CONNECTED timers to multi timer erts: Add erts_io_notify_port_task_executed to check_io msacc state erts: Add pre-alloc to ALLOC msacc state erts: Make thr prgr wakeup current or sched 1 erts: Pass thread progress data where possible
2018-12-06erts: Move fds with active true behaviour to own pollsetLukas Larsson
At start of the VM a poll-set that the schedulers will check is created where fds that have triggered many (at the moment, many means 10) times without being deselected inbetween. In this scheduler specific poll-set fds do not use ONESHOT, which means that the number of syscalls goes down dramatically for such fds. This pollset is introduced in order to handle fds that are used by the erlang distribution and that never change their state from {active, true}. This pollset only handles ready_input events, ready_output is still handled by the poll threads. During overload, polling the scheduler poll-set is done on a 10ms timer.
2018-12-03Merge branch 'maint'Sverker Eriksson
2018-12-03Merge branch 'sverker/erts/cuddle-driver_SUITE' into maintSverker Eriksson
* sverker/erts/cuddle-driver_SUITE: erts: Fix faulty assert in driver_SUITE erts: Improve driver_SUITE:smp_select
2018-11-26Merge branch 'maint'Sverker Eriksson
2018-11-23erts: Fix bug in countersSverker Eriksson
Wow, that could have been embarrassing.
2018-11-22Merge branch 'maint'Sverker Eriksson
2018-11-22erts: Fix faulty assert in driver_SUITESverker Eriksson
Set drv_use_singleton.fd_stop_select to -2 in start() as it's only used by driver_SUITE:driver_select_use.
2018-11-21erts: Add counters:put/3Sverker Eriksson
2018-11-20erts: Improve driver_SUITE:smp_selectSverker Eriksson
to better detect an actual missing ready_input event on slow machines (valgrind) and without wasting time with long sleep on fast machines.
2018-11-16erts: Refactor out erts_test_utils from node_container_SUITESverker Eriksson
to be usable by other application tests.
2018-11-15Merge branch 'maint'Sverker Eriksson
2018-11-15erts: Add new module 'counters'Sverker Eriksson
2018-11-15erts: Add new module 'atomics'Sverker Eriksson
2018-11-06Merge branch 'maint'Björn Gustavsson
* maint: Implement a tab for persistent terms in crashdump viewer Add tests of persistent terms for crashdump_viewer Add a persistent term storage Refactor releasing of literals Extend the sharing-preserving routines to optionally copy literals Conflicts: erts/emulator/Makefile.in erts/emulator/beam/erl_process_dump.c erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/init.beam lib/sasl/src/systools_make.erl
2018-11-06Add a persistent term storageBjörn Gustavsson
Persistent terms are useful for storing Erlang terms that are never or infrequently updated. They have the following advantages: * Constant time access. A persistent term is not copied when it is looked up. The constant factor is lower than for ETS, and no locks are taken when looking up a term. * Persistent terms are not copied in garbage collections. * There is only ever one copy of a persistent term (until it is deleted). That makes them useful for storing configuration data that needs to be easily accessible by all processes. Persistent terms have the following drawbacks: * Updates are expensive. The hash table holding the keys for the persistent terms are updated whenever a persistent term is added, updated or deleted. * Updating or deleting a persistent term triggers a "global GC", which will schedule a heap scan of all processes to search the heap of all processes for the deleted term. If a process still holds a reference to the deleted term, the process will be garbage collected and the term copied to the heap of the process. This global GC can make the system less responsive for some time. Three BIFs (implemented in C in the emulator) is the entire interface to the persistent term functionality: * put(Key, Value) to store a persistent term. * get(Key) to look up a persistent term. * erase(Key) to delete a persistent term. There are also two additional BIFs to obtain information about persistent terms: * info() to return a map with information about persistent terms. * get() to return a list of a {Key,Value} tuples for all persistent terms. (The values are not copied.)
2018-10-24Merge branch 'maint'Björn Gustavsson
* maint: beam_lib: Remove obsolete module() from the beam() type hipe: Don't use beam_lib:info/1 with an atom as filename Honor the max heap size when copying literals after purging
2018-10-19Honor the max heap size when copying literals after purgingBjörn Gustavsson
When a module has been purged from memory, any literals belonging to that module will be copied to all processes that hold references to them. The max heap size limit would be ignored in the garbage collection initiated when copying literals to a process. If the max heap size was exceeded, the process would typically be terminated in the following garbage collection. Since the process would be killed anyway later, kill the process before copying a literal that would make it exceed its max heap size. While at it, also fix a potential bug in `erlang:garbage_collect/0`. If it was found that the max heap sized had been exceeded while executing `erlang:garbage_collect/0`, the process would enter a kind of zombie state instead of being properly terminated.
2018-09-26Use os:getenv/2 where possiblePeter Lemenkov
Signed-off-by: Peter Lemenkov <[email protected]>
2018-09-21Merge branch 'maint'Henrik Nord
2018-09-21Update copyright yearHenrik Nord
2018-09-17Merge branch 'maint'John Högberg
* maint: Improve trapping in lists:reverse/2 Fix unsafe use of lists:reverse/1
2018-09-13Improve trapping in lists:reverse/2John Högberg
If the process had more free space than reductions it could run a lot longer than it was supposed to. It didn't honor the number of reductions going in either, nor did it bump reductions when returning its result or erroring out. This commit also removes this function from a work function in scheduler_SUITE as it's extremely sensitive to the number of reductions spent in the test, causing equal_and_high_with_part_time_max to fail on some machines.
2018-09-11Merge branch 'sverker/enif-cancel-select/OTP-15095'Sverker Eriksson
* sverker/enif-cancel-select/OTP-15095: erts: Add ERL_NIF_SELECT_CANCEL flag for enif_select