aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/ebin
AgeCommit message (Collapse)Author
2019-06-17Introduce udp send ancillary data argument down to inet_drvRaimo Niskanen
2019-02-22Update preloadedSiri Hansen
erts/preloaded/ebin/erl_prim_loader.beam erts/preloaded/ebin/init.beam erts/preloaded/ebin/prim_file.beam
2019-02-15Merge branch 'raimo/erts/gen_tcp-listen-linger-slow/ERIERL-303/OTP-14728' ↵Raimo Niskanen
into maint * raimo/erts/gen_tcp-listen-linger-slow/ERIERL-303/OTP-14728: Check empty_out_q at close also for linger Conflicts: erts/preloaded/ebin/prim_inet.beam
2019-02-14Add persistent_term:get(Key, DefaultValue)Björn Gustavsson
https://bugs.erlang.org/browse/ERL-843
2019-02-11Check empty_out_q at close also for lingerRaimo Niskanen
2019-01-28erts: Add magic port control numbersSverker Eriksson
to increase the probablity of a nice badarg from erlang:port_control.
2019-01-16Update preloadedSiri Hansen
2019-01-10Update preloaded modulesLukas Larsson
2019-01-10Implement integer_to_list/2 and integer_to_binary/2 as CIFsStanislav Mayorov
This makes them roughly as fast as integer_to_list/1 and integer_to_binary/1.
2019-01-09Merge branch 'john/erts/prim_file-init-restart/OTP-15495/ERL-821' into maintJohn Högberg
* john/erts/prim_file-init-restart/OTP-15495/ERL-821: Remove an unused variable Spawn prim_file helper as a system process
2019-01-07Spawn prim_file helper as a system processJohn Högberg
2018-12-20Update preloaded modulesLukas Larsson
2018-12-03Update preloaded modulesHenrik Nord
2018-11-22Merge branch 'sverker/erts/atomics-counters/OTP-13468' into maintSverker Eriksson
AGAIN * sverker/erts/atomics-counters/OTP-13468: erts: Add counters:put/3
2018-11-21erts: Add counters:put/3Sverker Eriksson
2018-11-16Merge branch 'john/erts/defer-orphan-file-close/OTP-15421/ERIERL-261' into maintJohn Högberg
* john/erts/defer-orphan-file-close/OTP-15421/ERIERL-261: Fix broken assertion on monitor release Avoid closing files in gc/monitor callbacks
2018-11-15erts: Add new module 'counters'Sverker Eriksson
2018-11-15erts: Add new module 'atomics'Sverker Eriksson
2018-11-13Avoid closing files in gc/monitor callbacksJohn Högberg
Closing files in these callbacks could block scheduler progress and cause major system instability. We now defer these operations to a dedicated process instead. This process may in turn block forever and prevent further orphaned files from being closed, but it will keep the emulator itself from misbehaving.
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-22Merge branch 'raimo/tcp-close-while-send/maint/ERL-561/OTP-12242' into maintRaimo Niskanen
* raimo/tcp-close-while-send/maint/ERL-561/OTP-12242: Write test case Fix hanging gen_tcp send vs close race Conflicts: erts/preloaded/ebin/prim_inet.beam
2018-10-19Fix hanging gen_tcp send vs close raceRaimo Niskanen
While a gen_tcp send was in progress with filled buffers and slow receiver a close (from another process) would place the port in a half dead state so the port could not signal back to send, that waited for confirmation. The solution is to after some time (5 s) of waiting for send confirmation set a monitor on the port, which detects if the port becomes half dead due to close from another process. The close pending loop has also been improved to use the linger timeout for waiting, and to set a system timeout (arbitrarily selected 3 min) to not wait forever when the other end reads data s l o w l y (tarpitting, kind of).
2018-10-17Merge branch 'igor/tcp-nopush-ERL-698/OTP-15357' into maintJohn Högberg
* igor/tcp-nopush-ERL-698/OTP-15357: "cork" tcp socket around file:sendfile Add nopush TCP socket option
2018-10-02Implement {netns,NS} option for inet:getifaddrs/1Raimo Niskanen
Also implement the same option for the legacy undocumented functions inet:getif/1,getiflist/1,ifget/2,ifset/2. The arity 1 functions had before this change got signatures that took a socket port that was used to do the needed syscall, so now the signature was extended to also take an option list with the only supported option {netns,Namespace}. The Socket argument variant remains unsupported. For inet:getifaddrs/1 the documentation file was changed to old style function name definition so be able to hide the Socket argument variant that is visible in the type spec. The arity 2 functions had got an option list as second argument. This list had to be partitioned into one list for the namespace option(s) and the other for the rest. The namespace option list was then fed to the already existing namespace support for socket opening, which places the socket in a namespace and hence made all these functions that in inet_drv.c used getsockopt() work without change. The functions that used getifaddrs() in inet_drv.c had to be changed in inet_drv.c to swap namespaces around the getifaddrs() syscall. This functionality was separated into a new function call_getifaddrs().
2018-09-17Merge branch 'raimo/receive-TOS-TCLASS/ERIERL-187/OTP-15145' into maintRaimo Niskanen
* raimo/receive-TOS-TCLASS/ERIERL-187/OTP-15145: Write testcases for recvtos and friends Fix term buffer overflow bug Fix documentation due to feedback Implement socket option recvtos and friends
2018-09-13Fix unsafe use of lists:reverse/1John Högberg
We said reverse/2 but used reverse/1 which is unsafe to use in preloaded modules. This didn't have any effect in practice as the affected functions weren't used before the code server was started, but it's still an error.
2018-09-04Implement socket option recvtos and friendsRaimo Niskanen
Implement socket options recvtclass, recvtos, recvttl and pktoptions. Document the implemented socket options, new types and message formats. The options recvtclass, recvtos and recvttl are boolean options that when activated (true) for a socket will cause ancillary data to be received through recvmsg(). That is for packet oriented sockets (UDP and SCTP). The required options for this feature were recvtclass and recvtos, and recvttl was only added to test that the ancillary data parsing handled multiple data items in one message correctly. These options does not work on Windows since ancillary data is not handled by the Winsock2 API. For stream sockets (TCP) there is no clear connection between a received packet and what is returned when reading data from the socket, so recvmsg() is not useful. It is possible to get the same ancillary data through a getsockopt() call with the IPv6 socket option IPV6_PKTOPTIONS, on Linux named IPV6_2292PKTOPTIONS after the now obsoleted RFC where it originated. (unfortunately RFC 3542 that obsoletes it explicitly undefines this way to get packet ancillary data from a stream socket) Linux also has got a way to get packet ancillary data for IPv4 TCP sockets through a getsockopt() call with IP_PKTOPTIONS, which appears to be Linux specific. This implementation uses a flag field in the inet_drv.c socket internal data that records if any setsockopt() call with recvtclass, recvtos or recvttl (IPV6_RECVTCLASS, IP_RECVTOS or IP_RECVTTL) has been activated. If so recvmsg() is used instead of recvfrom(). Ancillary data is delivered to the application by a new return tuple format from gen_udp:recv/2,3 containing a list of ancillary data tuples [{tclass,TCLASS} | {tos,TOS} | {ttl,TTL}], as returned by recvmsg(). For a socket in active mode a new message format, containing the ancillary data list, delivers the data in the same way. For gen_sctp the ancillary data is delivered in the same way, except that the gen_sctp return tuple format already contained an ancillary data list so there are just more possible elements when using these socket options. Note that the active mode message format has got an extra tuple level for the ancillary data compared to what is now implemented gen_udp. The gen_sctp active mode format was considered to be the odd one - now all tuples containing ancillary data are flat, except for gen_sctp active mode. Note that testing has not shown that Linux SCTP sockets deliver any ancillary data for these socket options, so it is probably not implemented yet. Remains to be seen what FreeBSD does... For gen_tcp inet:getopts([pktoptions]) will deliver the latest received ancillary data for any activated socket option recvtclass, recvtos or recvttl, on platforms where IP_PKTOPTIONS is defined for an IPv4 socket, or where IPV6_PKTOPTIONS or IPV6_2292PKTOPTIONS is defined for an IPv6 socket. It will be delivered as a list of ancillary data items in the same way as for gen_udp (and gen_sctp). On some platforms, e.g the BSD:s, when you activate IP_RECVTOS you get ancillary data tagged IP_RECVTOS with the TOS value, but on Linux you get ancillary data tagged IP_TOS with the TOS value. Linux follows the style of RFC 2292, and the BSD:s use an older notion. For RFC 2292 that defines the IP_PKTOPTIONS socket option it is more logical to tag the items with the tag that is the item's, than with the tag that defines that you want the item. Therefore this implementation translates all BSD style ancillary data tags to the corresponding Linux style data tags, so the application will only see the tags 'tclass', 'tos' and 'ttl' on all platforms.
2018-07-18Fix node crash on passing bad arguments to file:read_file_info/2John Högberg
2018-06-18Update preloaded modulesHenrik Nord
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-05-23Update preloadedSiri Hansen
2018-05-22erts: Fix erlang:memory for 'processes' and 'processes_used'Sverker Eriksson
to include links and monitors which were lost at 4bc282d812cc2c49aa3e2d073e96c720f16aa270 where these fix_alloc types changed names.
2018-05-16Replace previous suspend in setnode/3Rickard Green
2018-05-16New process suspend implementation based on async signalingRickard Green
2018-05-07Update preloaded modulesBjörn Gustavsson
2018-04-26Don't kill logger process until all other processes are deadSiri Hansen
2018-04-26Remove error_logger process and add logger processSiri Hansen
2018-04-25Update preloaded modulesBjörn Gustavsson
2018-04-24Merge pull request #1790 from jhogberg/john/erts/more-alloc-info/OTP-14961John Högberg
Improve memory instrumentation OTP-15024 OTP-14961
2018-04-23erts: Rewrite memory instrumentationJohn Högberg
This commit replaces the old memory instrumentation with a new implementation that scans carriers instead of wrapping erts_alloc/erts_free. The old implementation could not extract information without halting the emulator, had considerable runtime overhead, and the memory maps it produced were noisy and lacked critical information. Since the new implementation walks through existing data structures there's no longer a need to start the emulator with special flags to get information about carrier utilization/fragmentation. Memory fragmentation is also easier to diagnose as it's presented on a per-carrier basis which eliminates the need to account for "holes" between mmap segments. To help track allocations, each allocation can now be tagged with what it is and who allocated it at the cost of one extra word per allocation. This is controlled on a per-allocator basis with the +M<S>atags option, and is enabled by default for binary_alloc and driver_alloc (which is also used by NIFs).
2018-04-16Deprecate erlang:get_stacktrace/0Björn Gustavsson
2018-04-10erts: Flush messages before doing init restartLukas Larsson
If messages are not flushed they would cause problems when the system is booting. For instance module load requests would be issued before the prim loader has been launched.
2018-03-23Merge branch 'rickard/signals/OTP-14589'Rickard Green
* rickard/signals/OTP-14589: Fix VM probes compilation Fix lock counting Fix signal order for is_process_alive Fix signal handling priority elevation
2018-03-22Fix signal order for is_process_aliveRickard Green
2018-03-21Merge pull request #1740 from rickard-green/rickard/signals/OTP-14589Rickard Green
Implementation of true asynchronous signaling between processes
2018-03-21Implementation of true asynchronous signaling between processesRickard Green
Communication between Erlang processes has conceptually always been performed through asynchronous signaling. The runtime system implementation has however previously preformed most operation synchronously. In a system with only one true thread of execution, this is not problematic (often the opposite). In a system with multiple threads of execution (as current runtime system implementation with SMP support) it becomes problematic. This since it often involves locking of structures when updating them which in turn cause resource contention. Utilizing true asynchronous communication often avoids these resource contention issues. The case that triggered this change was contention on the link lock due to frequent updates of the monitor trees during communication with a frequently used server. The signal order delivery guarantees of the language makes it hard to change the implementation of only some signals to use true asynchronous signaling. Therefore the implementations of (almost) all signals have been changed. Currently the following signals have been implemented as true asynchronous signals: - Message signals - Exit signals - Monitor signals - Demonitor signals - Monitor triggered signals (DOWN, CHANGE, etc) - Link signals - Unlink signals - Group leader signals All of the above already defined as asynchronous signals in the language. The implementation of messages signals was quite asynchronous to begin with, but had quite strict delivery constraints due to the ordering guarantees of signals between a pair of processes. The previously used message queue partitioned into two halves has been replaced by a more general signal queue partitioned into three parts that service all kinds of signals. More details regarding the signal queue can be found in comments in the erl_proc_sig_queue.h file. The monitor and link implementations have also been completely replaced in order to fit the new asynchronous signaling implementation as good as possible. More details regarding the new monitor and link implementations can be found in the erl_monitor_link.h file.
2018-03-19Fix file:change_group/change_ownerJohn Högberg
It wasn't possible to change group/owner separately, and our test suite lacked coverage for that. ERL-589
2018-03-02erts,kernel: Add dist_util:strict_order_flags/0Sverker Eriksson
to replace DFLAGS_STRICT_ORDER_DELIVERY and remove that compile time dependency.
2018-03-02erts,kernel: Add erts_internal:get_dflags/0Sverker Eriksson
for kernel to ask erts about distribution flags and keep this info in one place.
2018-02-20Merge branch 'maint'Sverker Eriksson