- Report endless loops (while (true), for (;;), ...) in an override of
Device::Run() that do not call NewStatePending() or WaitFor(). Such a
device does not stop when a state change is requested.
- Skip loops that call Send() or Receive(), which an interrupt stops,
and loops with a break, return, throw or goto.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Report devices that register a data callback with OnData() and also
override ConditionalRun(). With data callbacks, Device::RunWrapper()
runs only the callbacks, so ConditionalRun() is dead code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Replace -1, -2 and -3 in == and != comparisons with the result of
Send() or Receive() by static_cast<int64_t>(fair::mq::TransferCode::X).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Report uses of a MessagePtr after a Send() whose result is discarded.
After the send the message is empty with zeromq, and still points to
the sent buffer with shmem, so the same code acts differently per
transport.
- Walk the CFG from the send with ExprSequence, like
bugprone-use-after-move. A loop back to the send counts as a use.
- Assignment, reset(), Rebuild(), a new declaration in a loop and
passing by non-const reference (e.g. to Receive()) give a new message.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Report Receive() calls whose result is discarded. On a timeout, an
error or an interrupt the message stays empty, and only the result
tells.
- Report Send() too with the option CheckSend: true. Off by default,
because many devices ignore the result of Send() on purpose.
- A cast to void discards the result on purpose and is not reported.
- Add Transfer.h with matchers for Send() and Receive() of Device,
Channel and Socket, and isDiscarded(), for this and later checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Mark GetValue<T>(), SetValue() and GetStringValue() as deprecated in
favour of the property API, as the TODO comments ask.
- fairmq-modernize-progoptions-accessors migrates the calls.
- List them in the migration guide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Migrate a device main file from <runFairMQDevice.h> to
<fairmq/runDevice.h>: the include, the FairMQDevicePtr return type,
the const ProgOptions& parameter and 'return new T(...)', which becomes
'return std::make_unique<T>(...)'.
- Fix all of it or nothing: if a return statement of getDevice() is not
a plain new expression, only report.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Replace GetValue<T>(key) with GetProperty<T>(key, {}) and
GetStringValue(key) with GetPropertyAsString(key, {}). The {} default
keeps the old result for an unknown key, where the property API throws.
- Replace SetValue() with SetProperty() only where its always-zero
result is unused, because SetProperty() returns void.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Replace Parts::AtRef(i) with Parts::At(i). At() returns a reference
to the MessagePtr, so a following '.' becomes '->', and a lone call
gets a leading '*'.
- Wrap the raw pointer of Parts::AddPart(Message*) in
fair::mq::MessagePtr.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Replace Device::GetStateName() and Device::GetTransitionName() with
the free functions fair::mq::GetStateName() and GetTransitionName().
- Replace Socket::GetConstant() of the zeromq and shmem transports with
fair::mq::zmq::getConstant() and include <fairmq/zeromq/Common.h>.
- Report Socket::Close() without a fix: the socket closes when it is
destroyed, so the call must go away, not be renamed.
- Skip the fix if the object expression has side effects.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add the option BUILD_TIDY_CLANGD (default OFF). It builds
fairmq-clangd from clangdMain plus the fairmq-* module.
- clangd cannot load plugins, but creates its clang-tidy checks from the
same registry. Thus the checks run on the AST that clangd builds anyway,
and editors show their fixes as quick fixes.
- Point clangd to the resource directory of the LLVM installation it was
built with, unless --resource-dir is given.
- Test each check over LSP with test/tidy/ClangdCheck.py: open the input,
expect a diagnostic of the check and a quick fix for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add the MODULE library fairmq-tidy-plugin, installed as
libfairmq-tidy-checks.so. It adds the fairmq-* checks to a stock
clang-tidy of the same LLVM release via --load.
- Do not link the LLVM libraries into the plugin: the loading clang-tidy
has them.
- Run every check test also through the plugin, if a clang-tidy of the
found LLVM installation exists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Report uses of the deprecated member fair::mq::Device::fChannels.
- Replace fChannels.at(name).at(index) with GetChannel(name, index) and
every other use with GetChannels().
- Ignore uses inside fair::mq::Device itself.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Report includes of the ten deprecated headers, e.g. <FairMQDevice.h>
or <fairmq/FairMQDevice.h>, and replace them with the successor, e.g.
<fairmq/Device.h>. Today these headers only emit a #pragma warning.
- Keep the quote style of the include.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Implement the checks as a clang-tidy module (object library
fairmq-tidy-module) instead of a standalone LibTooling program.
- Build fairmq-tidy from clangTidyMain plus the module. It gets all
clang-tidy features: --fix, --export-fixes, .clang-tidy files, NOLINT,
header filter, and the upstream checks on the same parse.
- Without a --checks option, add fairmq-* to the configured checks.
- Point the driver to the resource directory of the LLVM installation it
was built with, so it finds the Clang builtin headers from any install
location. The -I hint in fairmq_target_tidy() is no longer necessary.
- Add the include directories of LLVM and Clang. The old target compiled
only where they are in /usr/include.
- Port fairmq-modernize-nonnamespaced-types. Match deprecated global
aliases into fair::mq instead of the name prefix "FairMQ": this also
finds e.g. InputMsgCallback and skips aliases that are not deprecated.
Match only the TypedefTypeLoc, so each use is reported once.
BREAKING CHANGE: fairmq-tidy takes the options of clang-tidy and reads
.clang-tidy files. With no .clang-tidy file it now also runs the default
clang-tidy checks (clang-diagnostic-*, clang-analyzer-*).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add the public headers and the generated Version.h to the file set
HEADERS of FairMQ
- Install the file set instead of one install(FILES) per header
- The file set gives the include directory include/fairmq; the exported
target also adds it for CMake versions before 3.23
- The installed headers are the same
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Use the platform variable instead of the literal dl
- Use Boost::headers instead of the legacy alias Boost::boost
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Projects that add FairMQ with add_subdirectory() use the same target
name as projects that use the installed package
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR point to the top-level project
and break add_subdirectory() and FetchContent
- Find the helper modules relative to the CMakeLists.txt that includes them
- Replace @CMAKE_BINARY_DIR@ in the example test scripts
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- The macro name is a typo and has no effect
- It was exported to every consumer as a PUBLIC definition
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- shmem uses one metadata format for a single message and another for
a multipart message; Receive(Parts) of a single send, or
Receive(MessagePtr) of a multipart send, gives wrong metadata or a
crash
- Add a sender/receiver table to the messages page of the
documentation and a note to Channel::Receive()
- Update the source line links into Channel.h
- Keep PartsTransfer.SingleSendMultipartReceive disabled: a fix
changes the shmem wire format
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- zeromq refuses an empty Parts with TransferCode::error; shmem sent a
message with zero parts and returned 0, and the receiver got a
Receive() with zero parts
- Refuse it in shmem too, with the same warning
- Enable PartsTransfer.EmptyPartsIsRefused
- Update the documentation pages that described the defect, and
the source line links into the changed files
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The function reserved each result vector and then wrote to
result[segment][handle], past the end of the vector: it returned
empty vectors and corrupted the heap
- Append one entry per buffer, in the order of the buffer offset
- Check the debug map for null before its first use
- Name the map entries (segment id, offset, buffer) instead of
.first and .second
- Enable Monitor.GetDebugInfo (needs FAIRMQ_DEBUG_MODE)
- Update the documentation page that described the defect
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The REPL polled the stdin fd, then read one key with std::cin; the
other keys of the same read stayed in the std::cin buffer, and
poll() did not report them again
- Read one key with read(2), so poll() reports each key that is not
handled yet; skip whitespace, as operator>> did
- Stop reading at end of input: before, a closed stdin (e.g.
< /dev/null) made the loop print the help without a pause
- Enable ControlPlugin.SeveralKeysInOneInput
- Update the documentation pages that described the defect, and
the source line links into the changed files
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- DeviceRunner sets the console log severity to "nolog" for both
options, but printed their output with LOGV(info), so both options
printed nothing
- Add Device::PrintRegisteredChannels(std::ostream&) for the
machine-readable channel list; the version goes to std::cout, like
--help and --print-options
- Enable DeviceRunner.PrintChannels and DeviceRunner.Version
- Update the documentation pages that described the defect, and
the source line links into the changed files
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ptree::get(key, default) returns the default also for a value that
does not convert, so a typo (e.g. sndBufSize=big) silently gave the
default value
- Use the default only for a missing key; throw ParserError with the
key and the value for a value of the wrong type
- Rethrow parser errors in the config plugin: before, the device
logged the error and continued without its channel configuration
- Enable JSONParser and SuboptParser RejectsValuesOfTheWrongType
- Update the documentation pages that described the defect, and
the source line links into the changed files
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The Error state is a terminate state: the state machine ignores all
events in it and calls no action, so ChangeState() returned the
result of the previous transition (ErrorFound: true)
- Return false for each transition in the Error state, except for
ErrorFound: the device is already in the Error state, so callers
such as ChangeStateOrThrow(ErrorFound) in Device::RunWrapper() or
in user code do not throw
- Enable StateMachine.RefusesTransitionsInError
- Update the documentation pages that described the defect, and
the source line links into the changed files
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Remove docs/*.md and docs/images/
- Rewrite README.md: description, install, first steps and links to
the site
- Replace the READMEs of the examples, fairmq/shmem, fairmq/devices and
fairmq/tools with links to the site pages
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- a child process that hangs blocked execute() until the caller was
killed (e.g. by the ctest timeout); the child then ran on as an
orphan, with its shm segments and ipc files
- the new overload kills the child with SIGKILL after the timeout and
logs the timeout in the captured output
- keep the old overload (no limit) for compatibility
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Remove the `fRegionPtr` member of `shmem::Message`. It cached the
region of the last `GetData()`, `GetRefCount()` or `Copy()` call.
`Rebuild()` and `Socket::Receive()` did not reset it.
- When a message received a block of region A, was read, rebuilt, and
then received a block of region B, its release went to region A.
Region A got a wrong callback and region B never got its block back.
- Look up the region with `Manager::GetRegionFromCache()` where it is
needed. The lookup is a thread-local fast path.
- `sizeof(shmem::Message)` goes from 80 to 72 bytes on LP64.
Refs: #477
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GetRegion() locks the local region mutex first and then the
session-wide shmem mutex; CreateRegion() locked them in the opposite
order
- a thread that creates a region and a thread that opens a region of
another process in the same session can deadlock (ABBA)
- lock the local region mutex first also in CreateRegion()
- add a regression test
Refs: #334
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- RemoveRegion() held the session-wide shmem mutex and the local region
mutex while it joined the ack threads of the region
- the ack receiver calls the user callback for each outstanding ack
during the linger period; a callback that calls into the transport
(e.g. GetRegionInfo(), or a message destruction that opens a region)
waits for one of these mutexes, and the destruction never ends
- the shmem mutex is shared by all processes of the session, so the
other processes hang also, and new processes hang at startup
- stop the acks without a lock, then lock each mutex separately and
only for the access to the shared data
- add a regression test
Refs: #334
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- the ack sender waited up to 500 ms for a full ack batch, also after
StopAcks(), so each region destruction took at least 500 ms
- wait with a predicate that includes the stop flag
- set the stop flag under the ack mutex, so that the sender cannot miss
the notification
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Stop the zmq monitor and drain pending events before closing the
monitored socket and the reading monitor socket
- Events emitted while the monitored socket closes were dropped by
libzmq, leaking their endpoint frames (zmq_msg_init_size)
- Apply to both the zeromq and shmem transport sockets
- LeakSanitizer no longer reports leaks in the test suite
Fixes: #463
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- the pattern is constant; compiling it on every Validate() call is
wasted work and, when channels are validated from multiple threads,
needlessly exercises libstdc++'s lazily-populated ctype caches
- concurrent execute() calls print captured subprocess lines to
std::cout from multiple threads; the standard allows that, but
libstdc++ maintains the formatted-output state (ios_base::width)
with plain reads and writes -- a data race ThreadSanitizer reports
once libstdc++ itself is instrumented
- a mutex around the insertion also keeps whole lines from
interleaving
A failed region lookup was inserted into the thread-local cache as
nullptr, making the failure permanent for the lifetime of the cache
generation - retrying never healed because the fast path would return
nullptr without calling GetRegion again. Skip the cache insert on
failure so subsequent calls retry the slow path.
Add two public entry points needed by the ALICE use case where shmem
messages are allocated via a transport but never sent — their metadata
is instead serialised into Arrow tables and delivered over a separate
channel, allowing consumer devices to resolve the payload pointer
without taking ownership.
shmem::Message::GetMeta() returns the MetaHeader of the message,
mirroring the existing positional-init pattern already used in Socket.h.
shmem::GetDataAddressFromHandle(TransportFactory&, const MetaHeader&)
is a free function declared in Common.h and defined in Manager.cxx.
Keeping it out of the TransportFactory class body means callers only
need to include Common.h (available transitively via Message.h) and do
not drag in Socket.h or zmq.h. The implementation handles both managed
segments and unmanaged regions, and throws SharedMemoryError with a
typed message on a bad segment or region id. TransportFactory also
gains a same-named member for callers that already have the concrete
type. Lifetime of the returned pointer is the caller's responsibility;
the cache device is expected to hold the messages alive.
A SideChannel test covers the GetMeta/GetDataAddressFromHandle
round-trip for both standard and expanded-metadata configurations.
- glibc declares pclose with function attributes (nothrow/leaf), so
decltype(pclose)* carries attributes that gcc ignores on the unique_ptr
template argument, emitting -Wignored-attributes
- spell the deleter as a plain int(*)(FILE*) instead; pclose converts to
it silently and the deleter behaves identically (both popen branches)
Boost 1.88 replaced Boost.Process with v2, breaking the v1 API.
Boost 1.89 restores v1 compatibility via <boost/process/v1.hpp>.
- Fail configuration if Boost 1.88 is detected
- Define FAIRMQ_BOOST_PROCESS_V1_HEADER for Boost >= 1.89
- Use conditional includes to select v1.hpp or process.hpp
- Add namespace aliases (bp, bp_this) for portable API access