Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3aeb1a4
Synchronize PAL lifecycle generations
bmehta001 Nov 19, 2026
a9c133f
Prevent undersized bundled zlib allocations
bmehta001 Nov 19, 2026
84141b4
Keep allocation regression warning-clean on older MSVC
bmehta001 Nov 19, 2026
6d46e26
Prevent offline flush from outliving storage
bmehta001 Nov 19, 2026
8a5e822
Count early uploads without weakening the manager stress test
bmehta001 Nov 19, 2026
0564675
Fail closed on decoder allocation and prefix bounds
bmehta001 Nov 19, 2026
7ef515a
Merge remote-tracking branch 'msft/bhamehta/guard-zlib-allocation' in…
bmehta001 Dec 5, 2026
c0134cf
Merge remote-tracking branch 'fork/recover-offline-flush-lifecycle' i…
bmehta001 Dec 5, 2026
0df5005
Merge remote-tracking branch 'fork/bhamehta/fix-manager-upload-wait' …
bmehta001 Dec 5, 2026
f270c49
Merge remote-tracking branch 'fork/bhamehta/fix-decoder-compress-oom'…
bmehta001 Dec 5, 2026
f5cc37e
Keep late telemetry workers safe in embedded SDK copies
bmehta001 Nov 8, 2026
b4ec224
Avoid SDK version buffer leaks when embedded libraries unload
bmehta001 Nov 9, 2026
d5e25fa
Keep batched telemetry storage within its configured limit
bmehta001 Nov 9, 2026
5540a51
Trim minizip packaging forks to keep the vendor delta focused
bmehta001 Nov 9, 2026
264e632
Fix CI
bmehta001 Dec 5, 2026
1f6916d
Make CI child-role claims exclusive
bmehta001 Dec 5, 2026
3d186ec
Call the precise system clock directly on Windows 10
bmehta001 Dec 5, 2026
3eda82d
Address storage, Windows, Apple, and minizip review findings
bmehta001 Dec 5, 2026
0a4cc2e
Preserve the final LogManager lease until teardown succeeds
bmehta001 Dec 5, 2026
66f68c6
Keep retiring managers closed to new leases and close the right C handle
bmehta001 Dec 5, 2026
8ec912a
Reject duplicate opens of a retiring C API handle
bmehta001 Dec 5, 2026
0906134
Do not hand out loggers from a retiring LogManager
bmehta001 Dec 5, 2026
15a7815
Keep the Apple embedding matrix compatible with CMake 3.15
bmehta001 Dec 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/test-embedding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,24 @@ jobs:
cmake --build build-provided-consumer --parallel 4
ctest --test-dir build-provided-consumer --output-on-failure

linux-lifetime-sanitizers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libsqlite3-dev ninja-build zlib1g-dev
- name: Configure ASan and LSan embedding regressions
run: >
cmake -G Ninja -S tests/embedding -B build-lifetimes
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DMATSDK_EMBEDDING_ADDRESS_SANITIZER=ON
-DMATSDK_SQLITE_PROVIDER=SYSTEM
-DMATSDK_ZLIB_PROVIDER=SYSTEM
- name: Build and run
run: |
cmake --build build-lifetimes --target embedding_test --parallel 4
ctest --test-dir build-lifetimes --output-on-failure

windows:
runs-on: windows-2022
steps:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/test-win-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ jobs:
with:
vs-version: '[17,)'

- name: Test bundled zlib allocation bounds (Win32)
if: matrix.arch == 'Win32' && matrix.build == 'Release' && matrix.transport == 'WinHTTP'
shell: cmd
run: |
set "VSPATH="
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSPATH=%%i"
if not defined VSPATH exit /b 1
set "PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer;%PATH%"
call "%VSPATH%\VC\Auxiliary\Build\vcvars32.bat" >nul
if errorlevel 1 exit /b 1
cl /nologo /W4 /WX /TC /DZLIB_TEST_REQUIRE_32_BIT tests\zlib-allocation-test.c /Fo"%RUNNER_TEMP%\zlib-allocation-test.obj" /Fe"%RUNNER_TEMP%\zlib-allocation-test.exe"
if errorlevel 1 exit /b 1
"%RUNNER_TEMP%\zlib-allocation-test.exe"

