{"action":"created","issue":{"url":"https://api.github.com/repos/wandenberg/nginx-push-stream-module/issues/228","repository_url":"https://api.github.com/repos/wandenberg/nginx-push-stream-module","labels_url":"https://api.github.com/repos/wandenberg/nginx-push-stream-module/issues/228/labels{/name}","comments_url":"https://api.github.com/repos/wandenberg/nginx-push-stream-module/issues/228/comments","events_url":"https://api.github.com/repos/wandenberg/nginx-push-stream-module/issues/228/events","html_url":"https://github.com/wandenberg/nginx-push-stream-module/issues/228","id":137219560,"number":228,"title":"0.5.1 segfaults on ngx_http_push_stream_get_formatted_message","user":{"login":"abregar","id":1748792,"avatar_url":"https://avatars.githubusercontent.com/u/1748792?v=3","gravatar_id":"","url":"https://api.github.com/users/abregar","html_url":"https://github.com/abregar","followers_url":"https://api.github.com/users/abregar/followers","following_url":"https://api.github.com/users/abregar/following{/other_user}","gists_url":"https://api.github.com/users/abregar/gists{/gist_id}","starred_url":"https://api.github.com/users/abregar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abregar/subscriptions","organizations_url":"https://api.github.com/users/abregar/orgs","repos_url":"https://api.github.com/users/abregar/repos","events_url":"https://api.github.com/users/abregar/events{/privacy}","received_events_url":"https://api.github.com/users/abregar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-29T10:59:18Z","updated_at":"2016-03-02T09:35:51Z","closed_at":null,"body":"This happens on one of my sites (nginx 1.2.8, luajit-2.0.4,lua-nginx-module-0.9.16,nginx-push-stream-module-0.5.1)\r\n\r\n`#0  0x000000000050b54e in ngx_http_push_stream_get_formatted_message (r=0xe043e10, channel=0x7f43ff0f0500, message=0x0)\r\n    at ../nginx-push-stream-module-0.5.1/src/ngx_http_push_stream_module_utils.c:1303\r\n        pslcf = 0x23e8f80\r\n#1  0x000000000050912c in ngx_http_push_stream_send_response_message (r=0xe043e10, channel=0x7f43ff0f0500, msg=0x0, send_callback=1, send_separator=0)\r\n    at ../nginx-push-stream-module-0.5.1/src/ngx_http_push_stream_module_utils.c:538\r\n        str = 0x400\r\n        pslcf = 0x23e8f80\r\n        ctx = 0xe4068c8\r\n        use_jsonp = 0\r\n        rc = 0\r\n#2  0x0000000000507dfe in ngx_http_push_stream_delete_channels_data (data=0x7f43fd9af000)\r\n    at ../nginx-push-stream-module-0.5.1/src/ngx_http_push_stream_module_utils.c:123\r\n        subscription = 0xca2f9f8\r\n        subscriber = 0xe406a20\r\n        channel = 0x7f43ff0f0500\r\n        worker = 0x7f440252fa80\r\n        cur_worker = 0x7f440252fa80\r\n        cur = 0xca2fa08\r\n        q = 0x7f43ff0f0528\r\n#3  0x000000000050a99f in ngx_http_push_stream_memory_cleanup () at ../nginx-push-stream-module-0.5.1/src/ngx_http_push_stream_module_utils.c:1048\r\n        data = 0x7f43fd9af000\r\n        global_data = 0x7f44070c6000\r\n        q = 0x7f43fd9bd1e8\r\n...\r\n(gdb) p *message\r\nCannot access memory at address 0x0\r\n`\r\n\r\nat core dump dmesg also says:\r\n`nginx-push[5763]: segfault at 68 ip 000000000050b54e sp 00007fffde6b6270 error 4 in nginx-push[400000+149000]\r\nOut of socket memory\r\nOut of socket memory\r\n...`\r\n\r\nand error log is interesting:\r\n`2016/02/29 01:21:55 [alert] 5762#0: worker process 5763 exited on signal 11 (core dumped)\r\n2016/02/29 09:01:59 [alert] 5762#0: worker process 10670 exited on signal 9\r\n2016/02/29 09:01:59 [alert] 5762#0: shared memory zone \"push_stream_module_global\" was locked by 10670\r\n2016/02/29 09:02:00 [alert] 5762#0: worker process 5765 exited on signal 9\r\n2016/02/29 09:02:00 [alert] 5762#0: worker process 5772 exited on signal 9\r\n2016/02/29 09:02:00 [alert] 5762#0: worker process 5774 exited on signal 9`\r\n\r\nso I would like to raise two questions:\r\n- can you easily see if message may be indeed owerwritten?\r\n- is shmem unlocked after worker crash or not?\r\n\r\nthank you very much in advance"},"comment":{"url":"https://api.github.com/repos/wandenberg/nginx-push-stream-module/issues/comments/191154940","html_url":"https://github.com/wandenberg/nginx-push-stream-module/issues/228#issuecomment-191154940","issue_url":"https://api.github.com/repos/wandenberg/nginx-push-stream-module/issues/228","id":191154940,"user":{"login":"abregar","id":1748792,"avatar_url":"https://avatars.githubusercontent.com/u/1748792?v=3","gravatar_id":"","url":"https://api.github.com/users/abregar","html_url":"https://github.com/abregar","followers_url":"https://api.github.com/users/abregar/followers","following_url":"https://api.github.com/users/abregar/following{/other_user}","gists_url":"https://api.github.com/users/abregar/gists{/gist_id}","starred_url":"https://api.github.com/users/abregar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abregar/subscriptions","organizations_url":"https://api.github.com/users/abregar/orgs","repos_url":"https://api.github.com/users/abregar/repos","events_url":"https://api.github.com/users/abregar/events{/privacy}","received_events_url":"https://api.github.com/users/abregar/received_events","type":"User","site_admin":false},"created_at":"2016-03-02T09:35:51Z","updated_at":"2016-03-02T09:35:51Z","body":"ok, tnx for the hint.\r\nBut according to core dump of mine, msg allocation happens on a different point for this case.\r\nIt is channel_deleted msg on shmem cleanup, looks like allocated at\r\n`\r\nngx_http_push_stream_convert_char_to_msg_on_shared  (l.262 utils)\r\n`\r\nShould this one also be calloc?\r\n\r\nOther question - how can one monitor shared memory usage size?"}}