Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0c905b2
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 11, 2026
1de72ea
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 13, 2026
308f165
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 13, 2026
7e4161c
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 13, 2026
e5830f2
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 15, 2026
33b954c
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 15, 2026
2e8c436
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 15, 2026
bbae086
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 15, 2026
441fa38
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 15, 2026
10af6b8
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 15, 2026
ee02b0e
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 15, 2026
00aac3d
RDK-60476: Update L1 testcases for fork elimination
yogeswaransky Feb 16, 2026
93d8643
RDK-60476: Update L1 testcases for fork elimination
yogeswaransky Feb 16, 2026
f18d825
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 17, 2026
95a0866
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 17, 2026
ca3332e
RDK-60476: Update L1 testcases for fork elimination
yogeswaransky Feb 18, 2026
87dbeb0
RDK-60476: Update L1 testcases for fork elimination
yogeswaransky Feb 18, 2026
c47578c
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 19, 2026
2a05bdb
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 19, 2026
4944d6c
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 19, 2026
3b3c9f9
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 20, 2026
ce59899
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 21, 2026
f438b62
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 22, 2026
f9b0a20
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 22, 2026
6aab5c4
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 22, 2026
24f8c4c
Merge branch 'topic/RDK-60476' of https://github.com/rdkcentral/telem…
yogeswaransky Feb 22, 2026
df83611
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 23, 2026
cef5a34
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 23, 2026
2d82850
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 23, 2026
839cd93
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 23, 2026
2611f12
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 23, 2026
7420d45
RDK-60476: Create xconf-dcm-response.json
yogeswaransky Feb 23, 2026
3e9e720
RDK-60476: Update L2-tests.yml
yogeswaransky Feb 23, 2026
82172ba
Merge pull request #273 from rdkcentral/develop
yogeswaransky Feb 23, 2026
d1970b7
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 23, 2026
20c01ec
RDK-60488: Delete test/test-artifacts/mockxconf/xconf-dcm-response.json
yogeswaransky Feb 23, 2026
7eceb14
RDK-60488: Delete test/test-artifacts/mockxconf/xconf-dcm-response2.json
yogeswaransky Feb 23, 2026
13013fb
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 24, 2026
68f8375
Merge branch 'topic/RDK-60476' of https://github.com/rdkcentral/telem…
yogeswaransky Feb 24, 2026
dd81303
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 24, 2026
b4def74
Adding design diagrams and flow diagrams for easy understanding
shibu-kv Feb 24, 2026
7baf0a9
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 26, 2026
482172e
Merge branch 'topic/RDK-60476' of https://github.com/rdkcentral/telem…
yogeswaransky Feb 26, 2026
dd224b6
RDK-60476: Update L1 and L2 testcases for fork elimination
yogeswaransky Feb 26, 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
40 changes: 39 additions & 1 deletion source/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ AM_CFLAGS += -DCCSP_INC_no_asm_sigcontext_h

ACLOCAL_AMFLAGS = -I m4

bin_PROGRAMS = telemetry2_0
bin_PROGRAMS = telemetry2_0 curl_leak_test

telemetry2_0_SOURCES = telemetry2_0.c
telemetry2_0_CFLAGS = -DFEATURE_SUPPORT_RDKLOG -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
Expand Down Expand Up @@ -102,6 +102,44 @@ telemetry2_0_CPPFLAGS += -I${top_srcdir}/source/privacycontrol
telemetry2_0_LDADD += ${top_builddir}/source/privacycontrol/libt2thunder_privacycontrol.la
endif

# FIX: Add curl_leak_test binary configuration
curl_leak_test_SOURCES = test/leak_detection/curl_leak_test.c
curl_leak_test_CFLAGS = -DFEATURE_SUPPORT_RDKLOG -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
curl_leak_test_CPPFLAGS = -fPIC -I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/dbus-1.0 \
-I${PKG_CONFIG_SYSROOT_DIR}$(libdir)/dbus-1.0/include \
-I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/ \
-I${top_srcdir}/include \
-I${top_srcdir}/source/protocol/http \
-I${top_srcdir}/source/commonlib \
-I${top_srcdir}/source/utils \
-I${top_srcdir}/source/xconf-client

curl_leak_test_LDFLAGS = -lcurl -lpthread