- name: Test ${{ matrix.transport }} ${{ matrix.arch }} ${{ matrix.build }}
shell: cmd
run: build-tests.cmd ${{ matrix.arch }} ${{ matrix.build }} "" ${{ matrix.transport }}
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ if(TARGET SQLite::SQLite3 AND NOT TARGET SQLite3::SQLite3)
matsdk_add_interface_dependency(SQLite3::SQLite3 SQLite::SQLite3)
endif()
if(MATSDK_SQLITE_PROVIDER_RESOLVED STREQUAL "SYSTEM" AND NOT TARGET SQLite3::SQLite3)
if(APPLE AND NOT MATSDK_USING_VCPKG)
if(APPLE)
matsdk_add_apple_system_library(SQLite3::SQLite3 sqlite3)
set(MATSDK_SQLITE_DEPENDENCY_KIND APPLE_SYSTEM)
else()
Expand All @@ -253,7 +253,7 @@ if(MATSDK_SQLITE_PROVIDER_RESOLVED STREQUAL "SYSTEM" AND NOT TARGET SQLite3::SQL
endif()

if(MATSDK_ZLIB_PROVIDER_RESOLVED STREQUAL "SYSTEM" AND NOT TARGET ZLIB::ZLIB)
if(APPLE AND NOT MATSDK_USING_VCPKG)
if(APPLE)
matsdk_add_apple_system_library(ZLIB::ZLIB z)
set(MATSDK_ZLIB_DEPENDENCY_KIND APPLE_SYSTEM)
else()
Expand Down
5 changes: 5 additions & 0 deletions cmake/MatsdkOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ option(MATSDK_BUILD_AZMON
"Build Azure Monitor / Application Insights support" ON)
option(MATSDK_BUILD_APPLE_HTTP
"Build the Apple-native HTTP client" "${APPLE}")
set(MATSDK_APPLE_HTTP_DELEGATE_CLASS "MATStreamingSessionDelegate" CACHE STRING
"Private Objective-C class name for the Apple HTTP session delegate")
if(NOT MATSDK_APPLE_HTTP_DELEGATE_CLASS MATCHES "^[A-Za-z_][A-Za-z0-9_]*$")
message(FATAL_ERROR "MATSDK_APPLE_HTTP_DELEGATE_CLASS must be a C identifier.")
endif()
option(MATSDK_USE_WININET
"Use WinInet instead of WinHTTP as the Win32 desktop HTTP client" OFF)
option(MATSDK_DISABLE_LOGGING
Expand Down
16 changes: 15 additions & 1 deletion docs/embedding-with-cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ Recommended packaged-library policy:
| Android | `MINIMAL`, or `NONE` with Room | `VENDORED` | Java/JNI by default |

Apple's SQLite and zlib entries are system libraries: consumers link them but
do not ship private copies. A Linux host such as Foundry Local that already
do not ship private copies, including when a vcpkg toolchain is active. Existing
caller-provided canonical targets still take precedence. A Linux host such as Foundry Local that already
standardizes on libcurl/OpenSSL should provide `CURL::libcurl` and select
`MATSDK_CURL_PROVIDER=SYSTEM`; other self-contained Linux consumers can use the
SDK's pinned curl/mbedTLS build.
Expand All @@ -71,6 +72,19 @@ consumer must set `skipSqliteInitAndShutdown` to `"true"` and leave SQLite's
process-wide lifetime to the host. This is the required configuration for
coexisting Apple libraries that all link the system `libsqlite3`.

When independently embedded SDK copies coexist in an Apple process, choose a
different private HTTP delegate class name for each copy before adding the SDK:

```cmake
set(MATSDK_APPLE_HTTP_DELEGATE_CLASS MyProductMATStreamingSessionDelegate
CACHE STRING "" FORCE)
```

The default remains `MATStreamingSessionDelegate`. Objective-C class names are
process-global even when C++ symbols are hidden. This setting affects only the
Apple HTTP implementation and does not propagate to consumers or rename public
Objective-C wrapper classes.

## Non-vcpkg dependency selection

When the CPP11 PAL uses the curl HTTP transport outside vcpkg, the SDK normally
Expand Down
5 changes: 5 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ else()
message(STATUS "Building static SDK library")
add_library(mat STATIC ${SRCS})
endif()
if(APPLE AND PAL_IMPLEMENTATION STREQUAL "CPP11" AND (MATSDK_BUILD_APPLE_HTTP OR MATSDK_PLATFORM_IOS))
# Objective-C class names are process-global, even with hidden symbol visibility.
target_compile_definitions(mat PRIVATE
"MATStreamingSessionDelegate=${MATSDK_APPLE_HTTP_DELEGATE_CLASS}")
endif()
target_link_libraries(mat PRIVATE
$<BUILD_INTERFACE:matsdk_build_options>
$<BUILD_INTERFACE:matsdk_internal_config>)
Expand Down
8 changes: 6 additions & 2 deletions lib/api/AuthTokensController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "AuthTokensController.hpp"
#include "ILogManager.hpp"
#include "utils/Utils.hpp"
#include <new>

namespace MAT_NS_BEGIN {

Expand All @@ -24,8 +25,11 @@ namespace MAT_NS_BEGIN {

std::mutex& AuthTokensController::GetMutex()
{
static std::mutex mutex;
return mutex;
// Like GetPAL(), this lock must survive late upload workers.
using AuthMutex = std::mutex;
alignas(AuthMutex) static unsigned char storage[sizeof(AuthMutex)];
static AuthMutex* mutex = ::new (storage) AuthMutex;
return *mutex;
}

status_t AuthTokensController::SetTicketToken(TicketType type, char const* tokenValue)
Expand Down
Loading
Loading