* 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>
* enh(Logger): simplified logging macros.
* enh(Delegate): Simplify code with constexpr and std::conditional_t.
* enh(NumericString): Simplify code with constexpr and std::is_signed_v.
* enh(MetaProgramming): Simplify code with C++17 equivalents.
* enh(Tuple): Simplify code with C++17 equivalents.
* enh(TypeList): Remove metaprogramming features that are not used.
* enh(Modules): Remove obsolete Foundation functionality
* enh(Foundation): Compile and run deprecated functionality only when POCO_TEST_DEPRECATED is enabled. Update comments for deprecated functionality.
* fix(Modules): Add missing conditional forward declarations for Foundation.
* Initial plan
* Fix WebSocket sendFrame delay by enabling TCP_NODELAY
- Enable TCP_NODELAY in WebSocketImpl constructor to prevent Nagle's algorithm
from buffering small WebSocket frames
- Add check to skip TCP_NODELAY for Unix domain sockets
- Add documentation about TCP_NODELAY behavior to WebSocket class
- Tested with existing WebSocket test suite - all tests pass
Co-authored-by: aleks-f <2429093+aleks-f@users.noreply.github.com>
* Address code review feedback
- Avoid unnecessary SocketAddress object construction by calling family() directly
- Use specific exception type (Poco::Exception) instead of catch-all
Co-authored-by: aleks-f <2429093+aleks-f@users.noreply.github.com>
* Refine exception handling for TCP_NODELAY configuration
- Catch specific exception types (NetException, IOException, InvalidArgumentException)
instead of broad Poco::Exception
- Improve error handling comments for clarity
Co-authored-by: aleks-f <2429093+aleks-f@users.noreply.github.com>
* Consolidate exception handling for better maintainability
- Combine catch blocks since all exceptions are handled identically
- Improve code clarity with more descriptive comments
Co-authored-by: aleks-f <2429093+aleks-f@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: aleks-f <2429093+aleks-f@users.noreply.github.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(CI): Github macos-13 runner is deprecated, use macos-15-intel to run tests on Intel macOS
---------
Co-authored-by: Matej Kenda <matejken@gmail.com>
* reactor http server
* fix
* test logic
* add reactor server session , use buf to cache socket buffer
* add reactor example
* fix: nodelay, otherwise ack will be after 50 ms
* tcp reactor server support multi listener
* fix: tcp reactor connection lifetime about socket
* feat: add tcp reactor params
* format
* check http reqeust complete, dynamic size buffer in reactor
* remove try catch
* remove debug logger
* remove debug logger
* fix: should not pop in destructor
* delete useless
* remove cankeepalive temporarily, optimize check complete req
* coding style
* coding style
* reactor server session unit test
* http reactor time server add delay param
* optimize switch case, and pop completed msg in destructor
* refactor reactor server session
* fix: check completed request when headers are in lower case like oha, add unit tests
* fix auto_ptr compile error, remove logger and coding style
* compile and tests fix, add reactor obj in makefile and vcxproj
* compile and tests fix in win, add reactor sample vcxproj
* compile and tests fix in macos when visibility is hidden
* Add support for modules
* Use "" for inclusion
* Fix missing includes on Poco.Data module
* Add PDF and SevenZip modules, and match modules to build macros
* Add CI test
* Add missing link libraries in CMake
* Add remaining libraries DNSSD, CppParser and CppUnit. Changed some static declarations to inline to export
* We also need to forward the ENABLE_NETSSL_* macros
* Update CMakeLists files
* Add samples as requested, with DateTime and URI test for example
* Fix POCO_MODULES_INSTALL macro
* chore(CMake): Combine install macro for libraries and C++ modules into one macro.
* Apply testsuite changes and address include directories concerns
* Restore accidentally deleted build files
* Mistakenly added a file generated by CMake, removed.
---------
Co-authored-by: Matej Kenda <matejken@gmail.com>
* chore(PCRE): properly detect library type on newer macOS
* chore(ZLIB): move source files to own zlib directory and update CMake files.
* chore(PCRE): move source files to own pcre2 directory and update CMake files.
* chore(UTF8PROC): move source files to own utf8proc directory and update CMake files.
* chore(ZLIB): remove header files
* chore(PDJSON): move source files to own pdjson directory and update CMake files.
* chore(SQLite3): move source files to own sqlite3 directory and update CMake files.
* chore(UNBUNDLED): Correct includes.
* chore(expat): move source files to own expat directory and update CMake files.
* chore(wepoll): move source files to own wepoll directory and update CMake files.
* chore(7zip): move source files to own 7zip directory and update CMake files.
* chore(CMake): fix compile and link flags for dependent static libraries
* chore(CMake): set PCRE2_STATIC when building PCRE2.
* chore(SQLite3): Set SQLITE_THREADSAFE for unbundled build, add warnings.
* chore(CMake): Modifications to build and link properly static target libraries (using OBJECT library type and link using BUILD_LOCAL_INTERFACE)
* chore(CMake): fix order of includes in main CMakeLists.txt.
* chore(CI): Build mysql tests with cmake.
* chore(CI): Build mongodb, redis, sqlite no parser tests with cmake.
* chore(CI): Build odbc tests with cmake.
* chore(CI): Build more ations with cmake, other fixes.
* chore(CI): Fixes for macOS
* chore(CMake): extract hpdf and png files to own directories in dependencies
* fix(CMake): include dependencies after all module dependencies are resolved.
* fix(CMake): Improve dependency handling of dependencies to compile them only when necessary.
* fix(CMake): PDF: move t4.h to proper directory, modify include.
* fix(CMake): Fixes to link properly on all platforms.
* fix(CMAKE): Wrong ENABLE for SQLITE
* enh(PDF): Remove dependencies on hpdf headers from Poco::PDF interface and make usage of hpdf only internal.
* enh(CI): Convert more jobs to use cmake.
* enh(CI): Convert macOS sanitizer jobs to use cmake.
* enh(mkrelease): Copy dependencies when creating release package.
* eng(CMake): Add missing POCO_SO option to enable/disable small object optimization.
* enh(CI): Run linux sanitizer with cmake, various fixes and improvements.
* fix(CMake): bundled build: ZLIB::ZLIB is already linked with Foundation, no need to link again to Poco::Zip
* fix(CI): vptr undefined sanitizer causes foundation tests to fail when linking, disable it
* chore(tests): Minor code improvements.
* fix(AsyncNotificationCenter): fix a data race with member _listsEmpty by making it atomic.
* eng(CI): Add a few more time sensitive tests to cppignore.lnx
* chore(Thread): Code updates.
* eng(CI): Add a few more time sensitive tests to cppignore.lnx
* fix(AsyncNotificationCenter): must join threads to avoid data race in dtor.
* chore(CI): Pass TSAN_OPTIONS to jobs where necessary
* chore(CI): run rests without sudo, compile with parallelism
* chore(CI): Use POCO_MINIMAL_BUILD to simplify CMake configure lines.
* chore(CI): Add 32-bit Windows VS build
* chore(CMake): Printout cmake generator platform.
* chore(CMake): linux-gcc-make-armv7l -> linux-gcc-cmake-armv7l
* chore(ci): windows-2025-msvc-cmake-32bit -> windows-2025-msvc-cmake-Win32
* chore(CI): Convert all remaining jobs to CMake.
* chore(make): Prevent building with make.
* chore(CodeQL): exclude all external code from CodeQL checks.
* chore(macOS): Set min support version to 13.3 to properly support C++20 standard.
* enh(cmake): Add option POCO_CXX20 to enable standard C++20 and related changes.
* chore(cmake): do not allow C++20 setting for compilers that do not support it properly.
* fix(NetSSL_Win): indentation.
* fix(TCPServer): continues to accept connections after stop() #4892
* fix(TCPServer): first attempt to silence TSAN #4892
* fix(TCPServer): check stopped status after poll; add TCPServerFactory::stop() and allow factory to return nullptr on connection creation request #4892
* fix(TCPServer): initialize factory stopped flag #4892
* revert(SocketImpl): atomic sock fd