{"action":"created","issue":{"url":"https://api.github.com/repos/sysrepo/sysrepo/issues/379","repository_url":"https://api.github.com/repos/sysrepo/sysrepo","labels_url":"https://api.github.com/repos/sysrepo/sysrepo/issues/379/labels{/name}","comments_url":"https://api.github.com/repos/sysrepo/sysrepo/issues/379/comments","events_url":"https://api.github.com/repos/sysrepo/sysrepo/issues/379/events","html_url":"https://github.com/sysrepo/sysrepo/issues/379","id":181203409,"number":379,"title":"segfault in swig/cpp/examples/rpc_example","user":{"login":"jktjkt","id":2631925,"avatar_url":"https://avatars.githubusercontent.com/u/2631925?v=3","gravatar_id":"","url":"https://api.github.com/users/jktjkt","html_url":"https://github.com/jktjkt","followers_url":"https://api.github.com/users/jktjkt/followers","following_url":"https://api.github.com/users/jktjkt/following{/other_user}","gists_url":"https://api.github.com/users/jktjkt/gists{/gist_id}","starred_url":"https://api.github.com/users/jktjkt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jktjkt/subscriptions","organizations_url":"https://api.github.com/users/jktjkt/orgs","repos_url":"https://api.github.com/users/jktjkt/repos","events_url":"https://api.github.com/users/jktjkt/events{/privacy}","received_events_url":"https://api.github.com/users/jktjkt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sysrepo/sysrepo/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"mislavn","id":4980289,"avatar_url":"https://avatars.githubusercontent.com/u/4980289?v=3","gravatar_id":"","url":"https://api.github.com/users/mislavn","html_url":"https://github.com/mislavn","followers_url":"https://api.github.com/users/mislavn/followers","following_url":"https://api.github.com/users/mislavn/following{/other_user}","gists_url":"https://api.github.com/users/mislavn/gists{/gist_id}","starred_url":"https://api.github.com/users/mislavn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mislavn/subscriptions","organizations_url":"https://api.github.com/users/mislavn/orgs","repos_url":"https://api.github.com/users/mislavn/repos","events_url":"https://api.github.com/users/mislavn/events{/privacy}","received_events_url":"https://api.github.com/users/mislavn/received_events","type":"User","site_admin":false},"assignees":[{"login":"mislavn","id":4980289,"avatar_url":"https://avatars.githubusercontent.com/u/4980289?v=3","gravatar_id":"","url":"https://api.github.com/users/mislavn","html_url":"https://github.com/mislavn","followers_url":"https://api.github.com/users/mislavn/followers","following_url":"https://api.github.com/users/mislavn/following{/other_user}","gists_url":"https://api.github.com/users/mislavn/gists{/gist_id}","starred_url":"https://api.github.com/users/mislavn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mislavn/subscriptions","organizations_url":"https://api.github.com/users/mislavn/orgs","repos_url":"https://api.github.com/users/mislavn/repos","events_url":"https://api.github.com/users/mislavn/events{/privacy}","received_events_url":"https://api.github.com/users/mislavn/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2016-10-05T16:28:03Z","updated_at":"2016-10-13T12:19:02Z","closed_at":null,"body":"Buiilt on CentOS7 with either clang 4.0.0 from today's git, or using GCC 5.2.1 from the devtoolset-4 package. ASAN is active, custom memory management disabled:\r\n\r\n```\r\n$ ./swig/cpp/examples/rpc_example\r\nApplication will make an rpc call in test-module\r\n\r\n ========== SUBSCRIBE TO RPC CALL ==========\r\n\r\n\r\n ========== START RPC CALL ==========\r\n\r\n\r\n ========== RPC CALLED ==========\r\n\r\n/test-module:activate-software-image/image-name = acmefw-2.3\r\n/test-module:activate-software-image/location = /root/\r\nASAN:SIGSEGV\r\n=================================================================\r\n==2460==ERROR: AddressSanitizer: SEGV on unknown address 0x000000415c30 (pc 0x7f23e13d3abc bp 0x000000415c30 sp 0x7f23d7cdfe90 T6)\r\n\r\n ========== PRINT RETURN VALUE ==========\r\n\r\n/test-module:activate-software-image/status = The image acmefw-2.3 is being installed.\r\n/test-module:activate-software-image/version = 2.3\r\n/test-module:activate-software-image/location = /root/\r\n/test-module:activate-software-image/init-log (container)\r\n\r\n ========== SUBSCRIBE TO RPC TREE CALL ==========\r\n\r\n    #0 0x7f23e13d3abb  (/lib64/libasan.so.2+0x21abb)\r\n    #1 0x7f23e144a6dc in __interceptor_free (/lib64/libasan.so.2+0x986dc)\r\n    #2 0x7f23e0bf3df2 in sr_free_val_content /home/centos/sysrepo/src/common/sr_utils.c:1609\r\n    #3 0x7f23e0bdbdd6 in sr_free_values /home/centos/sysrepo/src/common/sr_common.c:91\r\n    #4 0x7f23e0ca60a7 in cl_sm_rpc_process /home/centos/sysrepo/src/clientlib/cl_subscription_manager.c:912\r\n    #5 0x7f23e0ca93ca in cl_sm_conn_msg_process /home/centos/sysrepo/src/clientlib/cl_subscription_manager.c:1019\r\n    #6 0x7f23e0ca9f3c in cl_sm_conn_in_buff_process /home/centos/sysrepo/src/clientlib/cl_subscription_manager.c:1064\r\n    #7 0x7f23e0cabd2b in cl_sm_fd_read_data /home/centos/sysrepo/src/clientlib/cl_subscription_manager.c:1150\r\n    #8 0x7f23e0cac624 in cl_sm_fd_read_cb /home/centos/sysrepo/src/clientlib/cl_subscription_manager.c:1178\r\n    #9 0x7f23df95e586 in ev_invoke_pending (/lib64/libev.so.4+0x4586)\r\n    #10 0x7f23df96178c in ev_run (/lib64/libev.so.4+0x778c)\r\n    #11 0x7f23e0cb4724 in cl_sm_event_loop_threaded /home/centos/sysrepo/src/clientlib/cl_subscription_manager.c:1589\r\n    #12 0x7f23dfd79dc4 in start_thread (/lib64/libpthread.so.0+0x7dc4)\r\n    #13 0x7f23dd388cec in clone (/lib64/libc.so.6+0xf6cec)\r\n\r\nAddressSanitizer can not provide additional info.\r\nSUMMARY: AddressSanitizer: SEGV ??:0 ??\r\nThread T6 created by T0 here:\r\n    #0 0x7f23e13e8703 in pthread_create (/lib64/libasan.so.2+0x36703)\r\n    #1 0x7f23e0cb622f in cl_sm_init /home/centos/sysrepo/src/clientlib/cl_subscription_manager.c:1662\r\n    #2 0x7f23e0c5282e in cl_subscription_init /home/centos/sysrepo/src/clientlib/client_library.c:294\r\n    #3 0x7f23e0c8a2cf in cl_rpc_subscribe /home/centos/sysrepo/src/clientlib/client_library.c:2802\r\n    #4 0x7f23e0c8b0e7 in sr_rpc_subscribe /home/centos/sysrepo/src/clientlib/client_library.c:2849\r\n    #5 0x7f23e10e1666 in Subscribe::rpc_subscribe(char const*, std::shared_ptr<Callback>, void*, unsigned int) /home/centos/sysrepo/swig/cpp/src/Session.cpp:460\r\n    #6 0x40cdef in main /home/centos/sysrepo/swig/cpp/examples/rpc_example.cpp:219\r\n    #7 0x7f23dd2b3b14 in __libc_start_main (/lib64/libc.so.6+0x21b14)\r\n\r\n==2460==ABORTING\r\n```\r\n\r\nI tried banging my head for a while, but I don't see any obvious mistake anywhere I'm afraid.\r\n\r\n@mislavn "},"comment":{"url":"https://api.github.com/repos/sysrepo/sysrepo/issues/comments/253497058","html_url":"https://github.com/sysrepo/sysrepo/issues/379#issuecomment-253497058","issue_url":"https://api.github.com/repos/sysrepo/sysrepo/issues/379","id":253497058,"user":{"login":"mislavn","id":4980289,"avatar_url":"https://avatars.githubusercontent.com/u/4980289?v=3","gravatar_id":"","url":"https://api.github.com/users/mislavn","html_url":"https://github.com/mislavn","followers_url":"https://api.github.com/users/mislavn/followers","following_url":"https://api.github.com/users/mislavn/following{/other_user}","gists_url":"https://api.github.com/users/mislavn/gists{/gist_id}","starred_url":"https://api.github.com/users/mislavn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mislavn/subscriptions","organizations_url":"https://api.github.com/users/mislavn/orgs","repos_url":"https://api.github.com/users/mislavn/repos","events_url":"https://api.github.com/users/mislavn/events{/privacy}","received_events_url":"https://api.github.com/users/mislavn/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T12:19:02Z","updated_at":"2016-10-13T12:19:02Z","body":"@rastislavszabo can you take a look at this pull request:\r\n\r\nhttps://github.com/sysrepo/sysrepo/pull/417\r\n\r\nWhen USE_SR_MEM_MGMT is set OFF it fixes the segmentation fault and it does not add any memory leaks. But when USE_SR_MEM_MGMT is turned ON valgrind complains about the memory leaks caused by strdup in this patch.\r\n\r\n@rastislavszabo  should I use strdup when handling (char *) data in sr_val_t and sr_node_t structs."}}
{"actor":{"display_login":"mislavn"}}