[MM] Change to the common resource manager - #567

Open
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix
Open

[MM] Change to the common resource manager#567
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix

Conversation

@again4you

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
Collaborator

📝 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

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Faied -> Failed

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);

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • resoure -> resource

Comment threadc/meson.build
@@ -23,7 +23,7 @@ if (get_option('enable-tizen'))

nns_capi_deps += dependency('mm-camcorder')
if (tizenVmajor >= 5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@anyj0527anyj0527Oct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 -> 9. Or make an another if phrase ?

base = g_path_get_basename(contents);

if (g_strlcpy(appid, base, size) >= size)
LOGE("string truncated");

@gichan-janggichan-jangOct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't validation of device necessary?

@myungjoo-botmyungjoo-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. [High] Resource/handle leak on every pipeline destroyc/src/ml-api-inference-pipeline.c: cleanup_resource() (the only caller of release_tizen_resource) is deleted and ml_pipeline_destroy no longer touches p->resources (PR line ~1131). _ml_tizen_release_resource() becomes dead code, so the rm_register registration, the exclusively allocated camera, mm_handle, and the DPM callback leak per pipeline until process exit. Fix: call release_tizen_resource (p->resources, TIZEN_RES_MM); p->resources = NULL; in ml_pipeline_destroy (or keep the hash-table design as main does).
  2. [High] Out-of-bounds writec/src/ml-api-inference-tizen-privilege-check.c:290-291: device = &resources->devices[type]; memset (device, 0, ...) executes before the switch (type) validation. _ml_tizen_get_resource() (line ~820) passes RES_TYPE_MAX, which indexes one past the array and clobbers rci / need_to_acquire. Fix: g_return_val_if_fail (type < RES_TYPE_MAX, ...) before indexing, and handle RES_TYPE_MAX ("re-acquire all") explicitly.
  3. [High] Regression: pipeline no longer paused on resource conflictprivilege-check.c:396-415: the pause in the release callback is commented out (//gst_element_set_state (...)) and the re-acquire loop in ml_pipeline_start is 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 as cb_data, pause under p->lock, set a re-acquire flag, and restore re-acquisition in ml_pipeline_start. Please also remove the commented-out code.
  4. [High] Broken build dependencyc/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 drops mm-resource-manager for tizenVmajor >= 5, breaking Tizen 5-8 builds (as gichan-jang / anyj0527 already noted). Same in packaging/machine-learning-api.spec:113-114. Fix: two dependency() calls under if tizenVmajor >= 9, elif >= 5 keeping mm-resource-manager.
  5. [High] Version regressionpackaging/machine-learning-api.spec:79: Version: 1.8.6 -> 1.1.0 downgrades the RPM (main is 1.8.8). Please drop this hunk.
  6. [Medium] Leak on rm_register failureprivilege-check.c:499-502 returns directly, skipping rm_error: cleanup; mm_handle and its GMutex leak. Fix: status = ML_ERROR_UNKNOWN; goto rm_error;.
  7. [Medium] NULL deref before NULL checkprivilege-check.c:399-402: g_mutex_locker_new (&mm_handle->lock) runs before g_return_val_if_fail (cb_data, ...).
  8. [Medium] Mutex cleared regardless of destroyml_tizen_mm_res_release() (~line 445) calls g_mutex_clear even when destroy == FALSE, leaving a reusable handle with a destroyed mutex. Move it inside if (destroy).
  9. [Medium] Missing validation — line 261-262: g_strlcpy truncation of the app id only logs and proceeds; line ~290: the rm_allocate_resources result (allocated_num) is not validated before treating allocation as successful (both already raised by reviewers).
  10. [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.
  11. [Low] Style — new functions use tab indentation and func(arg) instead of the repo's gst-indent GNU style; LOGE/LOGW/LOGI instead of _ml_loge/_ml_logw/_ml_logi; typos Faied (line 569), resoure (line 435); tizen_mm_handle_s fields lack /**< */ comments; the commit message carries a Gerrit Change-Id: line.

No back-door or suspicious behavior found.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@again4you@taos-ci@anyj0527@songgot@gichan-jang@myungjoo-bot@yh8004kim
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

[MM] Change to the common resource manager - #567

Open
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix
Open

[MM] Change to the common resource manager#567
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix

Conversation

@again4you

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
Collaborator

📝 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

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Faied -> Failed

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);

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • resoure -> resource

Comment threadc/meson.build
@@ -23,7 +23,7 @@ if (get_option('enable-tizen'))

nns_capi_deps += dependency('mm-camcorder')
if (tizenVmajor >= 5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@anyj0527anyj0527Oct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 -> 9. Or make an another if phrase ?

base = g_path_get_basename(contents);

if (g_strlcpy(appid, base, size) >= size)
LOGE("string truncated");

@gichan-janggichan-jangOct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't validation of device necessary?

@myungjoo-botmyungjoo-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. [High] Resource/handle leak on every pipeline destroyc/src/ml-api-inference-pipeline.c: cleanup_resource() (the only caller of release_tizen_resource) is deleted and ml_pipeline_destroy no longer touches p->resources (PR line ~1131). _ml_tizen_release_resource() becomes dead code, so the rm_register registration, the exclusively allocated camera, mm_handle, and the DPM callback leak per pipeline until process exit. Fix: call release_tizen_resource (p->resources, TIZEN_RES_MM); p->resources = NULL; in ml_pipeline_destroy (or keep the hash-table design as main does).
  2. [High] Out-of-bounds writec/src/ml-api-inference-tizen-privilege-check.c:290-291: device = &resources->devices[type]; memset (device, 0, ...) executes before the switch (type) validation. _ml_tizen_get_resource() (line ~820) passes RES_TYPE_MAX, which indexes one past the array and clobbers rci / need_to_acquire. Fix: g_return_val_if_fail (type < RES_TYPE_MAX, ...) before indexing, and handle RES_TYPE_MAX ("re-acquire all") explicitly.
  3. [High] Regression: pipeline no longer paused on resource conflictprivilege-check.c:396-415: the pause in the release callback is commented out (//gst_element_set_state (...)) and the re-acquire loop in ml_pipeline_start is 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 as cb_data, pause under p->lock, set a re-acquire flag, and restore re-acquisition in ml_pipeline_start. Please also remove the commented-out code.
  4. [High] Broken build dependencyc/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 drops mm-resource-manager for tizenVmajor >= 5, breaking Tizen 5-8 builds (as gichan-jang / anyj0527 already noted). Same in packaging/machine-learning-api.spec:113-114. Fix: two dependency() calls under if tizenVmajor >= 9, elif >= 5 keeping mm-resource-manager.
  5. [High] Version regressionpackaging/machine-learning-api.spec:79: Version: 1.8.6 -> 1.1.0 downgrades the RPM (main is 1.8.8). Please drop this hunk.
  6. [Medium] Leak on rm_register failureprivilege-check.c:499-502 returns directly, skipping rm_error: cleanup; mm_handle and its GMutex leak. Fix: status = ML_ERROR_UNKNOWN; goto rm_error;.
  7. [Medium] NULL deref before NULL checkprivilege-check.c:399-402: g_mutex_locker_new (&mm_handle->lock) runs before g_return_val_if_fail (cb_data, ...).
  8. [Medium] Mutex cleared regardless of destroyml_tizen_mm_res_release() (~line 445) calls g_mutex_clear even when destroy == FALSE, leaving a reusable handle with a destroyed mutex. Move it inside if (destroy).
  9. [Medium] Missing validation — line 261-262: g_strlcpy truncation of the app id only logs and proceeds; line ~290: the rm_allocate_resources result (allocated_num) is not validated before treating allocation as successful (both already raised by reviewers).
  10. [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.
  11. [Low] Style — new functions use tab indentation and func(arg) instead of the repo's gst-indent GNU style; LOGE/LOGW/LOGI instead of _ml_loge/_ml_logw/_ml_logi; typos Faied (line 569), resoure (line 435); tizen_mm_handle_s fields lack /**< */ comments; the commit message carries a Gerrit Change-Id: line.

No back-door or suspicious behavior found.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@again4you@taos-ci@anyj0527@songgot@gichan-jang@myungjoo-bot@yh8004kim
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[MM] Change to the common resource manager - #567

Open
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix
Open

[MM] Change to the common resource manager#567
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix

Conversation

@again4you

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
Collaborator

📝 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

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Faied -> Failed

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);

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • resoure -> resource

Comment threadc/meson.build
@@ -23,7 +23,7 @@ if (get_option('enable-tizen'))

nns_capi_deps += dependency('mm-camcorder')
if (tizenVmajor >= 5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@anyj0527anyj0527Oct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 -> 9. Or make an another if phrase ?

base = g_path_get_basename(contents);

if (g_strlcpy(appid, base, size) >= size)
LOGE("string truncated");

@gichan-janggichan-jangOct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't validation of device necessary?

@myungjoo-botmyungjoo-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. [High] Resource/handle leak on every pipeline destroyc/src/ml-api-inference-pipeline.c: cleanup_resource() (the only caller of release_tizen_resource) is deleted and ml_pipeline_destroy no longer touches p->resources (PR line ~1131). _ml_tizen_release_resource() becomes dead code, so the rm_register registration, the exclusively allocated camera, mm_handle, and the DPM callback leak per pipeline until process exit. Fix: call release_tizen_resource (p->resources, TIZEN_RES_MM); p->resources = NULL; in ml_pipeline_destroy (or keep the hash-table design as main does).
  2. [High] Out-of-bounds writec/src/ml-api-inference-tizen-privilege-check.c:290-291: device = &resources->devices[type]; memset (device, 0, ...) executes before the switch (type) validation. _ml_tizen_get_resource() (line ~820) passes RES_TYPE_MAX, which indexes one past the array and clobbers rci / need_to_acquire. Fix: g_return_val_if_fail (type < RES_TYPE_MAX, ...) before indexing, and handle RES_TYPE_MAX ("re-acquire all") explicitly.
  3. [High] Regression: pipeline no longer paused on resource conflictprivilege-check.c:396-415: the pause in the release callback is commented out (//gst_element_set_state (...)) and the re-acquire loop in ml_pipeline_start is 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 as cb_data, pause under p->lock, set a re-acquire flag, and restore re-acquisition in ml_pipeline_start. Please also remove the commented-out code.
  4. [High] Broken build dependencyc/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 drops mm-resource-manager for tizenVmajor >= 5, breaking Tizen 5-8 builds (as gichan-jang / anyj0527 already noted). Same in packaging/machine-learning-api.spec:113-114. Fix: two dependency() calls under if tizenVmajor >= 9, elif >= 5 keeping mm-resource-manager.
  5. [High] Version regressionpackaging/machine-learning-api.spec:79: Version: 1.8.6 -> 1.1.0 downgrades the RPM (main is 1.8.8). Please drop this hunk.
  6. [Medium] Leak on rm_register failureprivilege-check.c:499-502 returns directly, skipping rm_error: cleanup; mm_handle and its GMutex leak. Fix: status = ML_ERROR_UNKNOWN; goto rm_error;.
  7. [Medium] NULL deref before NULL checkprivilege-check.c:399-402: g_mutex_locker_new (&mm_handle->lock) runs before g_return_val_if_fail (cb_data, ...).
  8. [Medium] Mutex cleared regardless of destroyml_tizen_mm_res_release() (~line 445) calls g_mutex_clear even when destroy == FALSE, leaving a reusable handle with a destroyed mutex. Move it inside if (destroy).
  9. [Medium] Missing validation — line 261-262: g_strlcpy truncation of the app id only logs and proceeds; line ~290: the rm_allocate_resources result (allocated_num) is not validated before treating allocation as successful (both already raised by reviewers).
  10. [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.
  11. [Low] Style — new functions use tab indentation and func(arg) instead of the repo's gst-indent GNU style; LOGE/LOGW/LOGI instead of _ml_loge/_ml_logw/_ml_logi; typos Faied (line 569), resoure (line 435); tizen_mm_handle_s fields lack /**< */ comments; the commit message carries a Gerrit Change-Id: line.

No back-door or suspicious behavior found.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@again4you@taos-ci@anyj0527@songgot@gichan-jang@myungjoo-bot@yh8004kim
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[MM] Change to the common resource manager - #567

Open
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix
Open

[MM] Change to the common resource manager#567
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix

Conversation

@again4you

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
Collaborator

📝 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

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Faied -> Failed

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);

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • resoure -> resource

Comment threadc/meson.build
@@ -23,7 +23,7 @@ if (get_option('enable-tizen'))

nns_capi_deps += dependency('mm-camcorder')
if (tizenVmajor >= 5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@anyj0527anyj0527Oct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 -> 9. Or make an another if phrase ?

base = g_path_get_basename(contents);

if (g_strlcpy(appid, base, size) >= size)
LOGE("string truncated");

@gichan-janggichan-jangOct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't validation of device necessary?

@myungjoo-botmyungjoo-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. [High] Resource/handle leak on every pipeline destroyc/src/ml-api-inference-pipeline.c: cleanup_resource() (the only caller of release_tizen_resource) is deleted and ml_pipeline_destroy no longer touches p->resources (PR line ~1131). _ml_tizen_release_resource() becomes dead code, so the rm_register registration, the exclusively allocated camera, mm_handle, and the DPM callback leak per pipeline until process exit. Fix: call release_tizen_resource (p->resources, TIZEN_RES_MM); p->resources = NULL; in ml_pipeline_destroy (or keep the hash-table design as main does).
  2. [High] Out-of-bounds writec/src/ml-api-inference-tizen-privilege-check.c:290-291: device = &resources->devices[type]; memset (device, 0, ...) executes before the switch (type) validation. _ml_tizen_get_resource() (line ~820) passes RES_TYPE_MAX, which indexes one past the array and clobbers rci / need_to_acquire. Fix: g_return_val_if_fail (type < RES_TYPE_MAX, ...) before indexing, and handle RES_TYPE_MAX ("re-acquire all") explicitly.
  3. [High] Regression: pipeline no longer paused on resource conflictprivilege-check.c:396-415: the pause in the release callback is commented out (//gst_element_set_state (...)) and the re-acquire loop in ml_pipeline_start is 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 as cb_data, pause under p->lock, set a re-acquire flag, and restore re-acquisition in ml_pipeline_start. Please also remove the commented-out code.
  4. [High] Broken build dependencyc/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 drops mm-resource-manager for tizenVmajor >= 5, breaking Tizen 5-8 builds (as gichan-jang / anyj0527 already noted). Same in packaging/machine-learning-api.spec:113-114. Fix: two dependency() calls under if tizenVmajor >= 9, elif >= 5 keeping mm-resource-manager.
  5. [High] Version regressionpackaging/machine-learning-api.spec:79: Version: 1.8.6 -> 1.1.0 downgrades the RPM (main is 1.8.8). Please drop this hunk.
  6. [Medium] Leak on rm_register failureprivilege-check.c:499-502 returns directly, skipping rm_error: cleanup; mm_handle and its GMutex leak. Fix: status = ML_ERROR_UNKNOWN; goto rm_error;.
  7. [Medium] NULL deref before NULL checkprivilege-check.c:399-402: g_mutex_locker_new (&mm_handle->lock) runs before g_return_val_if_fail (cb_data, ...).
  8. [Medium] Mutex cleared regardless of destroyml_tizen_mm_res_release() (~line 445) calls g_mutex_clear even when destroy == FALSE, leaving a reusable handle with a destroyed mutex. Move it inside if (destroy).
  9. [Medium] Missing validation — line 261-262: g_strlcpy truncation of the app id only logs and proceeds; line ~290: the rm_allocate_resources result (allocated_num) is not validated before treating allocation as successful (both already raised by reviewers).
  10. [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.
  11. [Low] Style — new functions use tab indentation and func(arg) instead of the repo's gst-indent GNU style; LOGE/LOGW/LOGI instead of _ml_loge/_ml_logw/_ml_logi; typos Faied (line 569), resoure (line 435); tizen_mm_handle_s fields lack /**< */ comments; the commit message carries a Gerrit Change-Id: line.

No back-door or suspicious behavior found.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@again4you@taos-ci@anyj0527@songgot@gichan-jang@myungjoo-bot@yh8004kim
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

[MM] Change to the common resource manager - #567

Open
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix
Open

[MM] Change to the common resource manager#567
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix

Conversation

@again4you

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
Collaborator

📝 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

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Faied -> Failed

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);

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • resoure -> resource

Comment threadc/meson.build
@@ -23,7 +23,7 @@ if (get_option('enable-tizen'))

nns_capi_deps += dependency('mm-camcorder')
if (tizenVmajor >= 5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@anyj0527anyj0527Oct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 -> 9. Or make an another if phrase ?

base = g_path_get_basename(contents);

if (g_strlcpy(appid, base, size) >= size)
LOGE("string truncated");

@gichan-janggichan-jangOct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't validation of device necessary?

@myungjoo-botmyungjoo-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. [High] Resource/handle leak on every pipeline destroyc/src/ml-api-inference-pipeline.c: cleanup_resource() (the only caller of release_tizen_resource) is deleted and ml_pipeline_destroy no longer touches p->resources (PR line ~1131). _ml_tizen_release_resource() becomes dead code, so the rm_register registration, the exclusively allocated camera, mm_handle, and the DPM callback leak per pipeline until process exit. Fix: call release_tizen_resource (p->resources, TIZEN_RES_MM); p->resources = NULL; in ml_pipeline_destroy (or keep the hash-table design as main does).
  2. [High] Out-of-bounds writec/src/ml-api-inference-tizen-privilege-check.c:290-291: device = &resources->devices[type]; memset (device, 0, ...) executes before the switch (type) validation. _ml_tizen_get_resource() (line ~820) passes RES_TYPE_MAX, which indexes one past the array and clobbers rci / need_to_acquire. Fix: g_return_val_if_fail (type < RES_TYPE_MAX, ...) before indexing, and handle RES_TYPE_MAX ("re-acquire all") explicitly.
  3. [High] Regression: pipeline no longer paused on resource conflictprivilege-check.c:396-415: the pause in the release callback is commented out (//gst_element_set_state (...)) and the re-acquire loop in ml_pipeline_start is 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 as cb_data, pause under p->lock, set a re-acquire flag, and restore re-acquisition in ml_pipeline_start. Please also remove the commented-out code.
  4. [High] Broken build dependencyc/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 drops mm-resource-manager for tizenVmajor >= 5, breaking Tizen 5-8 builds (as gichan-jang / anyj0527 already noted). Same in packaging/machine-learning-api.spec:113-114. Fix: two dependency() calls under if tizenVmajor >= 9, elif >= 5 keeping mm-resource-manager.
  5. [High] Version regressionpackaging/machine-learning-api.spec:79: Version: 1.8.6 -> 1.1.0 downgrades the RPM (main is 1.8.8). Please drop this hunk.
  6. [Medium] Leak on rm_register failureprivilege-check.c:499-502 returns directly, skipping rm_error: cleanup; mm_handle and its GMutex leak. Fix: status = ML_ERROR_UNKNOWN; goto rm_error;.
  7. [Medium] NULL deref before NULL checkprivilege-check.c:399-402: g_mutex_locker_new (&mm_handle->lock) runs before g_return_val_if_fail (cb_data, ...).
  8. [Medium] Mutex cleared regardless of destroyml_tizen_mm_res_release() (~line 445) calls g_mutex_clear even when destroy == FALSE, leaving a reusable handle with a destroyed mutex. Move it inside if (destroy).
  9. [Medium] Missing validation — line 261-262: g_strlcpy truncation of the app id only logs and proceeds; line ~290: the rm_allocate_resources result (allocated_num) is not validated before treating allocation as successful (both already raised by reviewers).
  10. [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.
  11. [Low] Style — new functions use tab indentation and func(arg) instead of the repo's gst-indent GNU style; LOGE/LOGW/LOGI instead of _ml_loge/_ml_logw/_ml_logi; typos Faied (line 569), resoure (line 435); tizen_mm_handle_s fields lack /**< */ comments; the commit message carries a Gerrit Change-Id: line.

No back-door or suspicious behavior found.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@again4you@taos-ci@anyj0527@songgot@gichan-jang@myungjoo-bot@yh8004kim
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[MM] Change to the common resource manager - #567

Open
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix
Open

[MM] Change to the common resource manager#567
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix

Conversation

@again4you

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
Collaborator

📝 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

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Faied -> Failed

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);

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • resoure -> resource

Comment threadc/meson.build
@@ -23,7 +23,7 @@ if (get_option('enable-tizen'))

nns_capi_deps += dependency('mm-camcorder')
if (tizenVmajor >= 5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@anyj0527anyj0527Oct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 -> 9. Or make an another if phrase ?

base = g_path_get_basename(contents);

if (g_strlcpy(appid, base, size) >= size)
LOGE("string truncated");

@gichan-janggichan-jangOct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't validation of device necessary?

@myungjoo-botmyungjoo-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. [High] Resource/handle leak on every pipeline destroyc/src/ml-api-inference-pipeline.c: cleanup_resource() (the only caller of release_tizen_resource) is deleted and ml_pipeline_destroy no longer touches p->resources (PR line ~1131). _ml_tizen_release_resource() becomes dead code, so the rm_register registration, the exclusively allocated camera, mm_handle, and the DPM callback leak per pipeline until process exit. Fix: call release_tizen_resource (p->resources, TIZEN_RES_MM); p->resources = NULL; in ml_pipeline_destroy (or keep the hash-table design as main does).
  2. [High] Out-of-bounds writec/src/ml-api-inference-tizen-privilege-check.c:290-291: device = &resources->devices[type]; memset (device, 0, ...) executes before the switch (type) validation. _ml_tizen_get_resource() (line ~820) passes RES_TYPE_MAX, which indexes one past the array and clobbers rci / need_to_acquire. Fix: g_return_val_if_fail (type < RES_TYPE_MAX, ...) before indexing, and handle RES_TYPE_MAX ("re-acquire all") explicitly.
  3. [High] Regression: pipeline no longer paused on resource conflictprivilege-check.c:396-415: the pause in the release callback is commented out (//gst_element_set_state (...)) and the re-acquire loop in ml_pipeline_start is 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 as cb_data, pause under p->lock, set a re-acquire flag, and restore re-acquisition in ml_pipeline_start. Please also remove the commented-out code.
  4. [High] Broken build dependencyc/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 drops mm-resource-manager for tizenVmajor >= 5, breaking Tizen 5-8 builds (as gichan-jang / anyj0527 already noted). Same in packaging/machine-learning-api.spec:113-114. Fix: two dependency() calls under if tizenVmajor >= 9, elif >= 5 keeping mm-resource-manager.
  5. [High] Version regressionpackaging/machine-learning-api.spec:79: Version: 1.8.6 -> 1.1.0 downgrades the RPM (main is 1.8.8). Please drop this hunk.
  6. [Medium] Leak on rm_register failureprivilege-check.c:499-502 returns directly, skipping rm_error: cleanup; mm_handle and its GMutex leak. Fix: status = ML_ERROR_UNKNOWN; goto rm_error;.
  7. [Medium] NULL deref before NULL checkprivilege-check.c:399-402: g_mutex_locker_new (&mm_handle->lock) runs before g_return_val_if_fail (cb_data, ...).
  8. [Medium] Mutex cleared regardless of destroyml_tizen_mm_res_release() (~line 445) calls g_mutex_clear even when destroy == FALSE, leaving a reusable handle with a destroyed mutex. Move it inside if (destroy).
  9. [Medium] Missing validation — line 261-262: g_strlcpy truncation of the app id only logs and proceeds; line ~290: the rm_allocate_resources result (allocated_num) is not validated before treating allocation as successful (both already raised by reviewers).
  10. [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.
  11. [Low] Style — new functions use tab indentation and func(arg) instead of the repo's gst-indent GNU style; LOGE/LOGW/LOGI instead of _ml_loge/_ml_logw/_ml_logi; typos Faied (line 569), resoure (line 435); tizen_mm_handle_s fields lack /**< */ comments; the commit message carries a Gerrit Change-Id: line.

No back-door or suspicious behavior found.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@again4you@taos-ci@anyj0527@songgot@gichan-jang@myungjoo-bot@yh8004kim
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[MM] Change to the common resource manager - #567

Open
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix
Open

[MM] Change to the common resource manager#567
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix

Conversation

@again4you

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
Collaborator

📝 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

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Faied -> Failed

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);

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • resoure -> resource

Comment threadc/meson.build
@@ -23,7 +23,7 @@ if (get_option('enable-tizen'))

nns_capi_deps += dependency('mm-camcorder')
if (tizenVmajor >= 5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@anyj0527anyj0527Oct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 -> 9. Or make an another if phrase ?

base = g_path_get_basename(contents);

if (g_strlcpy(appid, base, size) >= size)
LOGE("string truncated");

@gichan-janggichan-jangOct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't validation of device necessary?

@myungjoo-botmyungjoo-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. [High] Resource/handle leak on every pipeline destroyc/src/ml-api-inference-pipeline.c: cleanup_resource() (the only caller of release_tizen_resource) is deleted and ml_pipeline_destroy no longer touches p->resources (PR line ~1131). _ml_tizen_release_resource() becomes dead code, so the rm_register registration, the exclusively allocated camera, mm_handle, and the DPM callback leak per pipeline until process exit. Fix: call release_tizen_resource (p->resources, TIZEN_RES_MM); p->resources = NULL; in ml_pipeline_destroy (or keep the hash-table design as main does).
  2. [High] Out-of-bounds writec/src/ml-api-inference-tizen-privilege-check.c:290-291: device = &resources->devices[type]; memset (device, 0, ...) executes before the switch (type) validation. _ml_tizen_get_resource() (line ~820) passes RES_TYPE_MAX, which indexes one past the array and clobbers rci / need_to_acquire. Fix: g_return_val_if_fail (type < RES_TYPE_MAX, ...) before indexing, and handle RES_TYPE_MAX ("re-acquire all") explicitly.
  3. [High] Regression: pipeline no longer paused on resource conflictprivilege-check.c:396-415: the pause in the release callback is commented out (//gst_element_set_state (...)) and the re-acquire loop in ml_pipeline_start is 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 as cb_data, pause under p->lock, set a re-acquire flag, and restore re-acquisition in ml_pipeline_start. Please also remove the commented-out code.
  4. [High] Broken build dependencyc/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 drops mm-resource-manager for tizenVmajor >= 5, breaking Tizen 5-8 builds (as gichan-jang / anyj0527 already noted). Same in packaging/machine-learning-api.spec:113-114. Fix: two dependency() calls under if tizenVmajor >= 9, elif >= 5 keeping mm-resource-manager.
  5. [High] Version regressionpackaging/machine-learning-api.spec:79: Version: 1.8.6 -> 1.1.0 downgrades the RPM (main is 1.8.8). Please drop this hunk.
  6. [Medium] Leak on rm_register failureprivilege-check.c:499-502 returns directly, skipping rm_error: cleanup; mm_handle and its GMutex leak. Fix: status = ML_ERROR_UNKNOWN; goto rm_error;.
  7. [Medium] NULL deref before NULL checkprivilege-check.c:399-402: g_mutex_locker_new (&mm_handle->lock) runs before g_return_val_if_fail (cb_data, ...).
  8. [Medium] Mutex cleared regardless of destroyml_tizen_mm_res_release() (~line 445) calls g_mutex_clear even when destroy == FALSE, leaving a reusable handle with a destroyed mutex. Move it inside if (destroy).
  9. [Medium] Missing validation — line 261-262: g_strlcpy truncation of the app id only logs and proceeds; line ~290: the rm_allocate_resources result (allocated_num) is not validated before treating allocation as successful (both already raised by reviewers).
  10. [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.
  11. [Low] Style — new functions use tab indentation and func(arg) instead of the repo's gst-indent GNU style; LOGE/LOGW/LOGI instead of _ml_loge/_ml_logw/_ml_logi; typos Faied (line 569), resoure (line 435); tizen_mm_handle_s fields lack /**< */ comments; the commit message carries a Gerrit Change-Id: line.

No back-door or suspicious behavior found.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@again4you@taos-ci@anyj0527@songgot@gichan-jang@myungjoo-bot@yh8004kim
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

[MM] Change to the common resource manager - #567

Open
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix
Open

[MM] Change to the common resource manager#567
again4you wants to merge 1 commit into
nnstreamer:mainfrom
again4you:dev/mm_res_mgr_bugfix

Conversation

@again4you

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
Collaborator

📝 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

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Faied -> Failed

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);

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • resoure -> resource

Comment threadc/meson.build
@@ -23,7 +23,7 @@ if (get_option('enable-tizen'))

nns_capi_deps += dependency('mm-camcorder')
if (tizenVmajor >= 5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@anyj0527anyj0527Oct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 -> 9. Or make an another if phrase ?

base = g_path_get_basename(contents);

if (g_strlcpy(appid, base, size) >= size)
LOGE("string truncated");

@gichan-janggichan-jangOct 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't validation of device necessary?

@myungjoo-botmyungjoo-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. [High] Resource/handle leak on every pipeline destroyc/src/ml-api-inference-pipeline.c: cleanup_resource() (the only caller of release_tizen_resource) is deleted and ml_pipeline_destroy no longer touches p->resources (PR line ~1131). _ml_tizen_release_resource() becomes dead code, so the rm_register registration, the exclusively allocated camera, mm_handle, and the DPM callback leak per pipeline until process exit. Fix: call release_tizen_resource (p->resources, TIZEN_RES_MM); p->resources = NULL; in ml_pipeline_destroy (or keep the hash-table design as main does).
  2. [High] Out-of-bounds writec/src/ml-api-inference-tizen-privilege-check.c:290-291: device = &resources->devices[type]; memset (device, 0, ...) executes before the switch (type) validation. _ml_tizen_get_resource() (line ~820) passes RES_TYPE_MAX, which indexes one past the array and clobbers rci / need_to_acquire. Fix: g_return_val_if_fail (type < RES_TYPE_MAX, ...) before indexing, and handle RES_TYPE_MAX ("re-acquire all") explicitly.
  3. [High] Regression: pipeline no longer paused on resource conflictprivilege-check.c:396-415: the pause in the release callback is commented out (//gst_element_set_state (...)) and the re-acquire loop in ml_pipeline_start is 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 as cb_data, pause under p->lock, set a re-acquire flag, and restore re-acquisition in ml_pipeline_start. Please also remove the commented-out code.
  4. [High] Broken build dependencyc/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 drops mm-resource-manager for tizenVmajor >= 5, breaking Tizen 5-8 builds (as gichan-jang / anyj0527 already noted). Same in packaging/machine-learning-api.spec:113-114. Fix: two dependency() calls under if tizenVmajor >= 9, elif >= 5 keeping mm-resource-manager.
  5. [High] Version regressionpackaging/machine-learning-api.spec:79: Version: 1.8.6 -> 1.1.0 downgrades the RPM (main is 1.8.8). Please drop this hunk.
  6. [Medium] Leak on rm_register failureprivilege-check.c:499-502 returns directly, skipping rm_error: cleanup; mm_handle and its GMutex leak. Fix: status = ML_ERROR_UNKNOWN; goto rm_error;.
  7. [Medium] NULL deref before NULL checkprivilege-check.c:399-402: g_mutex_locker_new (&mm_handle->lock) runs before g_return_val_if_fail (cb_data, ...).
  8. [Medium] Mutex cleared regardless of destroyml_tizen_mm_res_release() (~line 445) calls g_mutex_clear even when destroy == FALSE, leaving a reusable handle with a destroyed mutex. Move it inside if (destroy).
  9. [Medium] Missing validation — line 261-262: g_strlcpy truncation of the app id only logs and proceeds; line ~290: the rm_allocate_resources result (allocated_num) is not validated before treating allocation as successful (both already raised by reviewers).
  10. [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.
  11. [Low] Style — new functions use tab indentation and func(arg) instead of the repo's gst-indent GNU style; LOGE/LOGW/LOGI instead of _ml_loge/_ml_logw/_ml_logi; typos Faied (line 569), resoure (line 435); tizen_mm_handle_s fields lack /**< */ comments; the commit message carries a Gerrit Change-Id: line.

No back-door or suspicious behavior found.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@again4you@taos-ci@anyj0527@songgot@gichan-jang@myungjoo-bot@yh8004kim