Commit Graph

6231 Commits

Author SHA1 Message Date
Alex Fabijanic
c39a1767d7 fix(PollSet): prevent polling after destruction #5161 2026-01-11 00:55:23 -06:00
Alex Fabijanic
e56fd98e66 fix(PollSet): exit early on poll error when closed #5161 2026-01-10 23:47:47 -06:00
Alex Fabijanic
9779e940b3 chore: add missing include 2026-01-10 22:43:01 -06:00
Alex Fabijanic
f40011081c fix(Pipe): not thread-safe #5161 2026-01-10 22:31:19 -06:00
Alex Fabijanic
5ea95958b2 test(ci): sanitized builds to see intel mac fail reason 2026-01-10 19:47:45 -06:00
Alex Fabijanic
66ff3eb793 fix(test): make nc static 2026-01-10 19:12:07 -06:00
Alex Fabijanic
4476925939 fic(NotificationCenter): lock order inversion deadlock #5159 2026-01-10 17:26:33 -06:00
Aleksandar Fabijanic
17864c39a8 Change lock type to ScopedWriteLock in NotificationCenter (#5158) 2026-01-10 19:50:41 +01:00
Matej Kenda
4d79dd3895 fix(Modules): libModules.so --> libPocoModules.so 2026-01-07 07:53:45 +01:00
Aleksandar Fabijanic
6d602ea6b3 5150 reactor sock remove (#5151)
* 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>
2026-01-06 19:18:31 +01:00
Friedrich Wilckens
7f03ba5ba4 Modernize Poco::Util and clean up some code duplications (#5153)
* 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>
2026-01-06 18:26:20 +01:00
Matej Kenda
f9deedb3e2 MongoDB document performance header cleanup (#5154)
* enh(MongoDB): Improved performance of inserts and document/array access: less memory and faster.

* chore(MongoDB): cleanup of includes.
2026-01-06 12:15:17 +01:00
Aleksandar Fabijanic
bd09152aff feat(ODBC): nix shells for mssql and oracle #5144 (#5145)
* feat(ODBC): nix shells for mssql and oracle #5144

* fix(cmake): not using cppignore #5146

* fix(Data/ODBC): Improve Nix CI container startup and debugging

Oracle (oracle.nix):
- Add --shm-size=1g for Oracle container (requires 1GB shared memory)
- Add container state verification before exec commands
- Add proper error handling with container log output on failure
- Add pre-flight checks in build_and_test to verify container running
- Add Podman environment info for CI debugging
- Add progress indicators during Oracle startup wait
- Exit with error in CI mode if container fails to start

MSSQL (mssql.nix):
- Add ODBCINSTINI environment variable
- Add sync command to flush ODBC configs to disk
- Add odbcinst verification commands

Temporarily disable all ci except nix #5144

* try newer oracle version

* use ubuntu 24.04 for nix ci (podman related)

* chore(c): restore ci.yml

* Update Data/ODBC/oracle.nix

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Data/ODBC/oracle.nix

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Data/ODBC/mssql.nix

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Data/ODBC/oracle.nix

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(odbc): verify oracle downloads #5144

* chore(doc): update nix documentation #5144

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-05 05:13:58 +01:00
Arthur Chan
539de0d0ca oss-fuzz: (#5149) 2026-01-05 05:12:52 +01:00
Aleksandar Fabijanic
e45d2067cb fix(Net): TSAN warnings #5147 (#5148) 2026-01-05 05:10:47 +01:00
Aleksandar Fabijanic
ebec641893 fix(VarHolder): Date/Time diagnostics not implemented #5142 (#5143) 2025-12-28 03:22:13 +01:00
Aleksandar Fabijanic
0e1ba0b780 fix(Data): Refactor ODBC tests and fix testReconnect TypeInfo caching… (#5140)
* 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
2025-12-24 14:42:24 +01:00
Matej Kenda
38eb412c9c fix: Move bundled dependency symlinks to library-specific .gitignore files #5048 2025-12-23 18:52:31 +01:00
Matej Kenda
18c49ed9c8 fix(Foundation): Replace timing-dependent tests with condition-based waiting (#5137) 2025-12-23 18:32:05 +01:00
Matej Kenda
86500e6987 chore(cmake): ENABLE_COMPILER_WARNINGS sets compiler options only for Poco code, not dependent libraries. 2025-12-23 15:58:27 +01:00
Aleksandar Fabijanic
dcaa15af6b Feature native thread info (#5135)
* 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>
2025-12-23 14:40:18 +01:00
Friedrich Wilckens
7313ccfb27 Typehandler simplification and other modernizations in Poco::Data (#5136)
* 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>
2025-12-23 11:01:37 +01:00
Aleksandar Fabijanic
1850dc16aa Benchmark and FastLogger (#5081)
* 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
2025-12-22 21:06:43 +01:00
Matej Kenda
1461ec618b fix: Resolve compiler warnings and fix potential bugs (#5130) 2025-12-22 15:27:11 +01:00
Alex Fabijanic
5ad3c41e20 fix: .gitignore symlinks; XML Makefile wrong pattern #5048 2025-12-20 12:25:03 -06:00
Alex Fabijanic
de3d46a2f3 fix(SQLite): Adapt makefiles for external dependencies #5048 2025-12-20 12:23:11 -06:00
Alex Fabijanic
3d71183702 fix(SQLite): Remove redundant error messages #5115 2025-12-20 12:21:18 -06:00
Alex Fabijanic
a8361f070d fix(PCRE): fails to compile with clang/c++20 #5131 2025-12-20 11:51:35 -06:00
Günter Obiltschnig
b24d9ff0b8 ULID Support (#5129) 2025-12-19 19:58:33 +01:00
Matej Kenda
5bbd542b6b fix(Crypto): Prevent stdin password prompt when loading protected key (#4627) (#5128) 2025-12-18 17:25:30 +01:00
Matej Kenda
8410eb1a6f fix(Foundation): Reject trailing garbage in DateTimeParser (#5030) (#5117) 2025-12-18 16:38:20 +01:00
Matej Kenda
0562fc44fb fix(deps): Remove pcre2 config.h symlink for Windows compatibility 2025-12-18 14:31:42 +01:00
Matej Kenda
8057019f85 fix(Net): Handle negative available() return in receiveBytes (#4537)
Co-Authored-By: Andrew Auclair <mightymalakai33@gmail.com>
2025-12-18 12:59:35 +01:00
Matej Kenda
752343adc7 fix(Net): Detect incomplete chunked transfer encoding (#5032) 2025-12-18 10:59:49 +01:00
Matej Kenda
bce1c89ae0 fix(Data/PostgreSQL): Map UUIDOID to FDT_UUID instead of FDT_BLOB (#4924) 2025-12-18 10:59:11 +01:00
Matej Kenda
e8745d0f2d fix(Foundation): Fix FileChannel purge race with compression (#4848) 2025-12-18 10:58:45 +01:00
Matej Kenda
1c4fa8cfe4 fix(Foundation): Fix deadlock in NotificationCenter removeObserver (#4970) 2025-12-18 10:58:32 +01:00
Matej Kenda
3a6f5b8f12 enh(Crypto,NetSSL): Drop support for OpenSSL < 1.1.1 (#3739) 2025-12-18 10:56:41 +01:00
Matej Kenda
1e183e1402 fix(Util): Add [[nodiscard]] to createView/createLocalView (#4844) 2025-12-18 10:53:41 +01:00
Matej Kenda
7a03cafbb3 fix(Data): Add using AbstractBinder::bind to prevent hidden virtual warning (#4900) 2025-12-18 10:53:24 +01:00
Matej Kenda
5363e3d38b enh(Foundation): Improve Windows version detection using RtlGetVersion (#4932) 2025-12-18 09:58:25 +01:00
Matej Kenda
26054b8f93 fix(Net): Make Socket::select() deprecation conditional (#5055) 2025-12-18 09:57:59 +01:00
Matej Kenda
b44576a4df feat(Redis): Add connect/disconnect/error notifications to Client (#5104) 2025-12-18 07:35:08 +01:00
Matej Kenda
1ed9388488 fix(Zip): Improve parsing of non-standard ZIP archives 2025-12-18 06:47:29 +01:00
SmileGobo
abfd684c03 fix(Net): Dispatch ErrorNotification to socket-specific handler only 2025-12-18 00:38:33 +01:00
Xinyu Han
64e759cf98 enh(Foundation): Allow passing SharedLibrary flags to ClassLoader
Co-Authored-By: Aleksandar Fabijanic <alex@pocoproject.org>
2025-12-17 23:41:05 +01:00
Matej Kenda
7addcfbc81 fix: Resolve compiler warnings across multiple modules 2025-12-17 18:06:59 +01:00
Matej Kenda
b79b07c308 fix: Resolve compiler warnings in Net, Zip, and Foundation modules (#5092) 2025-12-17 07:53:12 +01:00
Matej Kenda
5bbdcf0526 enh(expat): Upgrade to expat 2.7.3 2025-12-17 06:56:14 +01:00
Matej Kenda
0631ae1b38 fix(Net): Use MessageHeader::quote() for boundary in HTMLForm 2025-12-17 06:55:53 +01:00