# Add conditional flags for curl_leak_test based on telemetry configuration
if IS_LIBRDKCERTSEL_ENABLED
curl_leak_test_LDFLAGS += -lRdkCertSelector
curl_leak_test_CFLAGS += $(LIBRDKCERTSEL_FLAG)
curl_leak_test_CFLAGS += -DLIBRDKCERTSEL_BUILD
endif

if IS_LIBRDKCONFIG_ENABLED
curl_leak_test_LDFLAGS += -lrdkconfig
curl_leak_test_CFLAGS += $(LIBRDKCONFIG_FLAG)
curl_leak_test_CFLAGS += -DLIBRDKCONFIG_BUILD
endif

if RDKLOGGER_ENABLE
curl_leak_test_LDFLAGS += -lrdkloggers
curl_leak_test_CFLAGS += -DRDK_LOGGER
endif

# Link against the http library that contains multicurlinterface.c
curl_leak_test_LDADD = ${top_builddir}/source/protocol/http/libhttp.la \
${top_builddir}/source/utils/libt2utils.la \
${top_builddir}/source/xconf-client/libxconfclient.la \
${top_builddir}/source/bulkdata/libbulkdata.la

gtest:
make -C test

Expand Down
3 changes: 0 additions & 3 deletions source/protocol/http/multicurlinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ static size_t httpGetCallBack(void *responseBuffer, size_t len, size_t nmemb,
size_t realsize = len * nmemb;
curlResponseData* response = (curlResponseData*) stream;

// FIX: Check for NULL stream to prevent crashes
if (!response)
{
T2Error("httpGetCallBack: NULL stream parameter\n");
Expand All @@ -146,8 +145,6 @@ static size_t httpGetCallBack(void *responseBuffer, size_t len, size_t nmemb,
if (!ptr)
{
T2Error("%s:%u , T2:memory realloc failed\n", __func__, __LINE__);
// On realloc failure, abort the transfer to avoid silently dropping data
// Return 0 to signal an error to curl
return 0;
}
response->data = ptr;
Expand Down
227 changes: 227 additions & 0 deletions source/test/leak_detection/DEVICE_INTEGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
# Curl Memory Leak Test - Device Integration

## Overview
This memory leak detection tool is now integrated with the main telemetry build system and will be compiled as `curl_leak_test` alongside `telemetry2_0` for device deployment.

## Building with Telemetry

### 1. Standard Telemetry Build Process
```bash
# Navigate to telemetry root directory
cd c:\Users\yk185\docker\60476\telemetry

# Standard autotools build (this will now include curl_leak_test)
./configure [your_normal_telemetry_configure_flags]
make
make install
```

### 2. Build Output
After building, you'll have both binaries:
- `/usr/bin/telemetry2_0` - Main telemetry daemon
- `/usr/bin/curl_leak_test` - Memory leak detection tool

### 3. Configure Flags for curl_leak_test
The tool automatically inherits all telemetry build flags:

```bash
# Basic build
./configure

# With mTLS support
./configure --enable-rdkcertsel

# With RDKB support
./configure --enable-rdkb-support

# With RDK logging
./configure --enable-rdklogger

# Full featured build
./configure --enable-rdkcertsel --enable-rdkb-support --enable-rdklogger
```

## Device Deployment

### 1. Install on Device
```bash
# Copy to device (same as telemetry2_0)
scp curl_leak_test root@device_ip:/usr/bin/
chmod +x /usr/bin/curl_leak_test
```

### 2. Run on Device
```bash
# Basic test (10 iterations, 2 second intervals)
curl_leak_test 10 2

# Continuous monitoring (infinite iterations)
curl_leak_test 0 5

# Quick test (5 iterations, 1 second intervals)
curl_leak_test 5 1

# Background monitoring with logging
nohup curl_leak_test 100 10 > /tmp/curl_leak_test.log 2>&1 &
```

### 3. Device-Specific Usage

#### Check Device Connectivity First
```bash
# Test basic connectivity before running curl_leak_test
ping -c 3 8.8.8.8
curl -v https://httpbin.org/get

# If external connectivity fails, modify test URLs in source
```

#### Monitor Device Resources
```bash
# Monitor while test runs
watch -n 5 "ps aux | grep curl_leak_test; echo; cat /proc/meminfo | head -5"

# Check for memory growth patterns
tail -f /proc/`pgrep curl_leak_test`/status | grep -E "(VmRSS|VmSize)"
```

## Integration Benefits

### 1. Same Build Environment
- Uses exact same compiler flags as telemetry2_0
- Links against same libraries (libhttp.la, libxconfclient.la)
- Inherits all conditional compilation flags
- No version mismatches

### 2. Real mTLS Testing
- When built with `--enable-rdkcertsel`, tests actual mTLS implementation
- Uses device certificates and configuration
- Tests real-world authentication scenarios

### 3. Device Network Environment
- Tests in actual device network conditions
- Uses device DNS, routing, firewall rules
- Tests with device-specific SSL/TLS configuration

## Memory Leak Analysis on Device

### 1. Expected Output on Device
```
=== Curl Memory Leak Test Application ===
Using max iterations: 10
Using interval: 2 seconds

Initial memory usage:
VmSize: 5432 kB | VmRSS: 2345 kB

[Iteration 1] Testing HTTP POST...
[DEBUG] http_pool_post ; POST url = https://httpbin.org/post
[Iteration 1] POST request successful

--- Memory Usage at iteration 5 ---
VmSize: 5438 kB | VmRSS: 2347 kB

=== Memory Usage Summary ===
Initial - VmSize: 5432 kB | VmRSS: 2345 kB
Peak - VmSize: 5441 kB | VmRSS: 2350 kB
Final - VmSize: 5439 kB | VmRSS: 2348 kB
Growth - VmSize: +7 kB | VmRSS: +3 kB

✓ Memory usage appears stable (growth: 3 kB)
```

### 2. Interpreting Device Results
- **Growth < 50KB**: Normal for device environment
- **Growth 50-500KB**: Monitor across multiple test runs
- **Growth > 500KB**: Investigate potential leak
- **Consistent growth pattern**: Likely memory leak

### 3. Device Debugging Commands
```bash
# Real-time memory monitoring
watch -n 2 "grep -E 'VmRSS|VmSize' /proc/\`pgrep curl_leak_test\`/status"

# Check for memory fragments
cat /proc/`pgrep curl_leak_test`/smaps | grep -E "(Rss|Pss|Private)"

# Monitor network connections
netstat -tupln | grep curl_leak_test

# Check file descriptors
ls -la /proc/`pgrep curl_leak_test`/fd/ | wc -l
```

## Troubleshooting on Device

### 1. Build Issues
```bash
# If build fails, check autotools regeneration
autoreconf -fiv
./configure [flags]
make clean && make
```

### 2. Network Issues on Device
```bash
# Test basic device connectivity
ping -c 3 8.8.8.8
nslookup httpbin.org

# Check device firewall
iptables -L | grep OUTPUT

# Test with local URLs if external blocked
# Modify TEST_URL in source to use local server
```

### 3. Permission Issues
```bash
# Ensure proper permissions
chmod +x /usr/bin/curl_leak_test
chown root:root /usr/bin/curl_leak_test
```

## Customization for Device Environment

### 1. Modify Test URLs for Internal Testing
```c
// In curl_leak_test.c, change these for device-specific endpoints
#define TEST_URL "http://internal-server:8080/post"
#define TEST_GET_URL "http://internal-server:8080/get"
```

### 2. Device-Specific Configuration
```bash
# Set device-specific environment variables
export T2_CONNECTION_POOL_SIZE=1 # For resource-constrained devices
export CURL_CA_BUNDLE=/etc/ssl/certs/ca-bundle.crt
```

### 3. Integration with Device Scripts
```bash
#!/bin/bash
# Device monitoring script
ITERATIONS=50
INTERVAL=10
LOG_FILE="/tmp/memory_leak_$(date +%Y%m%d_%H%M%S).log"

echo "Starting curl memory leak test on device"
curl_leak_test $ITERATIONS $INTERVAL > $LOG_FILE 2>&1

# Analyze results
GROWTH=$(grep "Growth.*VmRSS:" $LOG_FILE | tail -1 | awk '{print $6}' | sed 's/[+kB]//g')
if [ "$GROWTH" -gt 100 ]; then
echo "WARNING: Memory growth detected: ${GROWTH}kB"
# Send alert or upload log
fi
```

## Continuous Integration

The tool is now part of the telemetry build pipeline, so:
- It builds automatically with telemetry CI/CD
- Uses same build flags and environment
- Can be deployed alongside telemetry updates
- Maintains version synchronization

This integration ensures your memory leak testing tool is always available on devices and stays in sync with the telemetry implementation it's testing.
Loading
Loading