Age | Commit message (Collapse) | Author |
|
|
|
A new {line_delimiter, byte()} option allows line-oriented TCP-based protocols
to use a custom line delimiting character. It is to be used in conjunction
with {packet, line}.
This option also works with erlang:decode_packet/3 when its first argument
is 'line'.
|
|
* maint:
erts: Make sure to deal with EINTR write failures
|
|
* lukas/erts/ttsl_eintr/OTP-12987:
erts: Make sure to deal with EINTR write failures
|
|
|
|
|
|
* sverk/inet-packet-ssl_tls-passive:
erts: Fix inet packet mode ssl_tls for passive mode
|
|
* maint:
Add configure switch --disable-saved-compile-time
Fix ethread events with timeout
Improve choice of clock sources at build time
|
|
Caused stack corruption leading to VM crash on windows.
{packet,ssl_tls} is undocumented by the way.
|
|
Lots of pthread platforms unnecessarily falled back on the pipe/select
solution. This since we tried to use the same monotonic clock source
for pthread_cond_timedwait() as used by OS monotonic time. This has
been fixed on most platforms by using another clock source.
Darwin can however not use pthread_cond_timedwait() with monotonic
clock source and has to use the pipe/select solution. On darwin we
now use select with _DARWIN_UNLIMITED_SELECT in order to be able to
handle a large amount of file descriptors.
|
|
Conflicts:
OTP_VERSION
erts/vsn.mk
|
|
|
|
The OSE port is no longer supported and this commit removed it
and any changes related to it. The things that were general
improvements have been left in the code.
|
|
|
|
|
|
* nybek/fix_so_linger_zero__simple:
Update prim_inet.beam
Fix socket option {linger, {true, 0}} to abort TCP connections
Apply 'show_econnreset' socket option to send errors as well
Add 'show_econnreset' TCP socket option
|
|
Up until now, if {linger, {true, 0}} is set on the socket and there is
data in the port driver queue, the connection is not aborted until
the port queue is empty and close() is called on the underlying file
descriptor. This bug allows an idle TCP client to prevent a server
from terminating the connection and freeing resources. This patch
fixes the problem by discarding the port queue if the socket is closed
when {linger, {true, 0}} is set.
|
|
Up till now all send errors have been translated into a generic
{error, closed}. This patch allows {error, econnreset} to be
returned on send errors when it is detected that the TCP peer
has sent an RST.
|
|
An ECONNRESET is a socket error which tells us that a TCP peer has sent
an RST. The RST indicates that they have aborted the connection and
that the payload we have received should not be considered complete. Up
until now, the implementation of TCP in inet_drv.c has hidden the
receipt of the RST from the user, treating it as though it was just
a FIN terminating the read side of the socket.
There are many cases where user code needs to be able to distinguish
between a socket that was closed normally and one that was aborted.
Setting the option {show_econnreset, true} enables the user to receive
ECONNRESET errors on both active and passive sockets.
A connected socket returned from gen_tcp:accept/1 will inherit the
show_econnreset setting of the listening socket.
By default this option is set to {show_econnreset, false}.
Note that this patch only enables the reporting of ECONNRESET when
the socket is being read from. It does not report ECONNRESET (or
EPIPE) when the user tries to write to a connection when an RST
has already been received. Currently the TCP implementation in
inet_drv.c hides all such send errors from the user in favour
of returning {error, close}. A separate patch will be needed to
enable the reporting of such errors.
|
|
Fix the sorting logic in add_multi_timer() and expand the test case
coverage around this area.
|
|
OTP-12797
|
|
If the driver queue is empty, or the user is requesting a 'read'
shutdown, then the shutdown() syscall is performed synchronously, as
per the old version of shutdown/2.
However, if the user is requesting a 'write' or 'read_write' shutdown,
and there is data in the driver queue for the socket, then the
shutdown() syscall is delayed and handled asynchronously when the
driver queue is written out.
This version of shutdown solves a number of issues with the old
version. The two main solutions it offers are:
* It doesn't block when the TCP peer is idle or slow. This is the
expected behaviour when shutdown() is called: the caller needs
to be able to continue reading from the socket, not be prevented
from doing so.
* It doesn't truncate the output. The current version of
gen_tcp:shutdown/2 will truncate any outbound data in the driver
queue after about 10 seconds if the TCP peer is idle of slow. Worse
yet, it doesn't even inform anyone that the data has been
truncated: 'ok' is returned to the caller; and a FIN rather than
an RST is sent to the TCP peer.
For a detailed description of all the problems with the old version
of shutdown, please see the EEP Light that was written to justify
this patch.
|
|
check (nbytes == 0 && d->c.sendfile.nbytes == 0) when efile_sendfile returns 0 and
has EAGAIN set.
FreeBSD sendfile(2) man page:
When using a socket marked for non-blocking I/O, sendfile() may send
fewer bytes than requested. In this case, the number of bytes
successfully written is returned in *sbytes (if specified), and the error
EAGAIN is returned.
The number of bytes successfully written can be 0. If this happens and
in a request handling either file:sendfile/2 or file:sendfile/5 with Bytes=0,
the sendfile loop will stop prematurely and file:sendfile will return
{ok, BytesSent} where BytesSent < DataAfterOffset, effectively breaking sendfile
support on FreeBSD.
|
|
|
|
The `invoke_pwritev()` function was in some places using the union
member intended for the `invoke_writev()` function.
|
|
|
|
All uses of these macros were removed in
commit c3a615aa2da09bc3a0575e973959f800460a63de.
|
|
* seriyps/zlib-inflate-bound:
Add zlib limited output buffer size functionality
Conflicts:
erts/preloaded/ebin/zlib.beam
OTP-12548
|
|
This functionality may be useful for compressed streams with high
compression ratio (in case of gzip it may be up to x1000), when
small amount of compressed data will produce large amount of
uncompressed output. This may lead to DoS attacks, because
server easily goes out of memory.
Example of such high compression ratio stream:
```
dd if=/dev/zero of=sparse.bin bs=1MB count=100 # 100mb of zeroes
gzip sparse.bin # 95kb sparse.bin.gz
$ erl
> {ok, Compressed} = file:read_file("sparse.bin.gz"),
> 97082 = size(Compressed),
> Uncompressed = zlib:gunzip(Compressed),
> 100000000 = iolist_size(Uncompressed).
```
|
|
Conflicts:
OTP_VERSION
erts/emulator/sys/unix/sys.c
erts/vsn.mk
|
|
|
|
* egil/fix-getifaddrs-realloc/OTP-12445:
erts: Fix getifaddrs realloc ptr mismatch
|
|
When a buffer was exhausted and subsequently a realloc, we could get
an invalid pointer.
For this to occur we would need to have a realloc to lower adresses.
The symptom would be garbage returned from erlang:port_control(Port, 25, [])
(prim_inet:getifaddrs(Port) resulting in a badarg) or a segmentation fault.
|
|
Closes all open socket before writing crashdump to file.
|
|
|
|
The intention of this callback is to close all sockets associated to
a port. It is closed only on crashdumps.
This will currently only be used for the epmd port.
|
|
* lukas/erts/crashdump_improvements/OTP-12377:
erts: Make main thread safe from pipe closed event
erts: Improve crash dumps
erts: Rename sys_sigset to sys_signal
erts: Introduce thread suspend functions
erts: Remove usage of QUANTIFY signal
erts: Add support for thread names
ets: Increase data available in crash dumps and ets:info
erts: Start compilation of beam_emu earlier
|
|
Also removed old legacy fallback that is no longer used
|
|
Handle peer addresses that are unconfirmed (i.e. in state SCTP_UNCONFIRMED).
Handle unknown states instead of using ASSERT
|
|
and usage
|
|
* maint:
erts: getsockname is not allowed on non-bound sockets
|
|
* lukas/erts/fdopen_non_bound_win32_fix/OTP-12289:
erts: getsockname is not allowed on non-bound sockets
|
|
* maint:
erts: Initialize links when reading file info
|
|
* lukas/erts/non-blocking-shell:
Fix io:columns/0 timeout when invoked via user
kernel,ssh: Add synchronous user_drv protocol
erts: Make writing to non-tty fds non-blocking
erts: Make tty driver non-blocking
|
|
Added a put_chars_sync to the protocol that can be used to
talk to user_drv and made group use it. This is needed in order
to guarantee that bytes has been pushed to the tty port when
doing something like this:
io:format("halting\n"),erlang:halt(0).
Before this change the halting message could be lost in the message
queue of the user_drv process, this is no longer possible.
This commit also fixes ssh_cli as that plugs itself in as a user_drv
process.
OTP-12240
|
|
Instead of using blocking call to fwrite, the tty driver
now uses non-blocking calls to writev and queues any output
data that cannot be written into the driver queue. Without
this change an stdout write could block an entire scheduler
if for some reason the pseudo tty on the other side does not
consume the output of the Erlang shell.
OTP-12239
|
|
|
|
This only produces an error on win32, but should not really be called
on *nix either.
|
|
|
|
Conflicts:
erts/doc/src/notes.xml
erts/preloaded/ebin/prim_inet.beam
erts/vsn.mk
lib/kernel/doc/src/notes.xml
lib/kernel/vsn.mk
|