Uh oh!
There was an error while loading. Please reload this page.
[MM] Change to the common resource manager - #567
Conversation
This patch updates the mm resource manager. - Origin: https://review.tizen.org/gerrit/#/c/platform/core/api/machine-learning/+/318887/ Change-Id: I108b500c796a8899e6d582346a184d9e6a8136c4 Signed-off-by: YoungHun Kim <yh8004.kim@samsung.com> Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
taos-ci
commented
Oct 11, 2024
📝 TAOS-CI Version: 1.5.20200925. Thank you for submitting PR #567. Please a submit 1commit/1PR (one commit per one PR) policy to get comments quickly from reviewers. Your PR must pass all verificiation processes of cibot before starting a review process from reviewers. If you are new member to join this project, please read manuals in documentation folder and wiki page. In order to monitor a progress status of your PR in more detail, visit http://ci.nnstreamer.ai/. |
| # 3. Meson : ./meson.build | ||
| # 4. Android : ./java/android/nnstreamer/src/main/jni/Android.mk | ||
| Version: 1.8.6 | ||
| Version: 1.1.0 |
There was a problem hiding this comment.
The rpm version is changed! why?
| } | ||
| status = ml_tizen_mm_res_allocate(p->resources, res_type); | ||
| if (status != ML_ERROR_NONE) { | ||
| _ml_loge("Faied to allocate resource."); |
| for (type = RES_TYPE_VIDEO_DECODER; type < RES_TYPE_MAX; type++) { | ||
| ret = ml_tizen_mm_res_deallocate(mm_handle, type); | ||
| if (ret != ML_ERROR_NONE) { | ||
| _ml_loge("Fail to deallocate resoure [type %d].", type); |
| @@ -23,7 +23,7 @@ if (get_option('enable-tizen')) | |||
| nns_capi_deps += dependency('mm-camcorder') | |||
| if (tizenVmajor >= 5) | |||
There was a problem hiding this comment.
| if (tizenVmajor >= 5) | |
| if (tizenVmajor >= 9) |
| @@ -110,7 +110,8 @@ BuildRequires: pkgconfig(capi-privacy-privilege-manager) | |||
| %endif | |||
| BuildRequires: pkgconfig(mm-camcorder) | |||
| %if 0%{tizen_version_major} >= 5 | |||
There was a problem hiding this comment.
5 -> 9. Or make an another if phrase ?
| base = g_path_get_basename(contents); | ||
| if (g_strlcpy(appid, base, size) >= size) | ||
| LOGE("string truncated"); |
There was a problem hiding this comment.
Return error or change log level to warning?
| _ml_logi("app id : %s type %d", resources->rci.app_id, type); | ||
| memset(&request_resources, 0x0, sizeof(rm_category_request_s)); | ||
| device = &resources->devices[type]; |
There was a problem hiding this comment.
Isn't validation of device necessary?
myungjoo-bot
left a comment
There was a problem hiding this comment.
Automated review (transcribed from an AI review agent's report; please verify before acting).
Summary: This PR migrates from mm-resource-manager to the Tizen 9 common resource manager and removes the pipe_h->resources hash table / cleanup_resource machinery. Current main already contains this migration (0ed5144 [Tizen/C-Api] update res-mgr changes, version-gated tizenVmajor >= 9 / >= 5), and git merge-tree reports content conflicts in all 5 touched files (gh shows CONFLICTING). I recommend closing this PR or rebasing it down to whatever delta is still missing from main.
Independent of the conflict, the PR-side code has the following issues:
- [High] Resource/handle leak on every pipeline destroy —
c/src/ml-api-inference-pipeline.c:cleanup_resource()(the only caller ofrelease_tizen_resource) is deleted andml_pipeline_destroyno longer touchesp->resources(PR line ~1131)._ml_tizen_release_resource()becomes dead code, so therm_registerregistration, the exclusively allocated camera,mm_handle, and the DPM callback leak per pipeline until process exit. Fix: callrelease_tizen_resource (p->resources, TIZEN_RES_MM); p->resources = NULL;inml_pipeline_destroy(or keep the hash-table design asmaindoes). - [High] Out-of-bounds write —
c/src/ml-api-inference-tizen-privilege-check.c:290-291:device = &resources->devices[type]; memset (device, 0, ...)executes before theswitch (type)validation._ml_tizen_get_resource()(line ~820) passesRES_TYPE_MAX, which indexes one past the array and clobbersrci/need_to_acquire. Fix:g_return_val_if_fail (type < RES_TYPE_MAX, ...)before indexing, and handleRES_TYPE_MAX("re-acquire all") explicitly. - [High] Regression: pipeline no longer paused on resource conflict —
privilege-check.c:396-415: the pause in the release callback is commented out (//gst_element_set_state (...)) and the re-acquire loop inml_pipeline_startis deleted;need_to_acquire[]is declared but never used. When the resource manager revokes the camera the pipeline keeps running and fails inside the camera element. Fix: pass the pipeline ascb_data, pause underp->lock, set a re-acquire flag, and restore re-acquisition inml_pipeline_start. Please also remove the commented-out code. - [High] Broken build dependency —
c/meson.build:26:dependency('resource-manager resource-center-api')asks pkg-config for a single module with that literal name, which does not exist. It also dropsmm-resource-managerfortizenVmajor >= 5, breaking Tizen 5-8 builds (as gichan-jang / anyj0527 already noted). Same inpackaging/machine-learning-api.spec:113-114. Fix: twodependency()calls underif tizenVmajor >= 9,elif >= 5keepingmm-resource-manager. - [High] Version regression —
packaging/machine-learning-api.spec:79:Version: 1.8.6->1.1.0downgrades the RPM (main is 1.8.8). Please drop this hunk. - [Medium] Leak on
rm_registerfailure —privilege-check.c:499-502returns directly, skippingrm_error:cleanup;mm_handleand itsGMutexleak. Fix:status = ML_ERROR_UNKNOWN; goto rm_error;. - [Medium] NULL deref before NULL check —
privilege-check.c:399-402:g_mutex_locker_new (&mm_handle->lock)runs beforeg_return_val_if_fail (cb_data, ...). - [Medium] Mutex cleared regardless of
destroy—ml_tizen_mm_res_release()(~line 445) callsg_mutex_cleareven whendestroy == FALSE, leaving a reusable handle with a destroyed mutex. Move it insideif (destroy). - [Medium] Missing validation — line 261-262:
g_strlcpytruncation of the app id only logs and proceeds; line ~290: therm_allocate_resourcesresult (allocated_num) is not validated before treating allocation as successful (both already raised by reviewers). - [Medium] No tests / CI cannot catch any of the above — no test references
TIZEN_RES_MM/get_tizen_resource, GBS CI builds only Tizen-Unified, and this PR shows no CI checks at all. - [Low] Style — new functions use tab indentation and
func(arg)instead of the repo's gst-indent GNU style;LOGE/LOGW/LOGIinstead of_ml_loge/_ml_logw/_ml_logi; typosFaied(line 569),resoure(line 435);tizen_mm_handle_sfields lack/**< */comments; the commit message carries a GerritChange-Id:line.
No back-door or suspicious behavior found.
This patch updates the mm resource manager.
Change-Id: I108b500c796a8899e6d582346a184d9e6a8136c4
Signed-off-by: YoungHun Kim yh8004.kim@samsung.com
Signed-off-by: Sangjung Woo sangjung.woo@samsung.com