Potential Incompatibilities

This document contains a list of potential incompatibilities between Erlang 5.6/OTP R12B-0 and the previous version Erlang 5.5/OTP R11B, and is an extract from the release notes for the respective applications.

Note: This document was compiled at the time when R12B was released and does not list any potential incompatibilities introduced in R12B patches. If using a patched version of R12B, please refer to the README for the respective patches for information about possible additional potential incompatibilites.

## 1 Erts

- dbg could leave traced processes in a suspended state if the tracer process was killed with exit reason kill.
  erlang:suspend_process/2 has been introduced which accepts an option list as second argument. For more information see the erlang(3) documentation.
  Processes suspended via erlang:suspend_process/[1,2] will now be automatically resumed if the process that called erlang:suspend_process/[1,2] terminates.
  Processes could previously be suspended by one process and resumed by another unless someone was tracing the suspendee. This is not possible anymore. The process resuming a process has to be the one that suspended it.
  Own Id: OTP-6946
- file:write_file/3, file:write/2 and file:read/2 could crash (contrary to documentation) for odd enough file system problems, e.g write to full file system. This bug has now been corrected.
  In this process the file module has been rewritten to produce better error codes. Posix error codes now originate from the OS file system calls or are generated only for very similar causes (for example 'enomem' is generated if a memory allocation fails, and 'einval' is generated if the file handle in Erlang is a file handle but currently invalid).
  More Erlang-ish error codes are now generated. For example {error,badarg} is now returned from file:close/1 if the argument is not of a file handle type. See file(3).
  The possibility to write a single byte using file:write/2 instead of a list or binary of one byte, contradictory to the documentation, has been removed.
  Own Id: OTP-6967 Aux Id: OTP-6597 OTP-6291
- Monitor messages produced by the system monitor functionality, and garbage collect trace messages could contain erroneous heap and/or stack sizes when the actual heaps and/or stacks were huge.
  As of erts version 5.6 the large_heap option to erlang:system_monitor/[1,2] has been modified. The monitor message is sent if the sum of the sizes of all memory blocks allocated for all heap generations is equal to or larger than the specified size. Previously the monitor message was sent if the memory block allocated for the youngest generation was equal to or larger than the specified size.
  Own Id: OTP-6974 Aux Id: seq10796
- The deprecated BIFs erlang:old_binary_to_term/1 and erlang:info/1 have been removed.
  Own Id: OTP-6876
- The ets:fixtable/2 function, which has been deprecated for several releases, has been removed.
  The ets:info/1 function has been reimplemented as a BIF, which guarantees that information returned is consistent.
  The ets:info/2 function now fails with reason badarg if the second argument is invalid. (Dialyzer can be used to find buggy code where the second argument is misspelled.)
  Own Id: OTP-6906
- As the linux kernel may generate a minor fault when tracing with CPU timestamps, and there exists no patch to the Linux kernel that fixes the problem, cpu timestamps are disabled on Linux for now.
  Own Id: OTP-6922
- The functions io:columns/0, io:columns/1, io:rows/0 and io:rows/1 are added to allow the user to get information about the terminal geometry. The shell takes some advantage of this when formatting output. For regular files and other io-devices where height and width are not applicable, the functions return {error,enotsup}.
  Potential incompatibility: If one has written a custom io-handler, the handler has to either return an error or take care of io-requests regarding terminal height and width. Usually that is no problem as io-handlers, as a rule of thumb, should give an error reply when receiving unknown io-requests, instead of crashing.
  Own Id: OTP-6933
- The default stack size for threads in the async-thread pool has been shrunk to 8 kilowords, i.e., 32 KB on 32-bit architectures. This small default size has been chosen since the amount of async-threads might be quite large. The default stack size is enough for drivers delivered with Erlang/OTP, but might not be sufficiently large for other dynamically linked in drivers that use the driver_async() functionality. A suggested stack size for threads in the async-thread pool can be configured via the +a command line argument of erl(1).
  Own Id: OTP-6580
