Age | Commit message (Collapse) | Author |
|
* john/erts/defer-orphan-file-close/OTP-15421/ERIERL-261:
Fix broken assertion on monitor release
Avoid closing files in gc/monitor callbacks
|
|
|
|
|
|
|
|
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.
|
|
Added ping-pong test cases for UDP, small and medium, using
the sendto/recvfrom and sendmsg/recvmsg functions.
OTP-14831
|
|
* 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
|
|
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.)
|
|
The sendmsg function attempts to send *one message*. But
its possible for the underlying software to fail to send
the *entire* message. So, instead of retrying itself, as
send does, the sendmsg function will now instead return
with {ok, Remaining}, leaving it to the caller to decide
what to do.
OTP-14831
|
|
The send and recv test case triggered a two bugs. One was
that there was no re-selecting when only a portion of the data
was received (which meant that we stopped reading).
Also, the wrong 'current' (writer) was reset when demonitor
current reader after a successful read (which meant that
future readers would never have been monitored).
OTP-14831
|
|
Conflicts:
erts/preloaded/ebin/prim_inet.beam
|
|
* 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
|
|
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).
|
|
* maint:
"cork" tcp socket around file:sendfile
Add nopush TCP socket option
|
|
* igor/tcp-nopush-ERL-698/OTP-15357:
"cork" tcp socket around file:sendfile
Add nopush TCP socket option
|
|
Conflicts:
erts/preloaded/ebin/prim_inet.beam
|
|
This fixes 200ms delay on the last TCP segment when using
file:sendfile/2 on Linux (ERL-698).
|
|
This translates to TCP_CORK on Linux and TCP_NOPUSH on
BSD.
In effect, this acts as super-Nagle: no partial TCP segments
are sent out until this option is turned off. Once turned off,
all accumulated unsent data is sent out immediately. The latter
is *not* the case on OSX, hence the implementation ignores
"nopush" on OSX to reduce confusion.
|
|
Added preliminary documentation for the function socket:supports/0,1,2,3.
It still does not generate proper doc for supports/3 (the last
arg, Opt, don't get a type).
OTP-14831
|
|
The supports function now also handles testing for SCTP and
IPv6 support. Basic test at the moment, but better then nothing.
OTP-14831
|
|
Add the options for level socket (full), ip and ipv6 to the
supports function.
OTP-14831
|
|
Added the first three socket (level socket) options to the
supports function(s).
OTP-14831
|
|
|
|
Internally in the socket module we accessed domain, type and
protocol for an open socket. But as it turns out, domain (family)
is not actually available as a socket option on all platforms.
FreeBSD in this case. So, since we store these values in the socket
descriptor anyway, we switch to use these values for our internal
use instead.
OTP-14831
|
|
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().
|
|
* richcarl/erts/erl_init-cleanup/OTP-15336:
sasl: Order systools_make:preloaded modules alphabetically
Update preloaded modules
Move calling on_load for preloaded modules to erl_init
Make erl_init.c pass the boot module to erl_init.beam
Remove obsolete comment text
Remove undocumented and unused -# display_items emulator option
Remove broken and undocumented boot function emulator option
Replace remaining references to otp_ring0 with erl_init
Drop otp_ring0, using erl_init instead
Update preloaded modules
Add erl_init module
Conflicts:
erts/emulator/beam/erl_init.c
erts/preloaded/ebin/erl_prim_loader.beam
erts/preloaded/ebin/erl_tracer.beam
erts/preloaded/ebin/erlang.beam
erts/preloaded/ebin/erts_code_purger.beam
erts/preloaded/ebin/erts_dirty_process_signal_handler.beam
erts/preloaded/ebin/erts_internal.beam
erts/preloaded/ebin/erts_literal_area_collector.beam
erts/preloaded/ebin/init.beam
erts/preloaded/ebin/otp_ring0.beam
erts/preloaded/ebin/prim_buffer.beam
erts/preloaded/ebin/prim_eval.beam
erts/preloaded/ebin/prim_file.beam
erts/preloaded/ebin/prim_inet.beam
erts/preloaded/ebin/prim_zip.beam
erts/preloaded/ebin/zlib.beam
|
|
Add support for otp level socket options rcvbuf, rcvctrlbuf and
sndctrlbuf. These options define default sizes for these
buffers.
The 'rcvbuf' is used when receiving messages when calling
the recv, recvfrom and recvmsg functions.
The 'rcvctrlbuf' is used for the control message header info
when calling the recvmsg function.
The 'sndctrlbuf' is used for the control message header info
when calling the sendmsg function.
OTP-14831
|
|
Added proper send timeout handling.
Made use of the enif_select(mode = cancel) feature. Each
time a timeout expires, the "active" send (the surrent write
select) has to be cancelled.
OTP-14831
|
|
Added proper connect and accept timeout handling.
Made use of the enif_select(mode = cancel) feature. Each
time a timeout expires, the previous operation (connect or accept)
has to be cancelled (actually its the select operation that has
to be cancelled). Only partial implementation of cancel for now
(connect and accept). More to follow...
OTP-14831
|
|
|
|
Some cleanup and also added a guard to sendmsg to ensure
that only ctrl (cmsg hdr) with actual content will be
"sent down".
OTP-14831
|
|
Updated the (send) cmsghdr type and the handling of it
(in the nif code). Still not tested!
Removed the is_loaded nif function.
Tried to get fix the doc build problem (socket.erl *i think*),
which causes socket.html generation to fail with:
"cannot find module exporting type"
To solve this I tried to run dialyzer on preloaded, and ran into
problems with enc_setopt_value. Update various specs and types
to "solve" this (which did not work).
Updated the nif-stub functions to make dialyzer happy.
|
|
Added support for (recvmsg) control message ipv6_pktinfo, for
level = ipv6 and type = pktinfo. This is enabled by setting the
socket option: recvpktinfo for level ipv6.
Not yet tested!
OTP-14831
|
|
Add more debug printouts for the new sendmsg. Also added
new (erlang) types with doc.
OTP-14831
|
|
Added function sendmsg/2,3,4. Actually worked on the first try.
Something must be wrong...
Still no supported cmsghdr's (only support headers where the
data part is already a binary, which therefor does not require
any processing). So if the cmsghdrs actually work is unclear.
OTP-14831
|
|
Added processing or more cmsg headers (for more options).
Now (also) supports: socket:timestamp.
Also various fixes and cleanups.
For some reason calling getopt(Sock, 0, {13, int}) (or similar)
fails with badarg even though the nif-function (nif_getopt) actually
returns a valid value (for instance: {ok, 0}).
OTP-14831
|
|
Added preliminary support for function recvmsg. At the moment
this only works on *nix (Windows has another function, WSARecvMsg,
which has a slightly different API).
Also we have "no" cmsg decode at the moment (just level and type).
OTP-14831
|
|
Added support for ip level socket option SENDSRCADDR.
This option requires sendmsg to actually use, so we
cannot test this fully at the moment.
OTP-14831
|
|
Added support for ip level socket option RECVORIGDSTADDR.
This option requires recvmsg to actually use, so we cannot
test this fully at the moment (although both set and get works).
OTP-14831
|
|
Updated the socket type. No longer store "stuff" that can
be retrieved by other means (domain, type and protocol).
OTP-14831
|
|
Added support for ip level socket option RETOPTS.
OTP-14831
|
|
Added support for ip level socket option TRANSPARENT.
OTP-14831
|
|
Added support for ip level socket option PKTINFO.
This option requires sendmsg and/or recvmsg to actually use,
so we cannot test this fully at the moment (although both set
and get works).
OTP-14831
|
|
Added support for ip level socket option HDRINCL.
As this option is raw only, it has not yet been tested!
OTP-14831
|
|
Added support for ip level socket option MSFILTER.
This option has not been tested *in any way*...
OTP-14831
|
|
Added support for the IPv6 socket option RECVERR.
To actually make use of this option, we need the recvmsg
function, which we don't have yet. Baby steps.
OTP-14831.
|
|
Added support for the IP socket option RECVERR.
To actually make use of this option, we need the recvmsg
function, which we don't have yet. Baby steps.
OTP-14831.
|
|
Added support for the IPv6 socket option ADDRFORM.
Only allowed for IPv6 sockets that are connected and bound to a
v4-mapped-on-v6 address.
OTP-14831.
|
|
Added support for the IPv6 socket option ROUTER_ALERT.
Only supported for raw sockets.
OTP-14831.
|
|
Added support for the IPv6 socket option UNICAST_HOPS.
OTP-14831.
|