Age | Commit message (Collapse) | Author | |
---|---|---|---|
2017-11-30 | Add syntax in try/catch to retrieve the stacktrace directly | Björn Gustavsson | |
This commit adds a new syntax for retrieving the stacktrace without calling erlang:get_stacktrace/0. That allow us to deprecate erlang:get_stacktrace/0 and ultimately remove it. The problem with erlang:get_stacktrace/0 is that it can keep huge terms in a process for an indefinite time after an exception. The stacktrace can be huge after a 'function_clause' exception or a failed call to a BIF or operator, because the arguments for the call will be included in the stacktrace. For example: 1> catch abs(lists:seq(1, 1000)). {'EXIT',{badarg,[{erlang,abs, [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20|...]], []}, {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,674}]}, {erl_eval,expr,5,[{file,"erl_eval.erl"},{line,431}]}, {shell,exprs,7,[{file,"shell.erl"},{line,687}]}, {shell,eval_exprs,7,[{file,"shell.erl"},{line,642}]}, {shell,eval_loop,3,[{file,"shell.erl"},{line,627}]}]}} 2> erlang:get_stacktrace(). [{erlang,abs, [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22, 23,24|...]], []}, {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,674}]}, {erl_eval,expr,5,[{file,"erl_eval.erl"},{line,431}]}, {shell,exprs,7,[{file,"shell.erl"},{line,687}]}, {shell,eval_exprs,7,[{file,"shell.erl"},{line,642}]}, {shell,eval_loop,3,[{file,"shell.erl"},{line,627}]}] 3> We can extend the syntax for clauses in try/catch to optionally bind the stacktrace to a variable. Here is an example using the current syntax: try Expr catch C:E -> Stk = erlang:get_stacktrace(), . . . In the new syntax, it would look like: try Expr catch C:E:Stk -> . . . Only a variable (not a pattern) is allowed in the stacktrace position, to discourage matching of the stacktrace. (Matching would also be expensive, because the raw format of the stacktrace would have to be converted to the cooked form before matching.) Note that: try Expr catch E -> . . . is a shorthand for: try Expr catch throw:E -> . . . If the stacktrace is to be retrieved for a throw, the 'throw:' prefix must be explicitly included: try Expr catch throw:E:Stk -> . . . | |||
2017-11-30 | Merge branch 'maint' | Björn Gustavsson | |
* maint: Fix max atom size overflow on 64-bits Erlang by lowering the MAX_ATOM_TABLE_SIZE Fix integer overflow when set a large maximum value for atom table | |||
2017-11-30 | Merge pull request #1633 from sunboshan/atom-size-fix | Björn Gustavsson | |
Fix integer overflow when set a large maximum value for atom table OTP-14796 | |||
2017-11-27 | erts: Fix bad merge of PR #1644 | Björn Gustavsson | |
2017-11-27 | Merge branch 'maint' | John Högberg | |
2017-11-27 | Merge branch 'john/erts/fix-nif-ioq-version/OTP-14779' into maint | John Högberg | |
2017-11-24 | Fix purging of modules with "fake literals" | Björn Gustavsson | |
When compiling Erlang source code, the literal area for the module can only contain data types that have a literal syntax. However, it is possible to sneak in other data types (such as references) in the literal pool by compiling from abstract or assembly code. Those "fake literals" would work fine, but would crash the runtime system when the module containing the literals was purged. Although fake literals are not officially supported, the runtime should not crash when attempting to use them. Therefore, fix the garbage collection of literals and releasing of literal areas. https://bugs.erlang.org/browse/ERL-508 | |||
2017-11-24 | Merge branch 'maint' | Björn Gustavsson | |
* maint: Use base64 encoding in crash dumps Correct parsing of sub binaries Generalize passing of options for decoding | |||
2017-11-24 | Merge branch 'bjorn/base64-in-dumps/OTP-14686' into maint | Björn Gustavsson | |
* bjorn/base64-in-dumps/OTP-14686: Use base64 encoding in crash dumps Correct parsing of sub binaries Generalize passing of options for decoding | |||
2017-11-23 | Merge branch 'sverker/async-auto-connect/OTP-14370' AGAIN | Sverker Eriksson | |
2017-11-23 | erts: Fix erlang:monitor toward c-nodes | Sverker 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-21 | Merge branch 'maint' | Sverker Eriksson | |
2017-11-21 | Merge branch 'sverker/nif-debug-bin-check' into maint | Sverker Eriksson | |
2017-11-21 | erts: Fix preemption bug in erts_dist_command | Sverker Eriksson | |
We should break out when out of reductions. | |||
2017-11-21 | erts: Remove obsolete comments | Sverker Eriksson | |
2017-11-21 | Use base64 encoding in crash dumps | Björn Gustavsson | |
This will reduce the size of crash dumps, especially if there are large binaries. | |||
2017-11-20 | Fix max atom size overflow on 64-bits Erlang by lowering the | Boshan Sun | |
MAX_ATOM_TABLE_SIZE Currently, the max atom size on 64-bits Erlang is ((UWORD_CONSTANT(1) << 32) = 4294967296 This number will cause the range of atom size to be displayed as [8192-0]. Also, the +t option for max atom size will be parsed as a long type, and assigned to a int variable erts_atom_table_size (erl_init.c), which will cause integer overflow if the number is larger than the maximum value a 4-bytes signed integer can hold ((1 << 31) - 1) = 2147483647 Therefore, during the comparison erts_atom_table_size < MIN_ATOM_TABLE_SIZE any number above 2147483647 will be come negative, and causing the condition to be true, which then errored out as bad atom table size. Hence, the actual max atom size is same as the max signed int value. | |||
2017-11-20 | Fix integer overflow when set a large maximum value for atom table | Boshan Sun | |
When setting maximum atom table size using +t option, there will be a integer overflow for a large size. $ erl +t2147482625 ll_alloc: Cannot allocate 18446744073692774400 bytes of memory (of type "atom_tab"). The overflow is caused by the arithmetic operations on int type. When 2147482625 + 1024 it will become -2147483647 due to the signed integerger overflow. Then the result will be resized to Uint type, which is a unsigned long type, the negative int will first be expand to 64 bits long via sign extension, then change to unsigned type, which becomes 18446744073692774400. The fix is done by convert `limit` to Uint type before doing any arithmetic operation. This will expand variable to 64 bits long type via zero extension, then the following operation are all positive, therefore no overflow will happen. Note: here we assume the int `limit` passed in is always positive. If some future change cause the `limit` passed in maybe negative, then the current fix will also cause overflow. | |||
2017-11-20 | Merge branch 'lukas/stdlib/maps_iterators/OTP-14012' | Lukas Larsson | |
* lukas/stdlib/maps_iterators/OTP-14012: erts: Limit size of first iterator for hashmaps Update primary bootstrap Update preloaded modules erts: Remove erts_internal:maps_to_list/2 stdlib: Make io_lib and io_lib_pretty use maps iterator erts: Implement batching maps:iterator erts: Implement maps path iterator erts: Implement map iterator using a stack stdlib: Introduce maps iterator API Conflicts: bootstrap/lib/stdlib/ebin/io_lib.beam bootstrap/lib/stdlib/ebin/io_lib_pretty.beam erts/emulator/beam/bif.tab erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/zlib.beam | |||
2017-11-20 | erts: Limit size of first iterator for hashmaps | Lukas Larsson | |
2017-11-20 | erts: Remove erts_internal:maps_to_list/2 | Lukas Larsson | |
This function is no longer needed as maps:iterator has now been implemented. | |||
2017-11-20 | erts: Implement batching maps:iterator | Lukas Larsson | |
This iterator implementation fetches multiple elements to iterate over in one call to erts_internal:maps_next instead of one at a time. This means that the memory usage will go up for the iterator as we are buffering elements, but the usage is still bounded. In this implementation the max memory usage is 1000 words. Using this approach makes the iterator as fast as using maps:to_list, so maps:iterator/2 has been removed. | |||
2017-11-17 | Merge 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-16 | Merge branch 'maint' | Rickard Green | |
* maint: Fix triggering of node monitors Conflicts: erts/emulator/beam/dist.c | |||
2017-11-16 | Merge branch 'rickard/node-mon-proc-exit-race/OTP-14781' into maint | Rickard Green | |
* rickard/node-mon-proc-exit-race/OTP-14781: Fix triggering of node monitors | |||
2017-11-16 | Merge pull request #1626 from bjorng/bjorn/erts/fix-receive-opt/ERL-511 | Björn Gustavsson | |
Fix broken receive mark after an exception OTP-14782 | |||
2017-11-15 | Move new|abort_connection_id to erts_internal | Sverker Eriksson | |
and drop _id suffix. | |||
2017-11-15 | Refactor erts_dsig_prepare argument dep(p) | Sverker Eriksson | |
Don't need to be pointer-pointer | |||
2017-11-15 | Improve connection aborting | Sverker Eriksson | |
2017-11-15 | Abort all pending connections if net_kernel terminates | Sverker Eriksson | |
2017-11-15 | erts: Put pending DistrEntry in separate list | Sverker Eriksson | |
2017-11-15 | Refactor auto_connect into an outline function | Sverker Eriksson | |
and abort_pending_connection into own utility function. | |||
2017-11-15 | Remove unused ERTS_DSP_RWLOCK | Sverker Eriksson | |
2017-11-15 | erts: Keep magic ref to DistEntry in net_kernel | Sverker Eriksson | |
to make sure it's kept alive. | |||
2017-11-15 | Allow DistEntries in ETS | Sverker Eriksson | |
2017-11-15 | Remove faulty assert | Sverker Eriksson | |
Send may have failed, port exit with dist_entry cleaned up and then new pending connection with queued messages. | |||
2017-11-15 | erts: Transcode tuple fallbacks | Sverker 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-15 | erts: Ensure enc_term_int() always do progress | Sverker Eriksson | |
even when reds <= 1 Removed micro optimization for first fun variable to make things simpler. | |||
2017-11-15 | Add optimistic DFLAG_DIST_HOPEFULLY for pending connections | Sverker Eriksson | |
to avoid tuple fallbacks for export funs and bitstrings. ToDo: Re-encode if receiver turn out to be erl_interface/jinterface. | |||
2017-11-15 | erts: Fix auto-connect toward erl_interface/jinterface | Sverker Eriksson | |
2017-11-15 | erts: Let send(_,_,[noconnect]) enqueue msg on pending connection. | Sverker Eriksson | |
The least bad behavior I think: * We cannot return 'noconnect' as caller might already have enqueued monitor/link that never triggers. * We cannot block waiting for connection as that can ruin latency when 'noconnect' is used to avoid blocking auto-connect (see gen_server and gen_statem). But there might be users getting more cases of bad latency waiting for a pendig connection, instead of a fast 'noconnect'. | |||
2017-11-15 | Remove obsolete erlang:dgroup_leader | Sverker Eriksson | |
2017-11-15 | Remove obsolete erlang:dexit/2 | Sverker Eriksson | |
2017-11-15 | Remove obsolete erlang:dlink/1, dunlink/1 and dist_exit/3 | Sverker Eriksson | |
2017-11-15 | Remove obsolete erlang:dsend | Sverker Eriksson | |
2017-11-15 | erts: Async auto-connect for monitor/2 | Sverker Eriksson | |
2017-11-15 | erts: Async auto-connect for group_leader/2 | Sverker Eriksson | |
2017-11-15 | erts: Async auto-connect for monitor_node | Sverker 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-15 | erts: Introduce asynchronous auto-connect | Sverker Eriksson | |
2017-11-15 | erts: Refactor connection_id in ErtsDistExternal | Sverker Eriksson | |
Break out from 'flags' into new dedicated 'connection_id' just for simplicity. Also changed flags to low bits and that affected enif_binary_to_term. |