Age | Commit message (Collapse) | Author |
|
#### Why do we need this new feature?
There are cases when a NIF needs to send a message, using `enif_send()`, to a long-lived process with a registered name.
A common use-case is logging, where asynchronous fire-and-forget messages are the norm.
There can also be cases where a yielding or dirty NIF or background thread may request a callback from a service with additional information it needs to complete its operation, yielding or waiting (with suitable timeouts, etc) until its state has been updated through the NIF module's API.
NIFs can only send messages to pids, and the lack of name resolution leaves a complicated dance between separate monitoring processes and the NIF as the only way to keep a NIF informed of the whereabouts of such long-lived processes.
Providing a reliable, built-in facility for NIFs to resolve process (or port) names simplifies these use cases considerably.
#### Risks or uncertain artifacts?
Testing has not exposed any significant risk.
The implementation behaves as expected on regular and dirty scheduler threads as well as non-scheduler threads.
By constraining the `enif_whereis_...()` functions to their minimal scopes and using patterns consistent with related functions, the implementation, testing, and maintenance burden is low.
The API and behavior of existing functions is unchanged.
#### How did you solve it?
While extending `enif_send()` to operate on a pid or an atom (as `erlang:send/2` does) was attractive, it would have entailed changing the type of its `to_pid` parameter and thereby breaking backward compatibility.
The same consideration applies to `enif_port_command()`.
That leaves a choice between 1, 2, or 3 new functions:
1. `enif_whereis()`
2. `enif_whereis_pid()` and `enif_whereis_port()`
3. All of the above.
While option (1), directly mimicking the behavior of `erlang:whereis/1`, is appealing, it poses potential problems if `pid()` or `port()` are subsequently implemented as non-integral types that must be bound to an owning `ErlNifEnv` instance.
Therefore, option (2) has been chosen to use `ErlNifPid`/`ErlNifPort` structures in the API to maintain proper term ownership semantics.
|
|
* hasse/stdlib/linter_check_dialyzer/OTP-14323:
stdlib: Warn for bad type variables of parameterized types
|
|
* hasse/dialyzer/fix_type_variable_bug/OTP-14423:
dialyzer: Warn for bad type variables of parameterized types
mnesia: Correct a type declaration
|
|
As of commit 854ee8b (Erlang/OTP 18) warnings about using '_' as type
variable in parameterized types have not been output.
The code of erl_types:t_var_names() is corrected. The spec is also
corrected (thanks to Kostis for pointing out the bug).
|
|
|
|
The linter emits warnings about using '_' as type variable in
parameterized types.
|
|
* raimo/gen_statem-dev:
Fix documentation details
|
|
|
|
* ingela/dtls/windows-econnreset:
ssl: Handle econnreset windows obscurities
|
|
An UDP socket does note have a connection and should
not recive econnreset, however this happens on on some windows versions.
Just ignoring it appears to make things work as expected!
|
|
|
|
|
|
|
|
|
|
In case server-sig-algs names only algorithms unknown to the client, the client will try with the ones it knows
|
|
This reverts commit 4d7ff0a8169141d18335638cf7c6e48d4c18cdf2.
|
|
* ingela/ssl/ECDH_ECDSA/ERL-381/OTP-14421:
ssl: Improve tests
ssl: Add missing algorithm ecdh_ecdsa
|
|
* dgud/observer/fix-bytes:
observer: Fix words to bytes
|
|
* sverker/nif-docs:
erts: Improve erl_nif docs
|
|
Test should check that we get the expected key exchange algorithm
for the provided server cert. We do not want to test OpenSSL s_server.
Do not try to test cipher suites against OpenSSL that it does not
support.
|
|
OTP-14152
* rickard/ds-runqs:
Make statistics/1 aware of dirty run-queues and tasks
|
|
* rickard/sighup-fix:
Restore sighup behaviour
|
|
Do not discard stacktraces on gen_server exits
|
|
|
|
|
|
* hasse/kernel/global_read_concurrency/OTP-14419:
kernel: Create table 'global_names' with read_concurrency
|
|
* raimo/erts/use-all-bytes-in-abstract-addresses/OTP-14305:
Do not zero terminate Linux abstract addresses
|
|
* siri/ct_ssh/shell/OTP-14415:
[ct] Add ct_ssh:shell/2,3
|
|
* siri/etop/many-procs-timeout/OTP-14393:
[etop] Extend timer when fetching process info from node
|
|
|
|
|
|
* hasse/kernel/limit_crash_reports/OTP-14417:
stdlib: Limit the size of gen_statem's error events
kernel: Introcude error_logger:get_format_depth()
stdlib: Limit the size of proc_lib's crash reports
stdlib: Limit the size of gen_server's error events
kernel: Add error_logger:limit_term/1
stdlib: Add io_lib:limit_term/2
|
|
* siri/cuddle-master:
[ct] Clean up after keep_logs test
|
|
|
|
|
|
Measurements showed contention on one of the ETS tables created by the
'global' module.
|
|
Make it clear that is_tagged_tuple/4 was added in OTP 20 (not R17).
|
|
|
|
|
|
* bjorn/erts/refactor-beam_makeops:
Allow multiple types per argument for specific instructions
Modernize subroutine calls by removing '&'
Eliminate the -gen_dest macro flag
|
|
* bjorn/cuddle-with-tests:
code_SUITE: Remove unused functions
Eliminate warning for variable 'Config' being unused
compile_SUITE: Don't create a directory called 'core'
Don't crash in end_per_testcase/2 in code_SUITE:on_load_embedded/1
|
|
The postponed events, the user state and data, and the error
reason are all limited in error events (if the Kernel variable
error_logger_format_depth is set).
|
|
|
|
The size of the message queue and the dictionary is limited in
crash reports.
To avoid creating the potentially huge list of messages of the message
queue, messages are received (if the Kernel variable
error_logger_format_depth is set).
The tag 'message_queue_len' has been added to the crash report.
|
|
The state of the gen_server is limited in error events before exiting
(if the Kernel variable error_logger_format_depth is set).
An alternative is to let the error_logger limit all messages
(error_msg, format, warning_msg, info_msg), which would not limit
reports and also add a smallish overhead to event logging.
It is not decided if the alternative is to be implemented.
|
|
Calling error_logger:limit_term/1 before sending terms as events to
the error_logger can be used for limiting the size of the messages.
Doing so will not change the output, but potentially save memory.
The Kernel variable error_logger_format_depth is used when limiting
the size of terms.
|
|
The term returned by io_lib:limit_term(Term, Depth) should return
the same string if substituted for Term in
io_lib:format("~P", [Term, Depth]) or io_lib:format("~W", [Term, Depth]).
|
|
Improve bit syntax example page
|
|
Call get_stacktrace/0 in a safer way
|
|
Remove duplicate aes_gcm from a list of ciphers
|