Repository navigation
RDKB-63850: Migrate Upload Dumps Functionality from Shell Script to C [Extender] #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gomathishankar37
wants to merge
15
commits into
develop
Choose a base branch
from
topic/RDKB-63850
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
df656ae
RDKB-63850: Migrate Upload Dumps Functionality from Shell Script to C…
gomathishankar37 14bfea8
Address build failure & L1 failure
gomathishankar37 d92dba1
Merge branch 'develop' into topic/RDKB-63850
gomathishankar37 15d3d3a
Add inotify watcher to src
gomathishankar37 8ef7082
Add system() return handling
gomathishankar37 a84ec9b
Add system() return handling
gomathishankar37 b26a322
Update EVP API compatible for OpenSSL in Extender
gomathishankar37 ac7101f
Add bound checks for system and v_secure_system calls
gomathishankar37 de45a68
Address review comments
gomathishankar37 8041ada
Update model_num and partnerId parsing for extender
gomathishankar37 259a289
Fix build error
gomathishankar37 6e3e867
Add url buffer for Extender
gomathishankar37 f81fde8
Update core sleep logic
gomathishankar37 bf72f56
Revert "Update core sleep logic"
gomathishankar37 6f3dd2f
Update URL Buffer for extender
gomathishankar37 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,76 +1,54 @@ | ||
| # Crashupload C Implementation - Skeleton Code | ||
| # Crashupload C source (`c_sourcecode/`) | ||
|
|
||
| This directory contains skeleton C implementation for the crashupload migration from shell scripts to C. | ||
| This directory is the autotools tree for the C binaries: | ||
|
|
||
| ## Architecture | ||
| - **crashupload** — dump discovery, archive, rate-limit, and upload (`src/`) | ||
| - **inotify-minidump-watcher** — directory watcher that starts upload on matching file creates (`watcher/`) | ||
|
|
||
| Based on **optimized design** from: | ||
| - `docs/migration/hld/updateduploadDumps-hld.md` | ||
| - `docs/migration/lld/updateduploadDumps-lld.md` | ||
| - `docs/migration/diagrams/flowcharts/optimizeduploadDumps-flowcharts.md` | ||
| - `docs/migration/diagrams/sequence/updateuploadDumps-sequence.md` | ||
| - `docs/migration/requirements/uploadDumps-requirements.md` | ||
|
|
||
| ## Structure | ||
| ## Layout | ||
|
|
||
| ``` | ||
| c_sourcecode/ | ||
| ├── common/ # Common type definitions, constants, errors | ||
| │ ├── types.h | ||
| │ ├── constants.h | ||
| │ └── errors.h | ||
| ├── src/ # Source code | ||
| │ ├── main.c # Main entry point (7-step optimized flow) | ||
| │ ├── init/ # Consolidated initialization | ||
| │ ├── config/ # Configuration management | ||
| │ ├── platform/ # Platform abstraction | ||
| │ ├── core/ # Core processing modules | ||
| │ │ ├── scanner.* # Dump file scanner | ||
| │ │ ├── archive_smart.* # Smart archive creator | ||
| │ │ ├── upload_typeaware.* # Type-aware upload | ||
| │ │ └── ratelimit_unified.* # Unified rate limiter | ||
| │ ├── utils/ # Utility modules | ||
| │ │ ├── prerequisites.* # Combined network+time check | ||
| │ │ ├── privacy.* # Unified privacy check | ||
| │ │ ├── cleanup_batch.* # Batch cleanup | ||
| │ │ ├── lock_manager.* # Process locking | ||
| │ │ └── logger.* # Logging | ||
| │ └── Makefile # Build system | ||
| ├── configure.ac | ||
| ├── Makefile.am | ||
| ├── common/ # Shared types, constants, errors | ||
| ├── include/ # Public headers used by crashupload | ||
| ├── src/ # crashupload binary | ||
| └── watcher/ # inotify-minidump-watcher binary | ||
| ``` | ||
|
|
||
| ## Key Optimizations | ||
|
|
||
| 1. **Consolidated Initialization** - Single `system_initialize()` call (3 steps → 1) | ||
| 2. **Combined Prerequisites** - `prerequisites_wait()` checks network + time together | ||
| 3. **Unified Privacy** - `privacy_uploads_blocked()` combines opt-out + privacy mode | ||
| 4. **Smart Archive** - Direct compression first, /tmp fallback if needed | ||
| 5. **Type-Aware Upload** - Minidump (5 retries, 3s delay) vs Coredump (3 retries, 10s delay) | ||
| 6. **Unified Rate Limit** - Single check for recovery + 10/10min limit | ||
| 7. **Batch Cleanup** - Single directory scan for all cleanup operations | ||
| ## Build | ||
|
|
||
| ## Building | ||
| From this directory: | ||
|
|
||
| ```bash | ||
| cd src | ||
| autoreconf -i | ||
| ./configure | ||
| make | ||
| make install | ||
| ``` | ||
|
|
||
| ## Status | ||
| `make` produces: | ||
|
|
||
| - `src/crashupload` | ||
| - `watcher/inotify-minidump-watcher` | ||
|
|
||
| Both are `bin_PROGRAMS` and install to `$prefix/bin` (typically `/usr/bin` on device images). | ||
|
|
||
| **SKELETON**: All files contain function signatures and data structures from the design documents, but function bodies need implementation. Each TODO comment indicates what needs to be implemented. | ||
| Yocto/RDK builds pass extra `CFLAGS`/`LDFLAGS` (for example `-DYOCTO_BUILD` and `-lsecure_wrapper`). Do not hard-code those in a way that breaks the existing recipe flags. | ||
|
|
||
| ## Next Steps | ||
| Local coverage-style builds used by L1 go through `crashupload/cov_build.sh`, which configures and installs both binaries. | ||
|
|
||
| 1. Implement function bodies following TODO markers | ||
| 2. Add unit tests (GTest framework recommended) | ||
| 3. Build and test incrementally | ||
| 4. Validate against shell script behavior | ||
| 5. Performance test on target platforms | ||
| ## Tests | ||
|
|
||
| L1 (GTest) lives in `../unittest/`. Watcher tests are `watcher_gtest` and are included in `../run_ut.sh`. | ||
|
|
||
| ```bash | ||
| cd .. | ||
| ./run_ut.sh | ||
| ``` | ||
|
|
||
| ## Performance Targets | ||
| ## Notes | ||
|
|
||
| Based on optimized design: | ||
| - Startup: 100-120ms (vs 150-200ms standard) | ||
| - Memory: 6-8MB (vs 8-10MB standard) | ||
| - Binary: ~35KB (vs ~45KB standard) | ||
| - Decision points: 22 (vs 35 standard) - 37% reduction | ||
| - `src/` and `watcher/` are separate subdirectories so crashupload link flags (curl, rbus, archive, telemetry) are not applied to the watcher. | ||
| - The watcher only links `libsecure_wrapper`, matching the legacy `crashupload/src/Makefile`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,3 +76,5 @@ crashupload_SOURCES += \ | |
|
|
||
| # Clean up | ||
| CLEANFILES = *~ | ||
|
|
||
| EXTRA_DIST = README.md | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # crashupload (`src/`) | ||
|
|
||
| This directory is the source for the **crashupload** binary. It is built by autotools from `c_sourcecode/` (`SUBDIRS = src watcher`). | ||
|
|
||
| ## What it does | ||
|
|
||
| `crashupload` is the C replacement path for dump packaging and upload. The entry point is `main.c`, which initializes logging/config/platform, waits for prerequisites, takes the process lock, scans for dumps, archives, uploads, rate-limits, and cleans up. | ||
|
|
||
| ## Modules | ||
|
|
||
| | Path | Role | | ||
| |------|------| | ||
| | `main.c` | Process entry and main flow | | ||
| | `init/` | Consolidated system initialization | | ||
| | `config/` | Runtime configuration load | | ||
| | `platform/` | Device/platform specifics | | ||
| | `scanner/` | Dump file discovery | | ||
| | `archive/` | Archive creation | | ||
| | `upload/` | Upload to crash portal | | ||
| | `ratelimit/` | Upload rate limiting | | ||
| | `rfcInterface/` | RFC parameter access | | ||
| | `rbusInterface/` | RBUS init/uninit | | ||
| | `t2Interface/` | Telemetry markers | | ||
| | `utils/` | Logger, locks, files, prerequisites, batch cleanup | | ||
|
|
||
| Headers used across modules also live in `../common/` and `../include/`. | ||
|
|
||
| ## Build | ||
|
|
||
| Do not run a standalone Makefile in this folder. Build from the parent tree: | ||
|
|
||
| ```bash | ||
| cd .. | ||
| autoreconf -i | ||
| ./configure | ||
| make | ||
| ``` | ||
|
|
||
| The binary is `src/crashupload` (installed as `/usr/bin/crashupload`). | ||
|
|
||
| ## Tests | ||
|
|
||
| L1 coverage for these sources is under `../../unittest/` (`*_gtest` binaries). Run from the crashupload repo root: | ||
|
|
||
| ```bash | ||
| ./run_ut.sh | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.