Age | Commit message (Collapse) | Author |
|
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.)
|
|
Also, change HandlerId from logger_simple to simple.
|
|
|
|
* maint:
Updated OTP version
Prepare release
Update appup file for sasl
Fix bug in hybrid boot file used for restart_new_emulator
Conflicts:
OTP_VERSION
lib/sasl/src/sasl.appup.src
|
|
The old hybrid did not update preloaded and mandatory module lists and
kernel processes.
|
|
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.
|
|
Include sys.config.src in release tar file
OTP-14950
|
|
|
|
|
|
|
|
|
|
|
|
Update erl_tar to support PAX format (redux)
OTP-14226
|
|
This commit introduces the following key changes:
- Support for reading tar archives in formats currently in common use,
such as v7, STAR, USTAR, PAX, and GNU tar's extensions to the
STAR/USTAR format.
- Support for writing PAX archives, only when necessary, using USTAR
when possible for greater portability.
These changes result in lifting of some prior restrictions:
- Support for reading archives produced by modern tar implementations
when other restrictions described below are present.
- Support for filenames which exceed 100 bytes in length, or paths which
exceed 255 bytes (see USTAR format specification for more details on
this restriction).
- Support for filenames of arbitrary length
- Support for unicode metadata (the previous behaviour of erl_tar was
actually violating the spec, by writing unicode-encoded data to fields
which are defined to be 7-bit ASCII, even though this technically
worked when using erl_tar at source and destination, it may not have
worked with other tar utilities, and this implementation now conforms
to the spec).
- Support for uid/gid values which cannot be converted to octal
integers.
|
|
Conflicts:
lib/sasl/test/systools_SUITE.erl
|
|
When both options 'warnings_as_errors' and 'silent' were given to
systools:make_script or systools:make_relup, no error reason would be
returned if warnings occured. Instead only the atom 'error' was
returned. This is now corrected.
Options 'warnings_as_errors' and 'no_warn_sasl' are now also allowed
for systools:make_tar.
|
|
The default value of 'mod' is '[]' and 'start_phases' is 'undefined'
in .app, but this value was not accepted if given in
the .app file. This is now corrected.
|
|
|
|
|
|
Add the possibility to use modules as trace data receivers. The functions
in the module have to be nifs as otherwise complex trace probes will be
very hard to handle (complex means trace probes for ports for example).
This commit changes the way that the ptab->tracer field works from always
being an immediate, to now be NIL if no tracer is present or else be
the tuple {TracerModule, TracerState} where TracerModule is an atom that
is later used to lookup the appropriate tracer callbacks to call and
TracerState is just passed to the tracer callback. The default process and
port tracers have been rewritten to use the new API.
This commit also changes the order which trace messages are delivered to the
potential tracer process. Any enif_send done in a tracer module may be delayed
indefinitely because of lock order issues. If a message is delayed any other
trace message send from that process is also delayed so that order is preserved
for each traced entity. This means that for some trace events (i.e. send/receive)
the events may come in an unintuitive order (receive before send) to the
trace receiver. Timestamps are taken when the trace message is generated so
trace messages from differented processes may arrive with the timestamp
out of order.
Both the erlang:trace and seq_trace:set_system_tracer accept the new tracer
module tracers and also the backwards compatible arguments.
OTP-10267
|
|
* henrik/update-copyrightyear:
update copyright-year
|
|
Add commonly used modules to the list of modules in
mandatory_modules/0. Having those modules listed will potentially
help the 'init' module to load them in parallel during start-up.
|
|
|
|
as a system process with preloaded code.
|
|
|
|
* dumbbell/function_clause-in-systools_make-format_error:
sasl: Fix crash in systools_make:format_error/1
OTP-11819
|
|
The crash occurred when systools:make_script/2 raises the
'duplicate_modules' error. Depending on the 'silent' option,
systools_make:format_error/1 is called to either format and display an
error message, or return a tuple containing the error properties.
When displaying a 'duplicate_modules' error message, format_error/1
receives a list of applications providing the same module(s):
[
{{Mod,App1,_}, {Mod,App2,_}},
...
]
However, before this fix, format_error/1 expected the following
structure, leading to a 'function_clause' exception:
[
{{Mod,_,App1,_,_}, {Mod,_,App2,_,_}},
...
]
The crash never occurred with the 'silent' option, because the error and
its properties are returned as is to the caller.
|
|
Conflicts:
erts/etc/win32/Install.c
|
|
Sometimes it is wanted to start erlang without loading the user dependent
.erlang file, for example in scripts and configure tests.
|
|
|
|
Using the low-level BEAM instructions, we can loop over each message in
the process queue and removes the first message that matches, without
receiving them all to later send them back to itself.
The function prim_eval:'receive'/2 is equivalent to the
following pseudo-code:
'receive'(F, T) ->
RESET MESSAGE QUEUE POINTER,
LOOP:
case PEEK CURRENT MESSAGE WITH TIMEOUT T of
{ok,Msg} ->
case F(Msg) of
nomatch ->
DECREMENT TIMEOUT T,
ADVANCE MESSAGE QUEUE POINTER,
GOTO LOOP;
Result ->
RESET MESSAGE QUEUE POINTER,
Result
end;
timeout ->
RESET MESSAGE QUEUE POINTER,
timeout
end.
To not break Dialyzer and other tools, we use a stub Erlang module which
abstract code is forcefully inserted into prim_inet.erl afterwards
compilation.
|
|
|
|
* Update systool_lib:read_term/1 to honour magic encoding comment in file.
* Add unicode option to re:compile and re:run when appropriate,
allowing e.g. unicode filenames.
* systools_make to allow unicode strings in .rel and .app files
|
|
|
|
rickard/r16/port-optimizations/OTP-10336
* rickard/port-optimizations/OTP-10336:
Change annotate level for emacs-22 in cerl
Update etp-commands
Add documentation on communication in Erlang
Add support for busy port message queue
Add driver callback epilogue
Implement true asynchronous signaling between processes and ports
Add erl_drv_[send|output]_term
Move busy port flag
Use rwlock for driver list
Optimize management of port tasks
Improve configuration of process and port tables
Remove R9 compatibility features
Use ptab functionality also for ports
Prepare for use of ptab functionality also for ports
Atomic port state
Generalize process table implementation
Implement functionality for delaying thread progress from unmanaged threads
Conflicts:
erts/doc/src/erl_driver.xml
erts/doc/src/erlang.xml
erts/emulator/beam/beam_bif_load.c
erts/emulator/beam/beam_bp.c
erts/emulator/beam/beam_emu.c
erts/emulator/beam/bif.c
erts/emulator/beam/copy.c
erts/emulator/beam/erl_alloc.c
erts/emulator/beam/erl_alloc.types
erts/emulator/beam/erl_bif_info.c
erts/emulator/beam/erl_bif_port.c
erts/emulator/beam/erl_bif_trace.c
erts/emulator/beam/erl_init.c
erts/emulator/beam/erl_message.c
erts/emulator/beam/erl_port_task.c
erts/emulator/beam/erl_process.c
erts/emulator/beam/erl_process.h
erts/emulator/beam/erl_process_lock.c
erts/emulator/beam/erl_trace.c
erts/emulator/beam/export.h
erts/emulator/beam/global.h
erts/emulator/beam/io.c
erts/emulator/sys/unix/sys.c
erts/emulator/sys/vxworks/sys.c
erts/emulator/test/port_SUITE.erl
erts/etc/unix/cerl.src
erts/preloaded/ebin/erlang.beam
erts/preloaded/ebin/prim_inet.beam
erts/preloaded/src/prim_inet.erl
lib/hipe/cerl/erl_bif_types.erl
lib/kernel/doc/src/inet.xml
lib/kernel/src/inet.erl
|
|
|
|
It was possible to insert {Mod::atom(),Vsn::term()} instead of
Mod::atom() in the modules list in a .app file. This was not visible
in the documentation of .app files, but it was visible in the
documentation of application:load/[1,2] (where the .app file term can
be used directly as first argument).
The Vsn part was never used, so this possibility has now been removed.
|
|
* jc/omit-undefined-start_phases-3:
Avoid undefined start_phases entry in .script
Avoid creating an undefined start_phases entry when generating a release
OTP-10003
|
|
* siri/sasl/correct-app-name-in-error/OTP-9888:
Fix error message if stdlib has faulty start type in .rel file
|
|
If stdlib had a different start type than permanent, systools_make
would fail but it would say that it was sasl that had faulty start
type. This has been corrected.
|
|
Inorder to align with reltool a {start_phases,undefined} entry in will
no longer occur in the application specification in .script files. The
start_phases entry will only exist if it contains real start phases.
Also, the default value for #application.start_phases is no longer set
to [] in systools.hrl. This value was actually never used, since it
was always explicitly set in systools_make:parse_applications - by
default to 'undefined', so the default value in the record definition
was only a confusing detail. Anyway - now corrected.
|
|
OTP-9984
Applications that are listed in {applications,Apps} in the app file
were not sorted correctly in the script file. They were loaded/started
in the reverse order of how they were listed in the .app file.
This is corrected so they are now sorted (internally between each
other) in the same way as they are listed in the .rel file.
|
|
* siri/sasl/check-config-in-tar/OTP-9539:
Check that sys.config and relup have valid content when added to tar
|
|
systools:make_tar now does a minor check of the content of sys.config
and relup before adding them to the tar file. If the content is not
readable or in expected format, the function fails.
|
|
It should not be possible to create a .boot file unless kernel and
stdlib are stated as permanent applications in the .rel file. Note
that 'permanent' is the default start type, so not specifying a start
type for kernel and stdlib is, as always, ok.
|
|
systool:make_tar stores the rel file in the releases directory. When
unpacking with release_handler:unpack_release, the file is
automatically moved to releases/<vsn>/. If, however, the tar file is
unpacked manually, the rel file might not be moved, and the next
release unpacked might overwrite the rel file. To overcome this,
systools:make_tar now stores a copy of the rel file in releases/<vsn>/
directly and it is not longer necessary to move the file after
unpacking.
The reason for keeping the file in the releases directory also is that
is needs to be extracted separately before the release version <vsn>
is known.
|
|
This option will suppress the 'missing-sasl' warning which otherwise
is issued when compiling a .rel file which does not include the sasl
application.
|
|
make_script will give warning but allow it
make_relup will fail since it is not possible to upgrade if sasl is
not included in both releases.
|
|
The sys.config file used for the temporary release in an erts upgrade
is now a hybrid where kernel, stdlib and sasl configuration is taken
from the new release, and other configuration is taken from the old
release. I.e. similar to how the temporary boot file is created.
|
|
If the version of erts differs between two releases, the release
handler automatically adds a 'restart_new_emulator' instruction to the
upgrade script (relup). Earlier, this instruction was always added at
the end of the upgrade script, causing the following sequence of
operations during an upgrade (a bit simplified):
1. suspend processes
2. load new code
3. execute code_change functions
4. resume processes
5. restart emulator with new erts version
Obviously, this caused the new code to be loaded into the old emulator
and this would fail if the beam format had been changed in the new
version of the emulator.
To overcome this problem, this commit changes the order of the
instructions, so for upgrade with changed erts version we now have:
1. restart emulator with new erts, kernel, stdlib and sasl versions,
but old versions of all other applications.
2. suspend processes
3. load new code
4. execute code_change functions
5. resume processes
This is implemented by creating a temporary release, including new
erts, kernel, stdlib and sasl from the new release and all other
applications from the old release. A new boot file for this temporary
release is created, which includes a new 'apply' instruction to run
release_handler:new_emulator_upgrade/2. Then the emulator is restarted
using this boot file - and release_handler:new_emulator_upgrade/2
executes the rest of the upgrade script.
For downgrade, the order will be as before:
1. suspend processes
2. execute code_change functions with 'down'-indication
3. load old code
4. resume processes
5. restart emulator with old erts version
|