aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/dist.c
AgeCommit message (Collapse)Author
2018-09-18Merge 'sverker/erts/fix-aborted-pending-connection-race/OTP-15296'Sverker Eriksson
2018-09-18erts: Refactor port dist_entry & conn_id into PRTSDSverker Eriksson
spelled out as "port specific data".
2018-09-18Consolidate distribution entry state transitionsSverker Eriksson
* Make connection_id part of the distribution handle as {ConnId, DistEntry} in order for BIFs to verify correct connection. * Make distribution handle opaque to net_kernel. * Remove some unsafe lockless reads of DistEntry.flags * Change state ERTS_DE_STATE_EXITING to be more of an internal state that prevents erts from enqueue, encode or schedule new data to be sent. Otherwise it should behave like ERTS_DE_STATE_CONNECTED.
2018-09-11erts: Fix "Prevent inconsistent node lists" fixSverker Eriksson
done in a31216200bdee2c04b3fb3ae5e26607674715c8a that could cause a new pending connection to be incorrectly aborted.
2018-09-06Merge branch 'maint-21' into maintRickard Green
* maint-21: Updated OTP version Update release notes Update version numbers kernel: Fix missing abort_connection in net_kernel Prevent inconsistent node lists Fix an endless rescheduling loop when a process is executing process_info(self(), ...)
2018-09-05Prevent inconsistent node listsRickard Green
If net_kernel "forgets" to abort a connection (as it currently might), the garbage collection of a distribution entry could cause node lists to enter an inconsistent state.
2018-08-03erts: Fix seq_trace to not clear token for system messagesLukas Larsson
A lot of erts internal messages used behind APIs to create non-blocking calls, e.g. port_command, would cause the seq_trace token to be cleared from the caller when it should not. This commit fixes that and adds asserts that makes sure that all messages sent have to correct token set. Fixes: ERL-602
2018-07-18erts: Remove use of VALGRIND_PRINTF_XMLSverker Eriksson
which only existed in a patched version of valgrind (by pan) no longer used. Instead we use standard VALGRIND_PRINTF which will end up like this if valgrind log format is XML and valgrind version >= 3.9: <clientmsg> <tid>7</tid> <threadname>3_scheduler</threadname> <text>Test case #20 ei_encode_SUITE:test_ei_encode_long/1 </text> </clientmsg> Note the extra trailing whitespace that may occure before </text>.
2018-07-10erts: Fix buggy calls to erts_sys_explicit_8bit_getenvSverker Eriksson
Two of them only affect valgrind builds and the one for ERL_CRASH_DUMP_NICE seems benign. Return value changed in c2d70945dce9cb09d5d7120d6e9ddf7faac8d230 old -> new -1 -> 0 not found 0 -> 1 found ok 1 -> -1 found but too big
2018-05-16Replace previous suspend in setnode/3Rickard Green
2018-05-16New process suspend implementation based on async signalingRickard Green
2018-04-26erts: Optimize monitor signal by message piggybackSverker Eriksson
If no message/signal is sent (to same destination) then monitor signal is flushed when process is scheduled out.
2018-04-26erts: Cleanup some codeSverker Eriksson
2018-03-23Lift the type restrictions on seq_trace token labelsJohn Högberg
OTP-14899
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-02erts: Postpone idle DistEntry until abort is completedSverker Eriksson
2018-03-02erts: Refactor DistEntry.status flags into a stateSverker Eriksson
Just to simplify and get 4 distinctive states IDLE, PENDING, CONNECTED and EXITING. The old possible flag combos were: 0 PENDING CONNECTED CONNECTED|EXITING EXITING The two EXITING states did not serve any purpose other then as a slight optimization in monitor_node(_,false,_) to shortcut EXITING when there can be no monitors.
2018-03-02erts: Optimize dist transcoding toward erl_/jinterfaceSverker Eriksson
to only transcode if output buffer actually contains unsupported BIT_BINARY_EXT or EXPORT_EXT.
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-01-03Replace the libc environment with a thread-safe emulationJohn Högberg
putenv(3) and friends aren't thread-safe regardless of how you slice it; a global lock around all environment operations (like before) keeps things safe as far as our own operations go, but we have absolutely no control over what libc or a library dragged in by a driver/NIF does -- they're free to call getenv(3) or putenv(3) without honoring our lock. This commit solves this by setting up an "emulated" environment which can't be touched without going through our interfaces. Third-party libraries can still shoot themselves in the foot but benign uses of os:putenv/2 will no longer risk crashing the emulator.
2017-11-23Merge branch 'sverker/async-auto-connect/OTP-14370' AGAINSverker Eriksson
2017-11-23erts: Fix erlang:monitor toward c-nodesSverker Eriksson
by suppressing DOP_MONITOR_P, DOP_MONITOR_P_EXIT and DOP_DEMONITOR_P if not supported by the remote node. In 17e198d6ee60f7dec9abfed272cf4226aea44535 I changed the behavior of erlang:monitor to not raise badarg for c-nodes but instead create a monitor to only supervise the connection. But I forgot to prevent DOP_MONITOR_P and friends from being sent to the node that does not expect them. Note: We test both DFLAG_DIST_MONITOR and DFLAG_DIST_MONITOR_NAME for the node to support process monitoring. This is because erl_interface is buggy as it sets DFLAG_DIST_MONITOR without really supporting it. ToDo: Should erl_interface stop setting DFLAG_DIST_MONITOR or should we change the meaning of these flags?
2017-11-21erts: Fix preemption bug in erts_dist_commandSverker Eriksson
We should break out when out of reductions.
2017-11-17Merge branch 'sverker/async-auto-connect/OTP-14370'Sverker Eriksson
* sverker/async-auto-connect/OTP-14370: (37 commits) Move new|abort_connection_id to erts_internal Refactor erts_dsig_prepare argument dep(p) Cleanup net_kernel Improve connection aborting Abort all pending connections if net_kernel terminates erts: Put pending DistrEntry in separate list Refactor auto_connect into an outline function Remove unused ERTS_DSP_RWLOCK fix erlang specs and preloaded erts: Keep magic ref to DistEntry in net_kernel Allow DistEntries in ETS Remove faulty assert erts: Transcode tuple fallbacks erts: Ensure enc_term_int() always do progress erl_interface: Add tuple fallback tests erl_interface: Refactor ei_accept_SUITE Add optimistic DFLAG_DIST_HOPEFULLY for pending connections erts: Fix auto-connect toward erl_interface/jinterface erts: Let send(_,_,[noconnect]) enqueue msg on pending connection. Remove obsolete erlang:dgroup_leader ...
2017-11-16Merge branch 'maint'Rickard Green
* maint: Fix triggering of node monitors Conflicts: erts/emulator/beam/dist.c
2017-11-16Merge branch 'rickard/node-mon-proc-exit-race/OTP-14781' into maintRickard Green
* rickard/node-mon-proc-exit-race/OTP-14781: Fix triggering of node monitors
2017-11-15Move new|abort_connection_id to erts_internalSverker Eriksson
and drop _id suffix.
2017-11-15Refactor erts_dsig_prepare argument dep(p)Sverker Eriksson
Don't need to be pointer-pointer
2017-11-15Improve connection abortingSverker Eriksson
2017-11-15Abort all pending connections if net_kernel terminatesSverker Eriksson
2017-11-15erts: Put pending DistrEntry in separate listSverker Eriksson
2017-11-15Refactor auto_connect into an outline functionSverker Eriksson
and abort_pending_connection into own utility function.
2017-11-15erts: Keep magic ref to DistEntry in net_kernelSverker Eriksson
to make sure it's kept alive.
2017-11-15Remove faulty assertSverker Eriksson
Send may have failed, port exit with dist_entry cleaned up and then new pending connection with queued messages.
2017-11-15erts: Transcode tuple fallbacksSverker Eriksson
When finalizing outgoing distribution messages we transcode them into using tuple fallbacks if the receiver does not support bitstrings and export-funs. This can only happen if the message was first encoded toward a pending connection when the receiver was unknown. It's an optimistic approach optmimized for modern beam nodes, that expect real bitstrings and funs (since <R13). Only erl_interface/jinterface lack this support.
2017-11-15Add optimistic DFLAG_DIST_HOPEFULLY for pending connectionsSverker Eriksson
to avoid tuple fallbacks for export funs and bitstrings. ToDo: Re-encode if receiver turn out to be erl_interface/jinterface.
2017-11-15erts: Fix auto-connect toward erl_interface/jinterfaceSverker Eriksson
2017-11-15Remove obsolete erlang:dgroup_leaderSverker Eriksson
2017-11-15Remove obsolete erlang:dexit/2Sverker Eriksson
2017-11-15Remove obsolete erlang:dlink/1, dunlink/1 and dist_exit/3Sverker Eriksson
2017-11-15Remove obsolete erlang:dsendSverker Eriksson
2017-11-15erts: Async auto-connect for monitor_nodeSverker Eriksson
Removed distribution_SUITE:applied_monitor_node as it seems to test apply of trapping BIF and monitor_node does not trap anymore.
2017-11-15erts: Introduce asynchronous auto-connectSverker Eriksson
2017-11-15Fix triggering of node monitorsRickard Green
2017-09-05Merge branch 'rickard/dist/OTP-14459'Rickard Green
* rickard/dist/OTP-14459: Fix setnode/3 and erts_net_message()
2017-09-04Fix setnode/3 and erts_net_message()Rickard Green
2017-08-28Merge branch 'rickard/dist/OTP-14459' into rickard/dist/master/OTP-14459Rickard Green
Conflicts: erts/emulator/beam/bif.c erts/emulator/beam/dist.c erts/emulator/beam/dist.h erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_node_tables.c erts/emulator/beam/erl_node_tables.h erts/emulator/beam/external.c
2017-08-28Introduce sender in distributed signals and dflag configurationRickard Green
2017-08-28Optimize dist entry managementRickard Green