Releases: actor-framework/actor-framework
Releases · actor-framework/actor-framework
1.1.0
Changed
- Add intermediary types for the
mailAPI as[[nodiscard]]to make it easier
to spot mistakes when chaining calls. - The
mergeandflat_mapoperators now accept an optional unsigned integer
parameter to configure the maximum number of concurrent subscriptions. - If an actor terminates, it will now consistently send error messages with code
caf::sec::request_receiver_downto all outstanding requests. Any request
that arrives after an actor has closed its mailbox will receive the same error
code. This change makes it easier to handle errors in a consistent way and to
distinguish between requests that have been dropped and those that resulted in
an error while processing the request (#2070). - The URI parser in CAF now accepts URIs that use reserved characters such as
*,/or?in the query string. This change follows the recommendation in
the RFC 3986, which states that "query components are often used to carry
identifying information in the form of key=value pairs and one frequently used
value is a reference to another URI". - CAF now respects CPU limits when running in a container to determine the
thread pool size for the scheduler (#2061).
Added
- New flow operators:
retry,combine_latest,debounce,throttle_first
andon_error_resume_next. - New
with_userinfomember function for URIs that allows setting the user-info
sub-component without going through an URI builder. - CAF now supports chunked encoding for HTTP clients (#2038).
- Added a missing configuration option to the HTTP client API that allows
users to set the maximum size of the response. - Add functions to the SSL API to enable Server Name Indication (SNI, #2084).
- Add
throttle_lastto observables: an alias forsample.
Fixed
- Fix build error in
caf-netwhen building with C++23 (#1919). - Restructure some implementation details of
intrsuive_ptr(no functional
changes) to make it easier forclang-tidyto analyze the code. This fixes a
false positive reported byclang-tidyin some use cases whereclang-tidy
would falsely report a use-after-free bug. - Closing a WebSocket connection now properly sends a close frame to the client
before closing the TCP connection (#1938). - Fix a build error in the unit tests when building with C++20 and setting
CAF_USE_STD_FORMATtoON(#1963). - The functions
run_scheduled,run_scheduled_weak,run_delayedand
run_delayed_weaknow properly accept move-only callback types. - Fix the conversion from invalid actor handles to raw pointers when using
actor_cast. This resolves an issue withsendthat could lead to undefined
behavior (#1972). - Add missing export declaration for the
caf::net::prometheussymbol (#2042). - Boolean flags now accept arguments on the command line (#2048). For example,
--foo=trueis now equivalent to--fooand--foo=falsewill set the flag
tofalse. Short options like-fonly accept the argument when passing it
without a space, e.g.,-ffalse. - The
bufferandintervaloperators now properly check the time period
parameter and produce an error if the period is zero or negative (#2030).
Passing an invalid delay parameter toto_streamorto_typed_stream
likewise produces a stream that immediately callson_erroron any client
that tries to subscribe to it. - Use
localtime_son all Windows platforms to fix a build error with
MSYS/UCRT64 (#2059). - Fix rendering of nested JSON lists (#2068).
- Add missing
pragma onceguards to multiple headers undercaf/net/ssl/. - Fix the behavior of
use_certificate_file_ifanduse_private_key_file_if.
Both functions did not leave thecaf::net::ssl::contextunchanged if one of
the arguments was invalid but instead applied the invalid arguments to the
context regardless, resulting in an OpenSSL error. - Fix a bug in the HTTP parser that could cause the parser to try parsing the
payload as a new request. - Fix a startup issue when configuring Prometheus export on
caf.net(#2060).
This bug caused the Prometheus server to never start up unless starting at
least one other asynchronous server or client using thecaf.netAPI. - Fix a bug in the URI parser that could crash the application when parsing an
URI with a percent-encoded character at the end of the string (#2080). - Fix parsing of HTTP request headers that do not use the absolute path syntax
in the first line (#2074). - Optimize templates for compile-time checks used by typed behaviors. This
drastically reduces memory usage during compilation and avoids OOM errors when
spawning typed actors with a large number of message handlers (#1970). - BDD outlines now properly handle multiple
WHENblocks in a single
scenario (#1776). - Fix build issues on Clang 20 when building in C++20 mode (#2092).
1.0.2
Changed
- Tests, scenarios and outlines are now automatically put into the anonymous
namespace to avoid name clashes with other tests. This removes the need for
users to manually put their tests into an anonymous namespace. - The
SUITEmacro of the unit test framework can now be used multiple times in
a single compilation unit.
Fixed
- When using the HTTP client API, the client now properly closes the connection
after receiving a response even if the server would keep the connection open. - When using the WebSocket client API, the socket could close prematurely when
leavingmainright after setting up the connection, even when starting an
actor instart. This was due to CAF not holding onto a strong reference to
the connection object (and thus the actor) at all times (#1918). - When using log statements in unit tests, e.g.
log::test::debug, the output
will now be rendered by default even when not using the deterministic fixture. - Registering a custom option of type
size_twill no longer print
<dictionary>as type hint in the--helpoutput. Instead, CAF will print
eitheruint32_toruint64_t, depending on the platform. - Fix handling of unicode escaping (e.g.
ä) in the JSON parser (#1937).
1.0.1
Fixed
- Fix a compiler error when using
spawn_clienton the I/O middleman (#1900). - An unfortunate bug prevented the auto-detection of
std::formatwhen building
CAF with C++20 or later. This bug has been fixed, alongside issues with the
actualstd::format-based implementation. However, since selecting a
different backend forprintlnand the log output generation breaks the ABI,
we have decided to ship thestd::format-based implementation only as opt-in
at this point. Users can enable it by setting the CMake option
CAF_USE_STD_FORMAT. - Fix cleanup in the consumer adapter. This component connects actors to SPSC
buffers. If the SPSC buffer was closed by the producer, the consumer adapter
failed to properly dispose pending actions. - Fix a
nullptr-dereference inscheduled_actor::run_actionsif a delayed
action callsself->quit()(#1920).
Changed
- When disposing a connection acceptor, CAF no longer generates a log event with
severityerror. Instead, it will log the event with severitydebug.
1.0.0
Added
- The actor system now offers a
printlnconvenience function for printing to
the console. When building CAF with C++20 enabled, the function uses
std::formatinternally. Otherwise, it falls back to the compatibility layer
with the same syntax. The function also recognizesinspectoverloads for
custom types. Any printing done by this function is thread-safe. The function
is available on actors in order to allowself->println("..."). - Actors have a new
monitormember function that takes an actor handle and a
callback. The callback will run when the monitored actor terminates (in the
context of the monitoring actor). The function returns amonitorableobject
that can be used to cancel the monitoring. This mechanism replaces the old
approach that relied ondown_msghandlers in event-based actors (nothing
changes for blocking actors). - Event-based actors can now set an idle timeout via
set_idle_handler. The
timeout fires when the actor receives no messages for a specified duration.
This new feature replaces theafter(...) >> ...syntax and allows actors to
specify what kind of reference CAF will hold to that actor while it is waiting
for the timeout (strong or weak) and whether to trigger the timeout once or
repeatedly. - New flow operators:
buffer,sample,start_with,
on_backpressure_buffer,on_error_return,on_error_return_item, and
on_error_complete. - The unit test framework now offers the new utility (template) class
caf::test::approxfor approximate comparisons.
Fixed
- Fix building CAF with shared libraries (DLLs) enabled on Windows (#1715).
- The
actor_from_stateutility now evaluates spawn options such aslinked
(#1771). Previously, passing this option toactor_from_stateresulted in a
compiler error. - Sending a message to an already terminated actor from a
function_viewnow
properly reports an error (#1801). - URIs now support support username and password in the user-info sub-component
(#1814). Consequently, theuserinfofield of the URI class now has two
member variables:nameand (an optional)password. Further, theuserinfo
field is now optional in order to differentiate between an empty user-info and
no user-info at all. - The parser for reading JSON and configuration files now properly handles
Windows-style line endings (#1850). - Calling
force_utcon acaf::chrono::dateimeobject now properly applies
the UTC offset. Previously, the function would shift the time into the wrong
direction (#1860). - Fix a regression in the work-stealing scheduler that prevented workers from
stealing work from other workers in the relaxed polling state (#1866). - Fix handling of integer or boolean values as keys as well as lists as values
in dictionaries when using thejson_builder. - Calling
caf::chrono::datetime::to_local_timewill now properly interpret the
stored time as local time if no UTC offset is present.
Removed
- The obsolete CAF types
caf::string_view,caf::byte,caf::optional,
caf::replies_to, andcaf::flow::item_publisher. - The obsolete
operator*for "combining" two actor handles. - All
to_streamandto_typed_streammember functions on actors (they are
available oncaf::flow::observabledirectly). - The
groupAPI has been removed entirely. - The experimental APIs for actor profiling and inserting tracing data have been
removed. Neither API has a clear use case at the moment and since we have not
received any feedback on either API, we have decided to remove them to
simplify the code base. - The
actor_system_configno longer contains special member variables for the
OpenSSL module. The module now uses the regular configuration system. - The
caf-runtool no longer ships with CAF. The tool has not been maintained
for a long time, has never been thoroughly tested, and has no documentation. - The
actor_system_configno longer contains thelogger_factorysetter. We
might reintroduce this feature in the future, but we think the newlogger
interface class is not yet stable enough to expose it to users and to allow
custom logger implementations.
Changed
- When using the caf-net module, users may enable Prometheus metric export by
setting the configuration optioncaf.net.prometheus-http. The option has the
following fields:port,address,tls.key-file, andtls.cert-file. When
setting the TLS options, the server will use HTTPS instead of HTTP. - Sending messages from cleanup code (e.g., the destructor of a state class) is
now safe. Previously, doing so could cause undefined behavior by forming a
strong reference to a destroyed actor. - Actors will now always send an error message if an incoming message triggered
an unhandled exception. Previously, CAF would only send an error message if
the incoming message was a request (#1684). - Stateful actors now provide a getter function
state()instead of declaring a
publicstatemember variable. This change enables more flexibility in the
implementation for future CAF versions. - Passing a class to
spawn_inactiveis now optional and defaults to
event_based_actor. The next major release will remove the class parameter
altogether. - Event-based actors can now handle types like
exit_msganderrorin their
regular behavior. - The
check_eqandrequire_eqfunctions in the unit test framework now
prohibit comparing floating-point numbers with==. Instead, users should use
newapproxutility class. - The member functions
send,scheduled_send,delayed_send,requestand
delegateare deprecated in favor of the newmailAPI. - The free functions
anon_send,delayed_anon_send,scheduled_anon_sendare
deprecated in favor of the newanon_mailAPI.
Deprecated
- Using
spawn_inactivenow emits a deprecation warning when passing a class
other thanevent_based_actor. - The experimental
actor_poolAPI has been deprecated. The API has not seen
much use and is too cumbersome. - The printing interface via
aouthas been replaced by the newprintln
function. The old interface is now deprecated and will be removed in the next
major release. - Calling
monitorwith a single argument is now deprecated for event-based
actors. Users should always provide a callback as the second argument. Note
that nothing changes for blocking actors. They still callmonitorand then
receive adown_msgin their mailbox. - The function
set_down_handleris deprecated for the same reasons as
monitor: please use the newmonitorAPI with a callback instead. - The spawn flag
monitoredis deprecated as well and users should call
monitordirectly instead. - Constructing a behavior with
after(...) >> ...has been deprecated in favor
of the newset_idle_handlerfunction. Note that blocking actors may still
pass a timeout viaafter(...)toreceivefunctions. The deprecation only
targets event-based actors. - The use case for
function_viewis covered by the new feature on blocking
actors that allows callingreceivewith no arguments. Hence,function_view
becomes obsolete and is deprecated. - The
set_default_handlermember function on event-based actors is now
deprecated. Instead, users should use a handler formessagein their
behavior as a catch-all. For skipping messages, CAF now includes a new
mail_cacheclass that allows explicitly stashing messages for later
processing. - Special-purpose handlers for messages like
exit_msganderrorare now
deprecated. Instead, users should handle these messages in their regular
behavior. - The legacy testing framework in
caf/test/unit_test.hppis now deprecated and
the header (as well as headers that build on top it such as
caf/test/dsl.hpp) will be removed in the next major release. Users should
migrate to the new testing framework.
0.19.6
0.19.5
Added
- An
observablethat runs on an actor can now be converted to astreamor
typed_streamdirectly by callingto_streamorto_typed_streamon it. - New
caf::asyncAPI to read text and binary files asynchronously in a
separate thread. The contents of the files are consumed as flows (#1573). - The class
caf::unordered_flat_mapnow has thecontainsand
insert_or_assignmember functions. - CAF now supports setting custom configuration options via environment
variables. The new priority order is: CLI arguments, environment variables,
configuration files, and default values. The environment variable name is
the full name of the option in uppercase, with all non-alphanumeric
characters replaced by underscores. For example, the environment variable
FOO_BARsets the optionfoo.bar. Users may also override the default
name by putting the environment name after the short names, separated by a
comma. For example,opt_group{custom_options_, "foo"}.add("bar,b,MY_BAR")
overrides the default environment variable nameFOO_BARwithMY_BAR. - The formatting functions from
caf/chrono.hppnow support precision for the
fractional part of the seconds and an option to print with a fixed number of
digits. - The new class
caf::chunkrepresents an immutable sequence of bytes with a
fixed size. Unlikestd::span, achunkowns its data and can be (cheaply)
copied and moved. - Users can now convert state classes with a
make_behaviormember function
into a "function-based actor" via the newactor_from_stateutility. For
example,sys.spawn(caf::actor_from_state<my_state>, args...)creates a new
actor that initializes its state withmy_state{args...}and then calls
make_behavior()on the state object to obtain the initial behavior. - The
aoututility received aprintlnmember function that adds a formatted
line to the output stream. The function uses the same formatting backend as
the logging API.
Fixed
- The class
caf::test::outlineis now properly exported from the test module.
This fixes builds with dynamic linking againstlibcaf_test. - Fix a crash with the new deterministic test fixture when cleaning up actors
with stashed messages (#1589). - When using
request(...).await(...), the actor no longer suspends handling of
system messages while waiting for the response (#1584). - Fix compiler errors and warnings for GCC 13 in C++23 mode (#1583).
- Fix encoding of chunk size in chunked HTTP responses (#1587).
- Fix leak when using
spawn_inactiveand not launching the actor explicitly
(#1597). - Fix a minor bug in the deserialization of messages that caused CAF to allocate
more storage than necessary (#1614). - Add missing
consttopublisher<T>::observe_on. - All
observableimplementations now properly callon_subscribeon their
subscriber before callingon_error. - The function
config_value::parsenow properly handles leading and trailing
whitespaces. - Comparing two
caf::unordered_flat_mappreviously relied on the order of
elements in the map and thus could result in false negatives. The new
implementation is correct and no longer relies on the order of elements. - When using
--dump-config, CAF now properly renders nested dictionaries.
Previously, dictionaries in lists missed surrounding braces. - CAF now parses
foo.bar = 42in a config file asfoo { bar = 42 }, just as
it does for CLI arguments. - Fix shutdown logic for actors with open streams. This resolves an issue where
actors would not terminate correctly after receiving an exit message (#1657). - Fix compilation error on MSVC when building
caf_testwith shared libraries
enabled (#1669). - Calling
delay_for_fnon a flow coordinator now returns adisposablein
order to be consistent withdelay_foranddelay_until. - Calling
disposeon a server (e.g. an HTTP server) now properly closes all
open connections. - Fix static assert in
expectedwhen callingtransformon an rvalue with a
function object that only accepts an rvalue. - The function
caf::net::make_pipeno longer closes read/write channels of the
connected socket pair on Windows. This fixes a bug where the pipe would close
after two minutes of inactivity.
Changed
- Calling
to_stringon any of CAF's enum types now represents the enum value
using the short name instead of the fully qualified name. For example,
to_string(sec::none)now returns"none"instead of"caf::sec::none".
Accordingly,from_stringnow accepts the short name (in additional to the
fully qualified name). - Log format strings no longer support
%C. CAF still recognizes this option
but it will always printnull. - The function
caf::telemetry::counter::incnow allows passing 0 as an
argument. Previously, passing 0 triggered an assertion when building CAF with
runtime checks enabled. - Calling
disposeon a flow subscription now callson_error(sec::disposed)
on the observer. Previously, CAF would simply callon_complete()on the
observer, making it impossible to distinguish between a normal completion and
disposal. - The
caf::loggerreceived a complete overhaul and became an interface class.
By turning the class into an interface, users can now install custom logger
implementations. CAF uses the previous implementation as the default logger if
no custom logger is configured. To install a logger, users can call
cfg.logger_factory(my_logger_factory)on theactor_system_configbefore
constructing theactor_system. The logger factory is a function object with
signaturecaf::intrusive_ptr<caf::logger>(caf::actor_system&). Furthermore,
log messages are now formatted usingstd::formatwhen compiling CAF with
C++20 or later. Otherwise, CAF will fall back to a minimal formatting
implementation with compatible syntax. The logging API will also automatically
convert any type with a suitableinspectoverload to a string if the type is
not recognized byformat.
Deprecated
- Calling
to_streamorto_typed_streamon an actor is now deprecated. Simply
callto_streamorto_typed_streamdirectly on theobservableinstead.
Removed
- The implementation of
operator<forcaf::unordered_flat_mapwas broken and
relied on the order of elements in the map. We have removed it, since it has
never worked correctly and a correct implementation would be too expensive.
0.19.4
0.19.3
Added
- The class
caf::telemetry::labelnow has a newcompareoverload that
accepts acaf::telemetry::label_viewto make the interface of the both
classes symmetrical. - The template class
caf::dictionarynow has new member functions for erasing
elements. - The CLI argument parser now supports a space separator when using long
argument names, e.g.,--foo bar. This is in addition to the existing
--foo=barsyntax. - The functions
make_messageandmake_errornow supportstd::string_view
as input and automatically convert it tostd::string. - To make it easier to set up asynchronous flows, CAF now provides a new class:
caf::async::publisher. Any observable can be transformed into a publisher by
callingto_publisher. The publisher can then be used to subscribe to the
observable from other actors or threads. The publisher has only a single
member function:observe_on. It converts the publisher back into an
observable. This new abstraction allows users to set up asynchronous flows
without having to manually deal with SPSC buffers. - The flow API received additional operators:
first,last,take_last,
skip_last,element_at, andignore_elements.
Changed
- When using CAF to parse CLI arguments, the output of
--helpnow includes all
user-defined options. Previously, only options in the global category or
options with a short name were included. Only CAF options are now excluded
from the output. They will still be included in the output of--long-help. - The output of
--dump-confignow only contains CAF options from loaded
modules. Previously, it also included options from modules that were not
loaded. - We renamed
caf::flow::item_publishertocaf::flow::multicasterto better
reflect its purpose and to avoid confusion with the new
caf::async::publisher. - When failing to deserialize a request, the sender will receive an error of
kindsec::malformed_message. - When implementing custom protocol layers that sit on top of an octet stream,
thedeltabyte span passed toconsumenow resets whenever returning a
positive value fromconsume. - When constructing a
behaviorormessage_handler, callbacks that take a
messageargument are now treated as catch-all handlers. - When creating a message with a non-existing type ID, CAF now prints a
human-readable error message and callsabortinstead of crashing the
application.
Fixed
- Fix build errors with exceptions disabled.
- Fix a regression in
--dump-configthat caused CAF applications to emit
malformed output. - Fix handling of WebSocket frames that are exactly on the 65535 byte limit.
- Fix crash when using a fallback value for optional values (#1427).
- Using
take(0)on an observable now properly creates an observable that calls
on_completeon its subscriber on the first activity of the source
observable. Previously, the created observable would never reach its threshold
and attempt to buffer all values indefinitely. - The comparison operator of
intrusive_ptrno longer accidentally creates new
intrusive_ptrinstances when comparing to raw pointers. - Fix function object lifetimes in actions. This bug caused CAF to hold onto a
strong reference to actors that canceled a timeout until the timeout expired.
This could lead to actors being kept alive longer than necessary (#698). - Key lookups in
caf::net::http::request_headerare now case-insensitive, as
required by the HTTP specification. Further,field_atis now aconst
member function (#1554).
0.19.2
Changed
- Install CAF tools to
${CMAKE_INSTALL_BINDIR}to make packaging easier. - The OpenSSL module no longer hard-codes calls to
SSL_CTX_set_cipher_listin
order to use the system settings by default. Users can provide a custom cipher
list by providing a value for the configuration option
caf.openssl.cipher-list. To restore the previous behavior, set this
parameter toHIGH:!aNULL:!MD5when running with a certificate and
AECDH-AES256-SHA@SECLEVEL=0otherwise (or without@SECLEVEL=0for older
versions of OpenSSL). Please note that these lists are not recommended as
safe defaults, which is why we are no longer setting these values.
Fixed
- Add missing initialization code for the new caf-net module when using the
CAF_MAINmacro. This fixes theWSANOTINITIALISEDerror on Windows (#1409). - The WebSocket implementation now properly re-assembles fragmented frames.
Previously, a bug in the framing protocol implementation caused CAF to sever
the connection when encountering continuation frames (#1417).
Added
- Add new utilities in
caf::chronofor making it easier to handle ISO 8601
timestamps. The new functionstd::chrono::to_stringconverts system time to
an ISO timestamp. For reading an ISO timestamp, CAF now provides the class
caf::chrono::datetime. It can parse ISO-formatted strings viaparse(or
datetime::from_string) and convert them to a local representation via
to_local_time. Please refer to the class documentation for more details.
0.19.1
Added
- The class
json_valuecan now hold unsigned 64-bit integer values. This
allows it to store values that would otherwise overflow a signed integer.
Values that can be represented in both integer types will returntruefor
is_integer()as well as for the newis_unsigned()function. Users can
obtain the stored value asuint64_tviato_unsigned().
Changed
- With the addition of the unsigned type to
json_value, there is now a new
edge case whereis_number()returnstruebut neitheris_integer()nor
is_double()returntrue: integer values larger thanINT64_MAXwill only
return true foris_unsigned().
Fixed
- Fix flow setup for servers that use
web_socket::with. This bug caused
servers to immediately abort incoming connection (#1402). - Make sure that a protocol stack ships pending data before closing a socket.
This bug prevented clients from receiving error messages from servers if the
server shuts down immediately after writing the message.