- In the runtime system with SMP support, the global I/O lock has been replaced with a more fine grained port locking scheme. Port locking is either done on driver level, i.e., all ports executing the same driver share a lock, or on port level, i.e., each port has its own lock. Currently the inet driver, the efile driver, and the spawn driver use port level locking and all other statically linked in drivers use driver level locking. By default dynamically linked in drivers will use locking on driver level. For more information on how to enable port level locking see the erl_driver(3) and the driver_entry(3) man pages.
  As of erts version 5.5.3 the driver interface has been extended. The extended interface introduce version management, the possibility to pass capability flags to the runtime system at driver initialization, and some new driver API functions. For example, the driver_system_info() function which can be used to determine if the driver is run in a runtime system with SMP support or not. The extended interface doesn't have to be used, but dynamically linked in driver have to be recompiled. For information see the erl_driver(3) and the driver_entry(3) man pages.
  NOTE: Dynamically linked in drivers have to be recompiled.
  Own Id: OTP-6330 Aux Id: OTP-6262
- A port running a dynamically linked-in driver that exits due to the driver being unloaded now exits with exit reason driver_unloaded. Previously the port exited with exit reason -1.
  Own Id: OTP-6204
- Changed name of the erlang:system_info/1 argument scheduler to scheduler_id. This since the scheduler argument so easily could be mixed up with the schedulers argument (both returning integers).
  Own Id: OTP-6208

## 2 Inets

- [httpd, httpc] - Deprecated base64 decode/encode functions have been removed. Inets uses base64 in STDLIB instead.
  Own Id: OTP-6485
- The Inets application now has to be explicitly started and stopped i.e. it will not automatically be started as a temporary application as it did before. Although a practical feature when testing things in the shell it is not desirable that people take advantage of this and not start the Inets application in a correct way in their products. Added functions to the Inets API that call application:start/stop.
  Own Id: OTP-6993

## 3 Jinterface

- Jinterface has been updated to handle compressed terms, bitstring, new (IEEE) floats and bignums. This has caused a few incompatibilities.
  com.ericsson.otp.erlang.OtpOutputStream now extends java.io.ByteArrayOutputStream, previously java.lang.Object, and hence the method size() now return the number of bytes in the stream as dictated by the new parent class and not the buffer length as before. The new method length() returns what the old size() did return. The method count() is deprecated as it returns the same as the new size().
  com.ericsson.otp.erlang.OtpErlangLong now can handle larger values than 64-bit. Previously when larger than 64-bit integers were sent to a Jinterface node, it caused an com.ericsson.otp.erlang.OtpDecodeException. Now the integer is accepted, but the return value of longValue() is silently truncated, as opposed to the return value of intValue() that now and previously raises an com.ericsson.otp.erlang.OtpRangeException for unrepresentable values. The new methods isLong() and isULong() can be used to determine if the value fits in a long.
  Own Id: OTP-6809

## 4 Mnesia

- Mnesia's snmp operations snmp_get_row/2, snmp_get_next_index/2 and snmp_get_mnesia_key/2 have been made context aware, i.e. inside a transaction they will compensate for table updates made in earlier in the same transaction. This might cause a performance drop if a lot of updates have been made before the invocation of these functions.
  Own Id: OTP-6856 Aux Id: seq10671

## 5 Kernel

- file:write_file/3, file:write/2 and file:read/2 could crash (contrary to documentation) for odd enough file system problems, e.g write to full file system. This bug has now been corrected.
  In this process the file module has been rewritten to produce better error codes. Posix error codes now originate from the OS file system calls or are generated only for very similar causes (for example 'enomem' is generated if a memory allocation fails, and 'einval' is generated if the file handle in Erlang is a file handle but currently invalid).
  More Erlang-ish error codes are now generated. For example {error,badarg} is now returned from file:close/1 if the argument is not of a file handle type. See file(3).
  The possibility to write a single byte using file:write/2 instead of a list or binary of one byte, contradictory to the documentation, has been removed.
  Own Id: OTP-6967 Aux Id: OTP-6597 OTP-6291
