aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
AgeCommit message (Collapse)Author
2015-03-20Merge branch 'nox/fix-port_info-race' into maintZandra Hird
* nox/fix-port_info-race: Fix a race condition when calling port_info/1 OTP-12587
2015-03-18Fix a race condition when calling port_info/1Anthony Ramine
This variable hold the values returned by erlang:port_info/1 and shouldn't be static. Reported-by: Heinz Nikolaus Gies
2015-02-04don't create oversize bignums in binary matchingMikael Pettersson
Bignums are artifically restricted in size. Arithmetic and logical operations check the sizes of resulting bignums, and turn oversize results into system_limit exceptions. However, this check is not performed when bignums are constructed by binary matching. The consequence is that such matchings can construct oversize bignums that satisfy is_integer/1 yet don't work. Performing arithmetic such as Term - 0 fails with a system_limit exception. Worse, performing a logical operation such as Term band Term results in []. The latter occurs because the size checking (e.g. in erts_band()) is a simple ASSERT(is_not_nil(...)) on the result of the bignum operation, which internally is [] (NIL) in the case of oversize results. However, ASSERT is a no-op in release builds, so the error goes unnoticed and [] is returned as the result of the band/2. This patch addresses this by preventing oversize bignums from entering the VM via binary matching: - the internal bytes_to_big() procedure is augmented to return NIL for oversize results, just like big_norm() - callers of bytes_to_big() are augmented to check for NIL returns and signal errors in those cases - erts_bs_get_integer_2() can only fail with badmatch, so that is the Erlang-level result of oversize bignums from binary matches - big_SUITE.erl is extended with a test case that fails without this fix (no error signalled) and passes with it (badmatch occurs) Credit goes to Nico Kruber for the initial bug report.
2014-11-26Merge branch 'sverk/port_get_data-race/OTP-12208' into maintSverker Eriksson
* sverk/port_get_data-race/OTP-12208: erts: Fix port data memory allocation bug
2014-11-25erts: Fix port data memory allocation bugSverker Eriksson
for non-immediate port data >= sizeof(Eterm)*2 words.
2014-11-10Merge branch 'vinoski/dirty-nif-return-gc' into maintBruce Yinhe
OTP-12300 * vinoski/dirty-nif-return-gc: Fix gc-related problem with dirty NIFs
2014-11-04Fix gc-related problem with dirty NIFsSteve Vinoski
Ensure that the return value from a dirty NIF call is made part of the GC rootset. Add a new regression test to nif_SUITE. Thanks to Daniel Goertzen for reporting the error and providing a test case, and to Sverker Eriksson for making test case reproducible and finding the fix.
2014-11-02Expose NIF versionPeter Lemenkov
This patch allows checking for NIF API version in a way similar to driver version. E.g. by calling erlang:system_info(nif_version). Signed-off-by: Peter Lemenkov <[email protected]>
2014-10-28Merge branch 'sv/isfinite/OTP-12268' into maintLukas Larsson
* sv/isfinite/OTP-12268: Use isfinite() instead of finite() when available
2014-10-28Use isfinite() instead of finite() when availableAnthony Ramine
OS X Mavericks builds result in a number of warnings about finite() being deprecated, like these: beam/erl_arith.c:451:7: warning: 'finite' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations] ERTS_FP_ERROR(p, f1.fd, goto badarith); ^ sys/unix/erl_unix_sys.h:319:33: note: expanded from macro 'ERTS_FP_ERROR' ^ sys/unix/erl_unix_sys.h:244:51: note: expanded from macro '__ERTS_FP_ERROR' ^ /usr/include/math.h:718:12: note: 'finite' has been explicitly marked deprecated here extern int finite(double) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_9, __IPHONE_NA, __IPHONE_NA); Add checks to use isfinite() instead of finite() where available. Verified on OS X Mavericks 10.9.5 and Ubuntu 12.04.
2014-10-23Merge branch 'rickard/maint-17/eager-check-io/OTP-12117' into maintRickard Green
* rickard/maint-17/eager-check-io/OTP-12117: No eager check I/O on OSE Introduce support for eager check I/O scheduling
2014-09-30erts: Add test case for port_set_data and port_get_dataSverker Eriksson
2014-09-25Merge branch 'rickard/eager-check-io/OTP-12117' into ↵Rickard Green
rickard/maint-17/eager-check-io/OTP-12117 * rickard/eager-check-io/OTP-12117: Introduce support for eager check I/O scheduling Conflicts: erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_init.c erts/emulator/beam/erl_process.c erts/preloaded/ebin/erlang.beam
2014-09-25Introduce support for eager check I/O schedulingRickard Green
2014-09-12erts: Remove enif_have_dirty_schedulers()Sverker Eriksson
and add 'dirty_scheduler_support' to ErlNifSysInfo
2014-09-05Merge branch 'rickard/memory_consuming_tuple_tests' into maintRickard Green
* rickard/memory_consuming_tuple_tests: Only run upper boundry tuple test with lots of memory
2014-09-05Only run upper boundry tuple test with lots of memoryRickard Green
2014-09-04Merge branch 'sverk/MIN_SMALL-to-integer' into maintSverker Eriksson
* sverk/MIN_SMALL-to-integer: erts: Correct conversion of MIN_SMALL numeral to fixnum OTP-12140
2014-09-04erts: Correct conversion of MIN_SMALL numeral to fixnumSverker Eriksson
list_to_integer and binary_to_integer returned un-normalized bignum for -134217728 on 32-bit and -576460752303423488 on 64-bit. Thanks to Jesper Louis Andersen, Mikael Pettersson and Anthony Ramine for report, initial patch and optimization suggestion.
2014-09-04Merge branch 'sverk/nif-inspect-copy-bug/OTP-9828' into maintSverker Eriksson
* sverk/nif-inspect-copy-bug/OTP-9828: erts: Fix bug with enif_make_copy reallocating writable binary Conflicts: erts/emulator/test/nif_SUITE.erl
2014-09-03erts: Fix bug with enif_make_copy reallocating writable binarySverker Eriksson
that could invalidate a pointer received from an earlier call to enif_inspect_binary. Solution: Emasculate writable binary at enif_inspect_binary. There are room for optimizations here as we now do an unconditional emasculation even though enif_make_copy is not called later in the NIF.
2014-08-29Merge branch 'rickard/runnable-trace-ooo-bug/OTP-12105' into maintRickard Green
* rickard/runnable-trace-ooo-bug/OTP-12105: Fix busy_port_SUITE:io_to_busy test-case Ensure "runnable port" trace messages are not sent out of order Ensure "runnable proc" trace messages are not sent out of order
2014-08-28add enif_schedule_nif() to NIF APISteve Vinoski
In the #erlang IRC channel Anthony Ramine once mentioned the idea of allowing a NIF to use an emulator trap, similar to a BIF trap, to schedule another NIF for execution. This is exactly how dirty NIFs were implemented for Erlang/OTP 17.0, so this commit refactors and generalizes that dirty NIF code to support a new enif_schedule_nif() API function. The enif_schedule_nif() function allows a long-running NIF to be broken into separate NIF invocations. The NIF first executes part of the long-running task, then calls enif_schedule_nif() to schedule a NIF for later execution to continue the task. Any number of NIFs can be scheduled in this manner, one after another. Since the emulator regains control between invocations, this helps avoid problems caused by native code tying up scheduler threads for too long. The enif_schedule_nif() function also replaces the original experimental dirty NIF API. The function takes a flags parameter that a caller can use to indicate the NIF should be scheduled onto either a dirty CPU scheduler thread, a dirty I/O scheduler thread, or scheduled as a regular NIF on a regular scheduler thread. With this change, the original experimental enif_schedule_dirty_nif(), enif_schedule_dirty_nif_finalizer() and enif_dirty_nif_finalizer() API functions are no longer needed and have been removed. Explicit scheduling of a dirty NIF finalization function is no longer necessary; if an application wants similar functionality, it can have a dirty NIF just invoke enif_schedule_nif() to schedule a non-dirty NIF to complete its task. Lift the restriction that dirty NIFs can't call enif_make_badarg() to raise an exception. This was a problem with the original dirty NIF API because it forced developers to get and check all incoming arguments in a regular NIF, and then schedule the dirty NIF which then had to get all the arguments again. Now, the argument checking can be done in the dirty NIF and it can call enif_make_badarg() itself to flag incorrect arguments. Extend the ErlNifFunc struct with a new flags field that allows NIFs to be declared as dirty. The default value for this field is 0, indicating a regular NIF, so it's backwards compatible with all existing statically initialized ErlNifFunc struct instances, and so such instances require no code changes. Defining the flags field with a value of ERL_NIF_DIRTY_JOB_CPU_BOUND indicates that the NIF should execute on a dirty CPU scheduler thread, or defining it with a value of ERL_NIF_DIRTY_JOB_IO_BOUND indicates that the NIF should execute on a dirty I/O scheduler thread. Any other flags field value causes a NIF library loading error. Extend the ErlNifEntry struct with a new options field that indicates whether a NIF library was built with support for optional features such as dirty NIFs. When a NIF library is loaded, the runtime checks the options field to ensure compatibility. If a NIF library built with dirty NIF support is loaded into a runtime that does not support dirty NIFs, and the library defines one or more ErlNifFunc entries with non-zero flags fields indicating dirty NIFs, a NIF library loading error results. There is no error if a NIF library built with dirty NIF support is loaded into a runtime that does not support dirty NIFs but the library does not have any dirty NIFs. It is also not an error if a library without dirty NIF support is loaded into a runtime built with dirty NIF support. Add documentation and tests for enif_schedule_nif().
2014-08-22Fix busy_port_SUITE:io_to_busy test-caseRickard Green
2014-08-21Merge branch 'egil/proc_lib-optimizations/OTP-12060' into maintBjörn-Egil Dahlberg
* egil/proc_lib-optimizations/OTP-12060: stdlib: Update dependencies to erts-6.2 erts: Update preloaded erlang.beam stdlib: Use erlang:fun_info_mfa/1 in proc_lib:init_p/3 erts: Test erlang:fun_info_mfa/1 erts: Introduce erlang:fun_info_mfa/1
2014-08-11Merge branch 'rickard/nosuspend-bug/OTP-12082' into maintRickard Green
* rickard/nosuspend-bug/OTP-12082: Fix build of test port program Update Makefile.src Add async_ports test Fix abort of nosuspend-tasks in erts_port_task_schedule()
2014-08-06Fix build of test port programRickard Green
2014-08-06erts: Fix tc and docs after {fd,FD} bind changeLukas Larsson
The sha of the original change is 52810718b
2014-08-05Update Makefile.srckudryashov-sv
2014-08-05Add async_ports testSergey Kudryashov
2014-07-11erts: Test erlang:fun_info_mfa/1Björn-Egil Dahlberg
2014-06-06Merge branch 'rickard/binary_to_term_error/OTP-11931' into maintRickard Green
* rickard/binary_to_term_error/OTP-11931: Replace erlang:binary_to_term() Erlang wrappers Conflicts: erts/preloaded/ebin/erts_internal.beam
2014-06-06Merge branch 'rickard/yielding-binary-list-conversions/OTP-11888' into maintRickard Green
* rickard/yielding-binary-list-conversions/OTP-11888: Add test-case comparing old and new implementations Make binary BIFs converting from lists yield on large input Make binary BIFs converting to lists yield on large input
2014-06-05Replace erlang:binary_to_term() Erlang wrappersRickard Green
Replace the 'erlang:binary_to_term/1' and 'erlang:binary_to_term/2' Erlang wrappers taking care of failure after yield with management of this in the hidden yield BIF.
2014-06-05Merge branch 'etsukata/system_info_tolerant_timeofday/OTP-11970' into maintLukas Larsson
* etsukata/system_info_tolerant_timeofday/OTP-11970: Add erlang:system_info(tolerant_timeofday)
2014-06-05Merge branch 'lukas/erts/fix_trace_on_registered_procs/OTP-11968' into maintLukas Larsson
* lukas/erts/fix_trace_on_registered_procs/OTP-11968: erts: tracing on send now works for registered processes
2014-06-05erts: tracing on send now works for registered processesLukas Larsson
This bug was introduced in R16B. Testcases have been adapted to verify the correct behaviour.
2014-05-22Add test-case comparing old and new implementationsRickard Green
2014-05-22Make binary BIFs converting from lists yield on large inputRickard Green
- erlang:list_to_binary/1 - erlang:iolist_to_binary/1 - erlang:list_to_bitstring/1 - binary:list_to_bin/1
2014-05-22Make binary BIFs converting to lists yield on large inputRickard Green
- erlang:binary_to_list/1 - erlang:binary_to_list/3 - erlang:bitstring_to_list/1
2014-04-30erts: Add testcase for erts_debug:size/1 Map termsBjörn-Egil Dahlberg
2014-04-29Fix timeout for match_spec_SUITE:otp_9422Sverker Eriksson
Must receive 'abort' even after loop_runner has finished.
2014-04-28Add erlang:system_info(tolerant_timeofday)Eiichi Tsukata
Add erlang:system_info(tolerant_timeofday), an API to check whether compensation for sudden changes of system time is enabled or not.
2014-04-02Merge branch 'egil/test-cuddling'Björn-Egil Dahlberg
* egil/test-cuddling: tools: Refactor testcase emulator: Increase timetrap timeout for binary_SUITE emulator: Increase timetrap timeout for match_spec_SUITE
2014-04-01erts: Make binary_SUITE:deep less stressfulSverker Eriksson
as it times out on some machines. Not much point in redoing with lower input reductions when the terms are so big we will trap several times anyway.
2014-04-01emulator: Increase timetrap timeout for binary_SUITEBjörn-Egil Dahlberg
2014-04-01emulator: Increase timetrap timeout for match_spec_SUITEBjörn-Egil Dahlberg
2014-03-27erts: Fix bug in test case port_SUITE:otp_5119Sverker Eriksson
2014-03-26erts: Reduce runtime of test port_SUITE:close_deaf_portSverker Eriksson
as it fails with timeout sometimes.
2014-03-21Introduce minimum allowed major driver and nif versions on loadRickard Green