aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-03-06Merge 'rickard/make-fixes-18/OTP-15657' into 'rickard/make-fixes-19/OTP-15657'Rickard Green
* rickard/make-fixes-18/OTP-15657: Remove own configured RM make variable
2019-03-06Merge 'rickard/make-fixes-17/OTP-15657' into 'rickard/make-fixes-18/OTP-15657'Rickard Green
* rickard/make-fixes-17/OTP-15657: Remove own configured RM make variable
2019-03-06Remove own configured RM make variableRickard Green
Instead rely on gnu make's pre-defined RM variable which should equal 'rm -f'
2019-03-06Add diameter_dist_SUITE to exercise diameter_dist:route_session/2Anders Svensson
Spread a server over three nodes, one of which terminates a peer connection, the other two to handle requests. Terminate transport on one of the server nodes and ensure that answers come only from the other two.
2019-03-06Add consistent hashing to diameter_dist:route_session/2Anders Svensson
If the Session-Id optional value to node() mapping fails then hash Session-Id to a node by default, instead of selecting the local node as in the parent commit. The previous behaviour is configurable by setting default = local in an options map. Nodes make themselves part of the pool from which nodes are selected by calling diameter_dist:attach/1 with the list of service names they are willing to handle requests for, the local node being selected in the absence of any attached nodes. The original idea was to base the node pool on share_peers and/or use_shared_peers configuration, but that configuration determines where outgoing requests can be sent, while route_session/2 deals with incoming requests, so it's not obvious that conflating the two is a good thing. (Also because share_peers/use_shared_peers can be used in different ways; the former could have been skipped entirely.) The hashing effectively places nodes on a circle, a hashed Session-Id being mapped to the nearest predecessor node (clockwise). Nodes are rehashed with each Session-Id (with the id as salt) for a more even distribution, at the cost of performance, although how high the cost or how even the distribution has yet to be tested. Obviously, the larger the number of attached nodes, the higher the cost. Adding/removing an attached node only affects session ids that hash in the interval between the added/removed node and its successor (hence consistent hashing). Options are tweaked slightly compared to the parent commit, and it is now possible to restrict the optional value mapping to specific Diameter identities, to avoid mapping an id that was generated at the peer when the peer is also implemented with the diameter application. Note that diameter_dist is not yet an officially documented interface, so could change. Documentation is in the module itself.
2019-03-06Add options to diameter_dist:route_session/2 node selectionAnders Svensson
To be able to restrict how many AVPs will be examined (from the front of a message) when looking for Session-Id, and to decide what to do with if the AVP isn't found. Options are specified as a map of the following form. #{search => non_neg_integer(), default => discard | mfa(), dispatch => list() | mfa()} The search member says how many AVPs to examine at most, from the front of the message. If the optional value of a Session-Id is not the name of a connected node then the default member determines what to do with the request, handle it locally (the default), discard it, or invoke an MFA on the Session-Id | false (if none was found) and diameter_packet record to return a node() | false; if the latter then the request is discarded. If a node is identified then the dispatch MFA is invoked on the node and the request MFA (as three arguments), a list Opts being equivalent to the MFA {erlang, spawn_opt, [Opts]}, and the default being the empty list. Integer- or list-valued options are equivalent to the corresponding map with a single value. Limiting the search is to avoid searching messages containing many AVPs for a Session-Id that is known to occur near the header, since section 8.8 of RFC 6733 says this: When present, the Session-Id SHOULD appear immediately following the Diameter header (see Section 3). There's no guarantee, but in practice it may well be known that peers are respecting the RFC, and in that case limiting the search is a defense against searching messages from a malicious peer unnecessarily. The search is unlimited by default. A default is only used when a search fails to locate a Session-Id, and can be to discard the message, or have a node() or false be returned from an MFA applied to the diameter_packet in question. The local node is chosen by default.
2019-03-06Add diameter_dist for ready spawn_opt callbacksAnders Svensson
That is, of functions that can be configured as spawn_opt MFAs in transport configuration. This commits adds the spawn_local described in the parent commit, and a route_session that assumes that the local node initiates all sessions with Session-Id returned by diameter:session_id/1, and handles incoming requests on the node on which the id in question was returned, diameter:session_id/1 using node() as optional value in the Session-Id format.
2019-03-06Tweak/document request handler callbackAnders Svensson
The possibility of configuring an MFA as spawn_opt was added in commit fd285079, the callback being passed an arity-0 fun to be applied in an appropriate handler process. Replace the fun by a tuple to be passed to diameter_traffic:request/1, to avoid passing funs between nodes when handler processes are remote. A list-valued spawn_opt is now equivalent to the following configured as {spawn_opt, {Mod, spawn_local, [Opts]}}. spawn_local(ReqT, Opts) -> spawn_opt(diameter_traffic, request, [ReqT], Opts). ReqT is passed by diameter and contains information that the callback may want to decide where to handle the request in question (which wasn't accessible with a fun), but this information isn't exposed in a documented way. The intention is instead to add an own callback implementation to make use of the information. Note that application lookup now takes place in the watchdog process in both the list-valued (or no configuration) and mfa-valued cases. Whether this is good, bad, or (probably) inconsequential remains to be seen.
2019-03-06Document acknowledgements in transport interfaceAnders Svensson
This is the {diameter, ack} message from a transport process to its parent that requests that every Diameter request passed to the parent be matched by a incoming send message, the atom false replacing a message() in the case that the request is unanswered, allowing the transport to keep track of the number of outstanding requests. These were added in commit ca09cf7b, and are used to implement the message_cb config in diameter_tcp/sctp, documented in commit cefcaa5c. This commit documents the interface, to make it available to other transport implementations.
2019-03-06Merge branch 'maint'Rickard Green
* maint: Updated OTP version Prepare release
2019-03-06Merge branch 'maint-21' into maintRickard Green
* maint-21: Updated OTP version Prepare release
2019-03-06[socket] More if-def to make it "work" on windowsMicael Karlberg
2019-03-06Merge branch 'maint'Rickard Green
* maint: kernel runtime dependency to erts erts: Add yield via timeout to inet read_packet erts: Don't increase buffer when sctp sndbuf is set erts: Only change inet buffer if not set
2019-03-06Merge branch 'lukas/erts/fix_inet_buffer_auto_adjust/OTP-15651/OTP-15652' ↵Rickard Green
into maint * lukas/erts/fix_inet_buffer_auto_adjust/OTP-15651/OTP-15652: kernel runtime dependency to erts erts: Add yield via timeout to inet read_packet erts: Don't increase buffer when sctp sndbuf is set erts: Only change inet buffer if not set
2019-03-06Merge branch 'rickard/bootstrap-build-fix'Rickard Green
* rickard/bootstrap-build-fix: Fix bootstrap build of erl_interface
2019-03-06Fix bootstrap build of erl_interfaceRickard Green
2019-03-06Slightly optimize is_eq and is_neBjörn Gustavsson
2019-03-06Optimize the '*' operator when multiplying two small integersBjörn Gustavsson
2019-03-06Optimize multiplication in binary matching instructionsBjörn Gustavsson
2019-03-06sys.h: Check for overflow checking aritmethic builtinsBjörn Gustavsson
Let sys.h define HAVE_OVERFLOW_CHECK_BUILTINS if the compiler supports __builtin_mul_overflow() and the other overflow checking builtins. The test is intentionally made in a sys.h and not as a configure test. On Windows, beam_emu.c is always compiled using gcc, but the other files are usually compiled with Microsoft's C compiler. With the test in the header file, HAVE_OVERFLOW_CHECK_BUILTINS will be defined when compiling beam_emu.c.
2019-03-06Eliminate unused i_bs_skip_bits_all2 instructionBjörn Gustavsson
Starting in OTP 19 (in commit 9504c0dd71d0), the compiler emits a test_unit instruction instead of a skip instruction at the end of binary. We can do the same replacement in the loader to get rid of the i_bs_skip_bits_all2 instruction.
2019-03-06Optimize field size calculation on a 64-bit architectureBjörn Gustavsson
On a 64-bit architecture, the size of any binary that would fit in the memory must fit in a small, so we can fail immediately if the size term is not a small.
2019-03-06Reduce code size for binary matching instructionsBjörn Gustavsson
The new compiler required adding support for Y register for all binary matching instructions. That was (intentionally) done in a naive way that simplicated duplicated the entire body of each instruction. Now it's time to be less naive. Rewrite the binary matching instructions using micro instructions. Because some of the binary instructions are huge, that will significantly decrease the size of process_main(). When compiling with clang, a huge process_main() would mess up profile-guide optimization resulting in a significant performance degradation. On my Mac, profile-guide optimzation would decrease the estone benchmark by 100K estones (about 20 percent). This commit gives me back the lost estones.
2019-03-06Deoptimize obsoleted binary matching instructionsBjörn Gustavsson
Mark the obsoleted instructions bs_start_match2, bs_save2, bs_restore2, and bs_context_to_binary as cold. Remove support of a Y operand for bs_save2 and bs_restore2.
2019-03-06Reclassify get_tuple_element with a Y destination as hotBjörn Gustavsson
get_tuple_element with an Y register has become more frequent with the new compiler.
2019-03-06Remove optimization that has become a pessimizationBjörn Gustavsson
The compiler used to generate "move Literal y(Y)" instructions very rarely. Therefore, there was a transformation to avoid having a "move c y" instruction. With the new compiler, "move Literal y(Y)" instructions are relatively frequent, so we will need a "move c y" instruction.
2019-03-06Introduce move_window2 and remove move2_par_xyxyBjörn Gustavsson
2019-03-06Optimize hd/1 and tl/1 in guardsBjörn Gustavsson
2019-03-06bif_instrs.tab: Don't hardcode length of instructionsBjörn Gustavsson
2019-03-06[socket] Use (new) enif_compare_pids functionMicael Karlberg
Replace the won function for pid compare with the (new) enif_compare_pids function. OTP-15565
2019-03-06Merge branch 'maint'Hans Bolinder
* maint: stdlib: Correct and optimize pretty printing of strings
2019-03-06Merge branch 'hasse/stdlib/optimize_pretty_printing/OTP-15639' into maintHans Bolinder
* hasse/stdlib/optimize_pretty_printing/OTP-15639: stdlib: Correct and optimize pretty printing of strings
2019-03-06Merge branch 'john/compiler/validator-type-conflict-fix/ERL-867'John Högberg
* john/compiler/validator-type-conflict-fix/ERL-867: beam_validator: Express test_arity/is_tagged_tuple as type tests beam_validator: Fix type subtraction on select_* and inequality beam_validator: Style fix for asserts in list comprehensions beam_validator: Infer types from bs_put instructions beam_validator: is_map no longer needs special treatment beam_validator: Refactor type conflict resolution beam_validator: Refactor branch handling beam_validator: Fix element/2 BIF handling beam_validator: Rename get_move_term_type and clean up get_raw_type
2019-03-06Add crypto:cipher_info/1 and crypto:hash_info/1Loïc Hoguin
Also adds some more aliases that contain the key length in their name.
2019-03-06[socket] CommentaryMicael Karlberg
Add some more comments in order to increase readability. OTP-15565
2019-03-06[logger] Add better control of file modes in logger_std_hSiri Hansen
OTP-15602 It is allowed to set file modes for the handler to use when opening its log file. The given modes were earlier accepted without any checks, which could make the handler behave unexpectedly. This commit makes sure that * if none of write, append or exclusive is given, then append is added * if raw is not given, it is added * if delayed_write or {delayed_write,_,_} is not given, then delayed_write is added
2019-03-06Update appup for diameter 2.2 in OTP 21.3Anders Svensson
2019-03-06[socket] Macro abuse of activate-nextMicael Karlberg
Implemented the activate_next function and added its "users" acceptor, writer and reader (macro abuse). After a request (accept, write or send) has been either successfully completed or failed, another request should be activated. Previously only one attempt was made, which might leave the other (waiting) requestors hanging. Now, instead we use a 'activate-next' function that pop's the request (accept, wrote or read) queue until success or its empty, thereby making sure that no waiting processes is left hanging. OTP-15565
2019-03-06Fix comment typoAnders Svensson
2019-03-06beam_validator: Express test_arity/is_tagged_tuple as type testsJohn Högberg
This ensures that unreachable branches are properly ignored on repeated checks (although tuple type subtraction isn't complete yet).
2019-03-06beam_validator: Fix type subtraction on select_* and inequalityJohn Högberg
Type subtraction never resulted in the 'none' type, even when it was obvious that it should. Once that was fixed it became apparent that inequality checks also fell into the same subtraction trap that the type pass warned about in a comment. This then led to another funny problem with select_val, consider the following code: {bif,'>=',{f,0},[{x,0},{integer,1}],{x,0}}. {select_val,{x,0},{f,70},{list,[{atom,false},{f,69}, {atom,true},{f,68}]}}. The validator knows that '>=' can only return a boolean, so once it has subtracted 'false' and 'true' it killed the state because all all valid branches had been taken, so validation would crash once it tried to branch off the fail label.
2019-03-06ssl: Verify CertificateVerifyPéter Dimitrov
Verify CertificateVerify message against the handshake context and the public key provided by the Certificate message. Remove 'Context' argument from state handler functions and store data in the state variable. Refactor get_handshake_context/1 to cover all implemented cases. Change-Id: If803e05009331d1ec7e0ba2ea2b81d917a0add6d
2019-03-06beam_emu.c: Rename the confusing macro GetR() to GetSource()Björn Gustavsson
2019-03-05Updated OTP versionOTP-21.2.7Erlang/OTP
2019-03-05Prepare releaseErlang/OTP
2019-03-05Merge branch 'lukas/erts/fix_inet_buffer_auto_adjust/OTP-15651/OTP-15652' ↵Erlang/OTP
into maint-21 * lukas/erts/fix_inet_buffer_auto_adjust/OTP-15651/OTP-15652: kernel runtime dependency to erts erts: Add yield via timeout to inet read_packet erts: Don't increase buffer when sctp sndbuf is set erts: Only change inet buffer if not set
2019-03-05Merge branch 'rickard/make-fixes-21/OTP-15551' into maint-21Erlang/OTP
* rickard/make-fixes-21/OTP-15551: Fix install phase in build system
2019-03-05Merge branch 'hans/ssh/cuddle_tests'Hans Nilsson
* hans/ssh/cuddle_tests: crypto: Filter test case ciphers for supported ones
2019-03-05ftp: Fix timing bugIngela Anderton Andin
Change code to not send a message to itself as this allows other messages to come in between. A change in TLS code made this scenario more likely to happen, and the symptom is that the ftp:chunk_recv/1 function hangs.
2019-03-05Merge branch 'rickard/bootstrap-build-fix'Rickard Green
* rickard/bootstrap-build-fix: Fix build of bootstrap