Skip to content
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

Memory Leak for seq cutoff initialization #659

Closed
YamboZhou opened this issue Feb 16, 2022 · 3 comments
Closed

Memory Leak for seq cutoff initialization #659

YamboZhou opened this issue Feb 16, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@YamboZhou
Copy link

YamboZhou commented Feb 16, 2022

Hi all,

There seems existing memory leak when initialize seq cutoff.

==11259== 22,736 bytes in 2 blocks are definitely lost in loss record 4 of 4
==11259== at 0x4C2B0F7: malloc (vg_replace_malloc.c:381)
==11259== by 0x47B971: env_vmalloc (ocf_env.h:170)
==11259== by 0x47B971: ocf_core_seq_cutoff_init (ocf_seq_cutoff.c:104)
==11259== by 0x46FC3E: ocf_mngt_cache_add_core_insert (ocf_mngt_core.c:450)
==11259== by 0x4782A0: _ocf_pipeline_run_step (utils_pipeline.c:40)
==11259== by 0x47B277: ocf_queue_run (ocf_queue.c:118)
==11259== by 0x468256: ocf_queue_kick (ocf_queue_priv.h:44)
==11259== by 0x468256: ocf_engine_push_req_front (engine_common.c:766)
==11259== by 0x46E10C: ocf_mngt_cache_add_core_prepare (ocf_mngt_core.c:350)
==11259== by 0x4782A0: _ocf_pipeline_run_step (utils_pipeline.c:40)
==11259== by 0x47B277: ocf_queue_run (ocf_queue.c:118)
==11259== by 0x468256: ocf_queue_kick (ocf_queue_priv.h:44)
==11259== by 0x468256: ocf_engine_push_req_front (engine_common.c:766)
==11259== by 0x46F5E3: ocf_mngt_cache_add_core (ocf_mngt_core.c:615)
==11259== by 0x45237E: initialize_core (adapter_mngt.c:89)

I just resolved this issue by de-initializing when ocf removes core device.

static void _ocf_mngt_cache_remove_core(ocf_pipeline_t pipeline, void *priv,
		ocf_pipeline_arg_t arg)
{
	struct ocf_mngt_cache_remove_core_context *context = priv;
	ocf_cache_t cache = context->cache;
	ocf_core_t core = context->core;

	ocf_core_log(core, log_debug, "Removing core\n");

	cache_mngt_core_remove_from_meta(core);
	cache_mngt_core_remove_from_cache(core);
	cache_mngt_core_deinit(core);
	ocf_core_seq_cutoff_deinit(core);

	ocf_metadata_flush_superblock(cache,
			ocf_mngt_cache_remove_core_flush_meta_complete,
			context);
}
@YamboZhou YamboZhou added the bug Something isn't working label Feb 16, 2022
@YamboZhou
Copy link
Author

this is based on release 21.3

@mmichal10
Copy link
Contributor

Hi @YamboZhou,

thank you for posting the issue. Have you tried to test it on v21.3.4, which is our latest version of v21.3 branch? The bug seems already fixed with 492a562.

@YamboZhou
Copy link
Author

@mmichal10 It works. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants