Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
If the socket is closed by the remote end, sendfile
now returns {error,closed}.
|
|
* sverk/packet_size-http/OTP-9389:
erts: Remove truncation of http packet parsing and return error instead
honor packet_size for http packet parsing to fix OTP-9389
|
|
|
|
|
|
* ta/docs:
Fix misspelling of chosen
Fix typos in erl(1)
Fix misspelling of 'turn off'
Fix typo in reltool(3)
Fix typo in gen_sctp(3)
Fix typo in mod_responsecontrol.erl
Fix typo in erts_alloc(3)
Fix typos in ssl_cipher.erl
Fix typos in expressions.xml
file: correct make_link/2 and make_symlink/2 docs
Fix typo in test_server(3)
Fix typos in io_protocol.xml
Fix typo in erlang(3)
Fix typos in tar_SUITE
Fix typos in erts/preloaded/src
OTP-9787
|
|
* ao/fix-change-time-inval-dates:
Fix a crash when file:change_time/2,3 are called with invalid dates
OTP-9785
|
|
This is a slight modification of previous commit by Steve Vinoski
For backward compatibility of old users of decode_packet, I think it's enough
to return error instead of keeping the old line truncation behaviour.
|
|
Thanks Tuncer Ayaz
|
|
sendfilev is a richer API which allows us to
do non blocking TCP on solaris. The normal
sendfile API seems to have some issue with
non blocking sockets and the return value of
sendfile.
|
|
|
|
Allow applications to use a packet_size setting on a socket to control
acceptable HTTP header line length. This gives them the ability to
accept HTTP headers larger than the default settings allow, but also
lets them avoid DOS attacks by accepting header lines only up to
whatever length they wish to allow.
Without this change, if an HTTP request/response line or header
arrives on a socket in http, http_bin, httph, or httph_bin parsing
mode, and the request/response line or header is too long to fit into
a default inet_drv buffer of 1460 bytes, an unexpected error
occurs. These problems were described and discussed on
erlang-questions in June 2011 in this thread:
http://erlang.org/pipermail/erlang-questions/2011-June/059563.html
In the original code, no buffer reallocation occurs to enlarge the
buffer, even if packet_size or line_length are set in a way that
should allow the HTTP data to be parsed properly. The only available
workaround was to collect headers and parse them using
erlang:decode_packet, but that approach has drawbacks such as having
to collect all HTTP header data before it can be handed to
decode_packet for correct parsing, and also requiring each and every
Erlang web server developer/maintainer to add the workaround to his or
her web server.
Change the packet parser to honor the packet_size setting for HTTP
parsing. If packet_size is set, and an HTTP request/response or header
line exceeds the default 1460 byte TCP buffer limit, return an
indication to tcp_remain that it should realloc the buffer to enlarge
it to packet_size. Also fix the HTTP parsing code to properly honor
line_length by truncating any HTTP request/response or header lines
that exceed that setting.
For backward compatibility, default behavior is unchanged; if an
application wants to be able to accept long HTTP header lines, it must
set packet_size to an appropriate value. Buffer reallocation occurs
only when needed, so the original default buffer size in the code is
still the default.
Make the line mode parsing honor packet_size as well, for consistency.
Add new regression tests to the emulator decode_packet suite and also
to the kernel gen_tcp_misc suite.
The documentation for packet_size in inet:setopts/2 is already
sufficient.
Many thanks to Sverker Eriksson for his guidance on how to best fix
this bug and also for reviewing a number of patch attempts prior to
this one.
|
|
|
|
|
|
* sa/dialyzer-fixes:
Correct callback spec in application module
Refine warning about callback specs with extra ranges
Cleanup autoimport compiler directives
Fix Dialyzer's warnings in typer
Fix Dialyzer's warning for its own code
Fix bug in Dialyzer's behaviours analysis
Fix crash in Dialyzer
OTP-9776
|
|
* hb/kernel/too_greedy_disk_log/OTP-9764:
Make sure disk_log does not write too much data
|
|
While disk_log eagerly collects logged data for better performance,
collecting too much data may choke the system and cause huge binaries
to be written. (Reported by Klarna.)
(Logging data faster than the speed disk_log can write to disk can
still cause problems.)
|
|
|
|
|
|
|
|
|
|
|
|
* ta/sendfile/OTP-9240: (31 commits)
Add sendfile server printouts
Skip recv/send during tests for fallback platforms
Remove header/trailer support
Remove windows implementation
Expand sendfile documentation
Only allow tcp sockets as target for sendfile
Move sendfile api to file module
Preliminary work on header/trailer
Use free_sendfile explicitly for non-async
Remove debug printouts
Add tests for send/recv/sendfile interactions
Remove tests for file_server sendfile
sendfile caller now has to be the controlling_process
Remove support for file_server, sendfile has to be raw
Set chunk size to 3 GB
Change type of fd to be ErlDrvEvent
Add ifdef's for HAVE_SENDFILE
Fix freebsd support for sendfile
Change nbytes to 64 bit
Implement ignorefd for TCP
...
|
|
|
|
|
|
Since the API for headers/trailers seem to be very awkward to
work with when using non-blocking io the feature is dropped
for now. See unix_efile.c for more details.
|
|
|
|
Since sendfile could in theory be used to send to any type
of file descriptor in *nix, it is a better fit to have it
in file.
|
|
Have to figure out how to represent progress in header writing when
using non-blocking, not sure how to do this.
|
|
Tests for when a gen_tcp:send/recv is ordered while a
sendfile is in progress.
|
|
|
|
This is needed because otherwise there could be scenarios
when the efile driver blocks a fd and then crashes without
the inet driver ever finding out. Now when the process
crashes the port will close and we can cleanup in the inet
driver.
|
|
Because the sending process has to be the controlling process
of the tcp socket used to send data it is not possible to use
the file_server
|
|
Ignore fd is a feature used by sendfile to temporarily remove
all driver_select calls on that fd so that another driver can
select on it. It also delays all actions which sends or receives
data in that fd until in the fd is no longer ignored.
Only the controlling_process should use the feature as it is otherwise
possible that the ignore will never be cleaned up and hence create
a memory leak in the driver.
An ignored driver will not detect that an fd has been closed until
it is unignored.
|
|
When there are no async threads sendfile will use the
ready_output select on the socket fd to know when to send
data.
The file_desc will also be put in the sending sendfile_state
which buffers all other commands to that file until the
sendfile is done.
|
|
Move sendfile data to invoke data instead of file_descr.
Remove usage of ready_output when doing a send.
If told to send 0 bytes, file_sendfile now sends the entire file
for linux.
|
|
Move the command handling to outputv in preparation for
header and trailer inclusion in the sendfile api.
Use the standard efile communication functions for sendfile.
|
|
Created erlang fallback for sendfile in gen_tcp and
moved sendfile from file to gen_tcp. Also created testcases
for testing all different options to sendfile.
For info about how sendfile should work see the BSD man pages
as they contain a more complete API than other *nixes.
|
|
|
|
|
|
Allow Erlang code to use sendfile() where available by wrapping it as
file:sendfile/4 and file:sendfile/2.
sendfile(2) - Linux man page:
"sendfile() copies data between one file descriptor and another.
Because this copying is done within the kernel, sendfile() is more
efficient than the combination of read(2) and write(2), which would
require transferring data to and from user space."
|
|
|
|
|
|
|
|
* bjorn/code-loading:
code: Clean up loading of code_server prerequisites
beam_load.c: Add init_iff_file() for verifying the IFF header
beam_code.c: Don't reinvent state initialization and deallocation
beam_load.c: Optimize code:get_chunk/2
beam_load.c: Eliminate memory leak in code:make_stub_module/3
|
|
|
|
|
|
Reorganize in a systematic way the code that loads the modules needed
by the code_server process. While at it, remove the useless
hipe_unified_loader:load_hipe_modules/0 function.
|