* fix(NotificationCenter): use RWLock to prevent lock-order-inversion #5150
Change NotificationCenter from Mutex to RWLock to fix TSAN lock-order-inversion
warnings when notification handlers call back into the notification center
(e.g., hasEventHandler() from within a SocketReactor handler).
Key changes:
- Replace Mutex with RWLock for better read concurrency
- Use read locks for hasObserver(), observersToNotify(), hasObservers(),
countObservers(), backlog()
- Use write locks for addObserver(), removeObserver(), clear()
- observersToNotify() now copies observer list and releases lock before
calling accepts() to avoid lock cycle with NObserver's internal mutex
- Add clear() method to atomically disable and remove all observers
- Update AsyncNotificationCenter to use RWLock::ScopedLock
Also fixes AsyncNotificationCenter shutdown to properly signal the dequeue
thread via ShutdownNotification instead of relying only on wakeUpAll() #5058
* fix(Net): add SocketReactor::remove() for safe socket cleanup #5150
Add SocketReactor::remove() method that atomically removes a socket
from the poll set and disables all its event handlers. This prevents
race conditions when removing handlers in destructors, where events
could still be dispatched to handlers while other handlers for the
same socket are being removed.
Changes:
- Add SocketReactor::remove(socket) for atomic socket removal
- Add SocketNotifier::disableObservers() to disable all handlers
- Add SocketNotifier::socket() getter
- Skip dispatch for removed sockets in dispatch() methods
- Update tests to use remove() before removeEventHandler()
- Add testSocketReactorRemove() test
* fix(Foundation): improve ProcessRunner robustness #5054
- Fix race condition: set _pPH after _pid to ensure pid() returns
valid value when running() returns true
- Add upfront invalid PID validation before termination attempt
- Escalate to Process::kill() if requestTermination times out,
with its own timeout before throwing
- Try to remove stale PID file on timeout instead of throwing
- Wrap start() wait logic in try/catch to kill orphan process
and reset state if startup fails
- Clear _error under lock after successful stop to prevent
stale error from affecting next start()
* Update Net/include/Poco/Net/SocketReactor.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Foundation/src/AsyncNotificationCenter.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Foundation/include/Poco/AsyncNotificationCenter.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Foundation/src/AsyncNotificationCenter.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* chore: add TaskManager::testCancel to win ignore list
* chore: few improvements in NotificationCenter and ODBC cmake.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Matej Kenda <matejken@gmail.com>
* Util::Application: unified argument handling to reduce code duplication
* Syntax fix for Util::Application on Win32
* Util::Application: fix for _WIN32
* Explicitly delete and default constructors of Subsystem.
* Data::TypeHandler: suppress MSVC warning about implicitly deleted destructor
* Poco::Util: deleted/defaulted constructors, override annotations
* Application, ServerApplication: some cleanup
* Default member initializers for Util::Option
* Poco::Util: more deleted/defaulted constructors, override annotations
* Overload of AbstractConfiguration::keys() that returns the result
* Util::LocalConfigurationView as a variant of ConfigurationView
* Util::SystemConfiguration: use map of functions
* Util: update copyright notices
* Util::AbstractConfigurationView
* Poco::Util::Units::abs template
* Overloads for Application::getApplicationPath and getApplicationDirectory
* Potential fix for code scanning alert no. 1696: No raw arrays in interfaces
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* Potential fix for code scanning alert no. 1697: Commented-out code
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* Documentation fix for AbstractConfiguration
* More fixes for code scanning alert no. 1696: No raw arrays in interfaces
---------
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* fix(Data): Refactor ODBC tests and fix testReconnect TypeInfo caching #5136
- Add TypeInfo::reset() to clear cached type info, called on session close
to fix testReconnect failing when connection is reestablished
- Move common test methods from ODBC SQLExecutor to shared DataTest
SQLExecutor for better code reuse across database backends
- Improve error message in hasTransactionIsolation() to be more descriptive
- Refactor ODBC MySQL and PostgreSQL test executors to delegate to
shared base implementation
- Update MySQL, PostgreSQL, and SQLite test suites to use refactored
executor methods
- Add Nix shell environments for MySQL and PostgreSQL test databases
with auto-start/stop and ODBC driver configuration
* chore: pass executor name
* chore: nix-shell documentation
* chore: nix-shell documentation
* feat: add optional/tuple tests to ODBC Oracle and SQLServer #5136
* fix(ODBC): add missing functions implementations #5136
* Add NativeThreadInfo
+ use in Message
+ test with PatternFormatter
* Fix NativeThreadInfo for glibc without gettid
* add new file to make
* chore: formatting
* fix(NativeThreadinfo): name and id #3333
* fix(NativeThread): add OS includes #3333
* fix(Message): use OS thread ID for non-POCO threads #3333
Fix Message initialization to correctly handle thread IDs for both POCO
and non-POCO threads. When Thread::current() returns null (std::thread,
main thread, etc.), use NativeThreadInfo to get the OS thread ID instead
of leaving _tid as zero.
Rename NativeThreadInfo::id() to NativeThreadInfo::osTid() to match the
Thread::currentOsTid() naming convention and clarify that both return
the same kernel-level thread identifier (not the POCO sequential ID).
Additional changes:
- Add comprehensive documentation to NativeThreadInfo explaining its
purpose and when to use it vs Thread::current()
- Fix LoggerTest warning by removing pessimizing std::move in return
- Update all platform implementations (POSIX, WIN32, WINCE, VxWorks)
This ensures the %I format specifier in PatternFormatter shows:
- POCO thread ID (1, 2, 3...) for Poco::Thread instances
- OS thread ID for non-POCO threads (std::thread, main thread, etc.)
* fix(LoggerTest): compare thread ID against actual value #3333
testFormatThreadName was failing in CI because it expected the POCO
thread ID to be 1, but in a full test run, many threads are created
before this test (by ThreadingTestSuite, etc.), resulting in higher IDs.
The test now compares against the actual thread's ID (thr.id()) instead
of a hard-coded value, making it robust regardless of test order.
* fix(NativeThreadInfo): windows compile #3333
* fix(NativeThreadInfo): mac compile fail; consolidate platform pthread functions selection #3333
* fix(NativeThreadInfo): use UTF8 #3333
* fix: remove NativeThreadInfo (not needed) #3333
* fix(Thread): proper UTF-8 handling and test robustness #3333
- Thread_WIN32: Use MultiByteToWideChar with CP_UTF8 in setCurrentNameImpl
instead of byte-by-byte iterator copy. The old conversion was incorrect
for non-ASCII characters (e.g., Japanese thread names).
- LoggerTest: Add bounds check (parts.size() >= 5) before accessing vector
elements to prevent undefined behavior if log message format is unexpected.
* fix(Message): disable thread name on platforms that don't have it #3333
* fix(Thread): make getCurrentName/setCurrentName always available #3333
Move POCO_NO_THREADNAME guard inside inline implementations instead of
around declarations. This ensures the API is always available on all
platforms, returning empty string or no-op on platforms without thread
name support (e.g., emscripten, AIX).
Update Message.cpp to remove conditional compilation since the functions
are now unconditionally available.
* fix(Thread): Windows backward compatibility and code cleanup #3333
Thread_WIN32.cpp:
- Use dynamic loading for SetThreadDescription/GetThreadDescription
via GetProcAddress for compatibility with pre-Windows 10 1607
- setCurrentNameImpl tries modern API first, falls back to legacy
exception method (0x406D1388) for older Windows/debuggers
- Remove redundant processthreadsapi.h and stringapiset.h includes
(already included via windows.h)
LoggerTest.cpp:
- Simplify loop condition (remove redundant npos check)
- Fix code style (braces on new lines)
---------
Co-authored-by: Olivier Smeesters <osm@idirect.net>
* TypeHandler for std::tuple, used to implement TypeHandler for Poco::Tuple
* Removed obsolete using declarations in Data.cppm
* TypeHander: added missing typename
* Explicitly delete constructors of AbstractTypeHandler
* TypeHandler specialization for std::optional
* Data/MySQL: modernize loops and usage of virtual/override
* Poco::Tuple: formatting fix
* Poco::Data: more consistent usage of virtual/override and = delete
* Added test cases for std::tuple and std::optional (for MySQL and PostgreSQL)
* Poco::Data: more override annotations
* Added testcases for st::tuple and std::optional to SQLite.
* chore(Data): Improvements suggested by clang-tidy
---------
Co-authored-by: Matej Kenda <matejken@gmail.com>
* fix(SharedLibrary): Missing DLLs not reported #5069
* fix(CMake): not producing proper binary names #5070
* fix(SharedLibrary): disable shared lib tests in static build #5069
* fix(misc): add pdjson links to gitignore, remove unused var in SharedLibrary, harden TaskManagerTest
* fic(ci): separate oracle and sqlserver odbc (out of disk space) (#5075)
* fic(ci): separate oracle and sqlserver odbc (out of disk space)
* use oracle odbc driver
* use oracle free
* ad db user
* postpone adding user after build
* remove default tablespace (does not exist)
* reinstate all ci jobs
* add postgresl odb tests to ci
* remove spurious syminks
* fix gitignore (pdjson)
* Remove VS projects #5076
* chore: revert leftover ODB IP address
* fix(CodeQL): float comparison alerts
* fix: compile errors
* chore: upgrade asan to macos-14 (tryout)
* fix: .gitignore symlinks; XML Makefile wrong pattern
* Optimize PatternFormatter and Timezone performance #5078
PatternFormatter:
- Cache node name (Environment::nodeName()) to avoid repeated syscalls
- Add extractBasename() for efficient %O format specifier
- Add string reserve(128) to reduce reallocations during formatting
Timezone:
- Cache UTC offset to avoid repeated syscalls (8x speedup for %L patterns)
- Auto-detect TZ environment variable changes to invalidate cache
- Add reloadCache() method for explicit cache refresh
Tests:
- Add TimezoneTest::testUtcOffsetCaching()
- Add PatternFormatterTest::testExtractBasename()
* fix: use Path::separatorin extractBasename #5078
* Add Benchmark #5080
* enh(Logging): move constructors for Message and Logger #5078
* chore(AsyncNotificationCenter): eliminate MSVC warnings
* enh(build): c++20 support #5084
* feat(CppUnit): print class name
execute all named tests (not only the first one)
accept test name with class (eg. testrunner LoggerTest::testLogger) #5083
* feat(Benchmark): Add Logger/FastLogger comparison benchmarks and Windows support
- Add LoggerBench.cpp with AsyncChannel vs FastLogger benchmarks
- Add compare.sh (Linux/macOS) and compare.ps1 (Windows) scripts
- Add LOGGER_BENCHMARK.md with cross-platform benchmark results
- Update README.md with Windows build instructions (Ninja, CMAKE_PREFIX_PATH)
- Add error message when -- options are used on Windows (should use /)
- Update CMakeLists.txt and Makefile to include LoggerBench #5080
* feat(FastLogger): #5078
FastLogger provides a Poco-compatible wrapper around the Quill logging
library, offering significant performance improvements over AsyncChannel
through lock-free SPSC queues and backend thread processing.
Key features:
- Drop-in replacement for Poco::Logger with FastLogger::get()
- Support for all standard Poco channels (Console, File, Rotating, etc.)
- XML/properties configuration via FastLoggerConfigurator
- Thread affinity for backend worker on Linux and Windows
- Log file rotation with size and time-based policies
Performance (CPU time - calling thread latency):
- Linux: 31-70x faster than AsyncChannel
- Windows: 23-87x faster than AsyncChannel
- macOS: Limited improvement due to lack of thread affinity support
New files:
- Foundation/include/Poco/FastLogger.h
- Foundation/src/FastLogger.cpp
- Util/include/Poco/Util/FastLoggerConfigurator.h
- Util/src/FastLoggerConfigurator.cpp
- dependencies/quill/ (header-only Quill 7.5.0 library)
* fix(cmake): disable FastLogger on emscripten (not supported) #5078
* feat(FastLogger): add cpuAfinity config parameter #5087
* fix(FastLogger): Fix lock-order-inversion in FastLogger (TSAN) #5078
* fix(cmake): build not stripping release binaries #5085
* fix(PCRE): fails to compile with clang/c++20 #5131
* feat(AsyncChannel): add CPU affinity property #5087
* feat(SpinlockMutex): make it adaptive #5132
* feat(AsyncChannel): add CPU affinity property #5087
* chore: remove leftover file commited by mistake
* feat(build): allow FastLogger to be fully disabled at build time #5078
Build system changes:
- Add POCO_NO_FASTLOGGER compile definition in CMake when ENABLE_FASTLOGGER=OFF
to prevent Config.h from auto-enabling FastLogger
- Add ifdef guards around FastLogger tests in LoggingTestSuite.cpp
- Exclude FastLoggerTest.cpp and FastLoggerChannelsTest.cpp from CMake build
when FastLogger is disabled
- Add POCO_NO_FASTLOGGER support to Make build system for Foundation and Util
- Add CI jobs to verify builds work without FastLogger (CMake and Make)
Code changes:
- Add LoggingConfigurator::configure() convenience method for quick logging setup
* fix(ci): testrunner args
* chore(progen): remove leftover script #5076
* fix(test): give ANC a bit more time to process
* fix(ci): set env before test run
* chore(doc): quill license
* feat(Channel): add log(Message&&) #5133
* fix(ci): set env before test run
* fix(TestRunner): don't search children #5083
* feat: lock-free queues #5134
* feat(Benchmark): various comparisons
* chore: cleanup benchmark