- Monitor messages produced by the system monitor functionality, and garbage collect trace messages could contain erroneous heap and/or stack sizes when the actual heaps and/or stacks were huge.
  As of erts version 5.6 the large_heap option to erlang:system_monitor/[1,2] has been modified. The monitor message is sent if the sum of the sizes of all memory blocks allocated for all heap generations is equal to or larger than the specified size. Previously the monitor message was sent if the memory block allocated for the youngest generation was equal to or larger than the specified size.
  Own Id: OTP-6974 Aux Id: seq10796
- The deprecated functions file:file_info/1, init:get_flag/1, init:get_flags/0, and init:get_args/0 have been removed.
  Own Id: OTP-6886
- The functions io:columns/0, io:columns/1, io:rows/0 and io:rows/1 are added to allow the user to get information about the terminal geometry. The shell takes some advantage of this when formatting output. For regular files and other io-devices where height and width are not applicable, the functions return {error,enotsup}.
  Potential incompatibility: If one has written a custom io-handler, the handler has to either return an error or take care of io-requests regarding terminal height and width. Usually that is no problem as io-handlers, as a rule of thumb, should give an error reply when receiving unknown io-requests, instead of crashing.
  Own Id: OTP-6933
- All functions in the code module now fail with an exception if they are called with obviously bad arguments, such as a tuple when an atom was expected. Some functions now also fail for undocumented argument types (for instance, ensure_loaded/1 now only accepts an atom as documented; it used to accept a string too).
  Dialyzer will generally emit warnings for any calls that use undocumented argument types. Even if the call happens to still work in R12B, you should correct your code. A future release will adhere to the documentation.
  Own Id: OTP-6983
- The internal (rarely used) DNS resolver has been modified to not use the domain search list when asked to resolve an absolute name; a name with a terminating dot. There was also a bug causing it to create malformed DNS queries for absolute names that has been corrected, correction suggested by Scott Lystig Fritchie. The code has also been corrected to look up cached RRs in the same search order as non-cached, now allows having the root domain among the search domains, and can now actually do a zone transfer request.
  Own Id: OTP-6806 Aux Id: seq10714 EABln35459
- To help Dialyzer find more bugs, many functions in the Kernel and STDLIB applications now only accept arguments of the type that is documented.
  For instance, the functions lists:prefix/2 and lists:suffix/2 are documented to only accept lists as their arguments, but they actually accepted anything and returned false. That has been changed so that the functions cause an exception if one or both arguments are not lists.
  Also, the string:strip/3 function is documented to take a character argument that is a character to strip from one or both ends of the string. Given a list instead of a character, it used to do nothing, but will now cause an exception.
  Dialyzer will find most cases where those functions are passed arguments of the wrong type.
  Own Id: OTP-6295

## 6 ODBC

- The odbc application now has to be explicitly started and stopped i.e. it will not automatically be started as a temporary application as it did before. Although a practial feature when testing things in the shell it is not desirable that people take advantage of this and not start the odbc application in a correct way in their products. Added functions to the odbc API that calls application:start/stop.
  Own Id: OTP-6984

## 7 STDLIB

- file:write_file/3, file:write/2 and file:read/2 could crash (contrary to documentation) for odd enough file system problems, e.g. write to full file system. This bug has now been corrected.
  In this process the file module has been rewritten to produce better error codes. Posix error codes now originate from the OS file system calls or are generated only for very similar causes (for example 'enomem' is generated if a memory allocation fails, and 'einval' is generated if the file handle in Erlang is a file handle but currently invalid).
  More Erlang-ish error codes are now generated. For example {error,badarg} is now returned from file:close/1 if the argument is not of a file handle type. See file(3).
  The possibility to write a single byte using file:write/2 instead of a list or binary of one byte, contradictory to the documentation, has been removed.
  Own Id: OTP-6967 Aux Id: OTP-6597 OTP-6291
