aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2017-05-22Add enif_whereis_...() functionsTed Burghart
#### 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.
2017-05-22Merge branch 'hasse/stdlib/linter_check_dialyzer/OTP-14323'Hans Bolinder
* hasse/stdlib/linter_check_dialyzer/OTP-14323: stdlib: Warn for bad type variables of parameterized types
2017-05-22Merge branch 'hasse/dialyzer/fix_type_variable_bug/OTP-14423'Hans Bolinder
* hasse/dialyzer/fix_type_variable_bug/OTP-14423: dialyzer: Warn for bad type variables of parameterized types mnesia: Correct a type declaration
2017-05-22dialyzer: Warn for bad type variables of parameterized typesHans Bolinder
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).
2017-05-22mnesia: Correct a type declarationHans Bolinder
2017-05-22stdlib: Warn for bad type variables of parameterized typesHans Bolinder
The linter emits warnings about using '_' as type variable in parameterized types.
2017-05-22Merge branch 'raimo/gen_statem-dev'Raimo Niskanen
* raimo/gen_statem-dev: Fix documentation details
2017-05-22Fix documentation detailsRaimo Niskanen
2017-05-22Merge branch 'ingela/dtls/windows-econnreset'Ingela Anderton Andin
* ingela/dtls/windows-econnreset: ssl: Handle econnreset windows obscurities
2017-05-22ssl: Handle econnreset windows obscuritiesIngela Anderton Andin
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!
2017-05-22Merge branch 'hans/ssh/trim_state'Hans Nilsson
2017-05-22Merge branch 'hans/ssh/rsa-sha2-star_hostkey'Hans Nilsson
2017-05-22ssh: remove extra options copy from internal stateHans Nilsson
2017-05-22ssh: fix the rsa-sha2-* hostkey verify errorHans Nilsson
2017-05-22ssh: Handle if server-sig-algs and client has empty intersectionHans Nilsson
In case server-sig-algs names only algorithms unknown to the client, the client will try with the ones it knows
2017-05-22Revert "ssh: disable rsa-sha2-* for clients"Hans Nilsson
This reverts commit 4d7ff0a8169141d18335638cf7c6e48d4c18cdf2.
2017-05-22Merge branch 'ingela/ssl/ECDH_ECDSA/ERL-381/OTP-14421'Ingela Anderton Andin
* ingela/ssl/ECDH_ECDSA/ERL-381/OTP-14421: ssl: Improve tests ssl: Add missing algorithm ecdh_ecdsa
2017-05-22Merge branch 'dgud/observer/fix-bytes'Dan Gudmundsson
* dgud/observer/fix-bytes: observer: Fix words to bytes
2017-05-19Merge branch 'sverker/nif-docs'Sverker Eriksson
* sverker/nif-docs: erts: Improve erl_nif docs
2017-05-19ssl: Improve testsIngela Anderton Andin
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.
2017-05-19Merge branch 'rickard/ds-runqs'Rickard Green
OTP-14152 * rickard/ds-runqs: Make statistics/1 aware of dirty run-queues and tasks
2017-05-19Merge branch 'rickard/sighup-fix'Rickard Green
* rickard/sighup-fix: Restore sighup behaviour
2017-05-19Merge pull request #1448 from josevalim/jv-gen-server-exitsSiri Hansen
Do not discard stacktraces on gen_server exits
2017-05-19Restore sighup behaviourRickard Green
2017-05-19Merge branch 'master' into jv-gen-server-exitsSiri Hansen
2017-05-19Merge branch 'hasse/kernel/global_read_concurrency/OTP-14419'Hans Bolinder
* hasse/kernel/global_read_concurrency/OTP-14419: kernel: Create table 'global_names' with read_concurrency
2017-05-19Merge branch 'raimo/erts/use-all-bytes-in-abstract-addresses/OTP-14305'Raimo Niskanen
* raimo/erts/use-all-bytes-in-abstract-addresses/OTP-14305: Do not zero terminate Linux abstract addresses
2017-05-19Merge branch 'siri/ct_ssh/shell/OTP-14415'Siri Hansen
* siri/ct_ssh/shell/OTP-14415: [ct] Add ct_ssh:shell/2,3
2017-05-19Merge branch 'siri/etop/many-procs-timeout/OTP-14393'Siri Hansen
* siri/etop/many-procs-timeout/OTP-14393: [etop] Extend timer when fetching process info from node
2017-05-19Do not zero terminate Linux abstract addressesRaimo Niskanen
2017-05-19Update primary bootstrapHans Bolinder
2017-05-19Merge branch 'hasse/kernel/limit_crash_reports/OTP-14417'Hans Bolinder
* 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
2017-05-19Merge branch 'siri/cuddle-master'Siri Hansen
* siri/cuddle-master: [ct] Clean up after keep_logs test
2017-05-19[ct] Add ct_ssh:shell/2,3Siri Hansen
2017-05-19Make statistics/1 aware of dirty run-queues and tasksRickard Green
2017-05-19kernel: Create table 'global_names' with read_concurrencyHans Bolinder
Measurements showed contention on one of the ETS tables created by the 'global' module.
2017-05-19genop.tab: Add an OTP 20 commentBjörn Gustavsson
Make it clear that is_tagged_tuple/4 was added in OTP 20 (not R17).
2017-05-19ssl: Add missing algorithm ecdh_ecdsaIngela Anderton Andin
2017-05-19Update primary bootstrapBjörn Gustavsson
2017-05-19Merge branch 'bjorn/erts/refactor-beam_makeops'Björn Gustavsson
* bjorn/erts/refactor-beam_makeops: Allow multiple types per argument for specific instructions Modernize subroutine calls by removing '&' Eliminate the -gen_dest macro flag
2017-05-19Merge branch 'bjorn/cuddle-with-tests'Björn Gustavsson
* 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
2017-05-18stdlib: Limit the size of gen_statem's error eventsHans Bolinder
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).
2017-05-18kernel: Introcude error_logger:get_format_depth()Hans Bolinder
2017-05-18stdlib: Limit the size of proc_lib's crash reportsHans Bolinder
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.
2017-05-18stdlib: Limit the size of gen_server's error eventsHans Bolinder
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.
2017-05-18kernel: Add error_logger:limit_term/1Hans Bolinder
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.
2017-05-18stdlib: Add io_lib:limit_term/2Hans Bolinder
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]).
2017-05-18Merge pull request #1464 from bjorng/bjorn/bit-syntax-doc/ERL-387Björn Gustavsson
Improve bit syntax example page
2017-05-18Merge pull request #1466 from bjorng/bjorn/stdlib/safer-get_stacktraceBjörn Gustavsson
Call get_stacktrace/0 in a safer way
2017-05-18Merge pull request #1446 from hairyhum/crypto-duplicate-aes_gcmHans Nilsson
Remove duplicate aes_gcm from a list of ciphers