- The behaviour of the internal functions gen:call/3,4 has been changed slightly in the rare case that when the caller was linked to the called server, and the server crashed during the call; its exit signal was consumed by the gen:call/3,4 code and converted to an exit exception. This exit signal is no longer consumed.
  To even notice this change, 1) the calling process has to be linked to the called server.
  2) the call must not be remote by name that is it must be local or remote by pid, local by name or global by name.
  3) the calling process has to have set process_flag(trap_exit, true).
  4) the server has to crash during the call.
  5) the calling process has to be sensitive to getting previously consumed {'EXIT',Pid,Reason} messages in its message queue.
  The old behaviour was once the only way for a client to notice if the server died, but has since erlang:monitor(process, {Name,Node}) was introduced and used in gen:call been regarded as an undesired behaviour if not a bug.
  The affected user APIs are: gen_server:call/2,3, gen_fsm:sync_send_event/2,3, gen_fsm:sync_send_all_state_event/2,3, gen_event:_, sys:_ and maybe a few others that hardly will be noticed.
  Own Id: OTP-3954 Aux Id: Seq 4538
- The ets:fixtable/2 function, which has been deprecated for several releases, has been removed.
  The ets:info/1 function has been reimplemented as a BIF, which guarantees that information returned is consistent.
  The ets:info/2 function now fails with reason badarg if the second argument is invalid. (Dialyzer can be used to find buggy code where the second argument is misspelled.)
  Own Id: OTP-6906
- To help Dialyzer find more bugs, many functions in the Kernel and STDLIB applications now only accept arguments of the type that is documented.
  For instance, the functions lists:prefix/2 and lists:suffix/2 are documented to only accept lists as their arguments, but they actually accepted anything and returned false. That has been changed so that the functions cause an exception if one or both arguments are not lists.
  Also, the string:strip/3 function is documented to take a character argument that is a character to strip from one or both ends of the string. Given a list instead of a character, it used to do nothing, but will now cause an exception.
  Dialyzer will find most cases where those functions are passed arguments of the wrong type.
  Own Id: OTP-6295
- Support for faster join of two tables has been added to the qlc module. There are two kinds of fast joins: lookup join that uses existing indices, and merge join that takes two sorted inputs. There is a new join option that can be used to force QLC to use a particular kind of join in some QLC expression.
  Several other changes have also been included:
  - The new tmpdir option of cursor/2, eval/2, fold/4, and info/2 can be used to set the directory that join uses for temporary files. The option also overrides the tmpdir option of keysort/3 and sort/2.
  - The new lookup option can be used to assert that constants are looked up when evaluating some QLC expression.
  - The cache and cache_all options accept new tags: ets, list, and no. The tag list caches answers in a list using a temporary file if the answers cannot be held in RAM. Combining {cache,list} and {unique, true} is equivalent to calling sort/2 with the option unique set to true. The old tags true (equivalent to ets) and false (equivalent to no) are recognized for backward compatibility.
  - The new option max_list_size can be used to set the limit where merge join starts to use temporary files for large equivalence classes and when answers cached in lists are put on temporary files.
  - There is a new callback is_sorted_key to be supplied as an option to table/2.
  - QLC analyzes each and every QLC expression when trying to find constants for the lookup function. Hitherto only QLC expressions with exactly one generator were analyzed.
    Note that only filters with guard syntax placed immediately after the generator are analyzed. The restriction to guard filters is an incompatible change. See qlc(3) for further details.
  - In a similar way several match specifications for traversal of QLC tables can be utilized for different generators of one single QLC expression.
  - A bug has been fixed: when caching answers to a sufficiently complex query it could happen that some answers were not returned.
  Own Id: OTP-6038
- The erl_eval module now calls the non-local function handler whenever an operator is evaluated (exceptions are andalso, orelse, and catch). The non-local function handler is now also called when the function or operator occurs in a guard test (such calls used to be ignored).
  These changes affect the Erlang shell when running in restricted mode: the callback function non_local_allowed/3 is now called for operators such as '!'/2. This means that non_local_allowed/3 may need to be changed as to let operators through. Note that erlang:'!'/2 as well as erlang:send/2,3 have to be restricted in order to stop message passing in the shell.
  Own Id: OTP-6714 Aux Id: seq10374

Copyright © 1991-2008 Ericsson AB