<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">depends on your needs. The concern would be trying to access those objects across threads potentially could cause issues depending on if they are syncronized or not, easier to just not do it and not have the concern. Anthony is suggesting looking at how we do it in other places. Life cycle could be an issue, are you destroying things too early?<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 16, 2016, at 5:00 AM, Chris Mandra <<a href="mailto:mandra@gmail.com" class="">mandra@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Thanks for responding Anthony. Can you tell me this:</span><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><font size="2" style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">Should curl calls be done in separate thread or is it ok to do them in the main thread of modules?</span></font><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On Tuesday, March 15, 2016, Chris Mandra <</span><a href="mailto:mandra@gmail.com" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">mandra@gmail.com</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">> wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><br class="">Should curl calls be done in separate thread or is it ok to do them in the main thread of modules?<span class=""></span><br class="">On Tuesday, March 15, 2016, Anthony Minessale <<a target="_blank" class="">anthony.minessale@gmail.com</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Curl is used in a few places and is not unstable. Study some of those mods and maybe you can see how to use it in a typical situation. Probably its related to memory management or lifecycle of objects you may be using.<span class=""></span><br class=""><br class="">On Tuesday, March 15, 2016, Chris Mandra <<a class="">mandra@gmail.com</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class=""><div class="">Hey guys, I'm working on a simple media bug module using FS 1.6. When a call comes in I'm calling switch_curl doing an http get. </div><div class=""><p class=""><span class="">In switch_standard_app I use switch_curl and invoke switch_curl_easy_perform </span>and exit after that.</p><p class="">Calling switch_curl seems very unstable. It's crashing free switch most of the time. Are there any things I should be looking for related to this? I'm wondering if maybe this is a threading issue? Any ideas?</p></div><div class=""><div class="">I've included some backtraces</div><div class=""><br class=""></div><div class=""><div class="">Thanks, chris</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><p class=""><span class="">(gdb) bt</span></p><p class=""><span class="">#0 0x00007f8f00c59cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56</span></p><p class=""><span class="">#1 0x00007f8f00c5d0d8 in __GI_abort () at abort.c:89</span></p><p class=""><span class="">#2 0x00007f8f00c96394 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7f8f00da4b28 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175</span></p><p class=""><span class="">#3 0x00007f8f00ca266e in malloc_printerr (ptr=<optimized out>, str=0x7f8f00da0c19 "free(): invalid pointer", action=1) at malloc.c:4996</span></p><p class=""><span class="">#4 _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:3840</span></p><p class=""><span class="">#5 0x00007f8f01334567 in switch_log_node_free (pnode=pnode@entry=0x7f8eb2b1f158) at src/switch_log.c:136</span></p><p class=""><span class="">#6 0x00007f8eeb192a24 in read_packet (listener=listener@entry=0x7f8ebc027898, event=event@entry=0x7f8eb2b1f7f0, timeout=timeout@entry=0) at mod_event_socket.c:1361</span></p><p class=""><span class="">#7 0x00007f8eeb1988a0 in listener_run (thread=<optimized out>, obj=0x7f8ebc027898) at mod_event_socket.c:2719</span></p><p class=""><span class="">#8 0x00007f8f01544430 in dummy_worker (opaque=0x7f8eb2be4868) at threadproc/unix/thread.c:151</span></p><p class=""><span class="">#9 0x00007f8f00ff0182 in start_thread (arg=0x7f8eb2b20700) at pthread_create.c:312</span></p><p class=""><span class="">#10 0x00007f8f00d1d47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111</span></p><p class=""><span class=""><i class=""></i></span><br class=""></p><p class=""><span class=""><a href="https://soniccloud.slack.com/archives/D02UEC39S/p1458078254000027" target="_blank" class=""><i class="">[</i><span class=""><i class=""></i></span></a></span></p><p class=""><span class=""><a href="https://soniccloud.slack.com/archives/D02UEC39S/p1458078254000027" target="_blank" class="">5:44<span class=""></span></a></span></p><p class=""><span class=""><a href="https://soniccloud.slack.com/archives/D02UEC39S/p1458078254000027" target="_blank" class=""><i class="">]</i><span class=""><i class=""></i></span></a></span></p><p class=""><span class="">(gdb) bt full</span></p><p class=""><span class="">#0 0x00007f8f00c59cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56</span></p><p class=""><span class=""> resultvar = 0</span></p><p class=""><span class=""> pid = 18329</span></p><p class=""><span class=""> selftid = 18421</span></p><p class=""><span class="">#1 0x00007f8f00c5d0d8 in __GI_abort () at abort.c:89</span></p><p class=""><span class=""> save_stage = 2</span></p><p class=""><span class=""> act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {0 <repeats 16 times>}}, sa_flags = 0, sa_restorer = 0x0}</span></p><p class=""><span class=""> sigs = {__val = {32, 0 <repeats 15 times>}}</span></p><p class=""><span class="">#2 0x00007f8f00c96394 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7f8f00da4b28 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175</span></p><p class=""><span class=""> ap = {{gp_offset = 40, fp_offset = 32654, overflow_arg_area = 0x7f8eb2b1f010, reg_save_area = 0x7f8eb2b1efa0}}</span></p><p class=""><span class=""> fd = 2</span></p><p class=""><span class=""> on_2 = <optimized out></span></p><p class=""><span class=""> list = <optimized out></span></p><p class=""><span class=""> nlist = <optimized out></span></p><p class=""><span class=""> cp = <optimized out></span></p><p class=""><span class=""> written = <optimized out></span></p><p class=""><span class="">#3 0x00007f8f00ca266e in malloc_printerr (ptr=<optimized out>, str=0x7f8f00da0c19 "free(): invalid pointer", action=1) at malloc.c:4996</span></p><p class=""><span class=""> buf = "00007f8ed0036700"</span></p><p class=""><span class=""> cp = <optimized out></span></p><p class=""><span class="">#4 _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:3840</span></p><p class=""><span class=""> size = <optimized out></span></p><p class=""><span class=""> fb = <optimized out></span></p><p class=""><span class=""> nextchunk = <optimized out></span></p><p class=""><span class=""> nextsize = <optimized out></span></p><p class=""><span class=""> nextinuse = <optimized out></span></p><p class=""><span class=""> prevsize = <optimized out></span></p><p class=""><span class=""> bck = <optimized out></span></p><p class=""><span class=""> fwd = <optimized out></span></p><p class=""><span class=""> errstr = <optimized out></span></p><p class=""><span class=""> locked = <optimized out></span></p><p class=""><span class="">#5 0x00007f8f01334567 in switch_log_node_free (pnode=pnode@entry=0x7f8eb2b1f158) at src/switch_log.c:136</span></p><p class=""><span class=""> node = 0x7f8ed8012ab0</span></p><p class=""><span class="">#6 0x00007f8eeb192a24 in read_packet (listener=listener@entry=0x7f8ebc027898, event=event@entry=0x7f8eb2b1f7f0, timeout=timeout@entry=0) at mod_event_socket.c:1361</span></p><p class=""><span class=""> dnode = 0x7f8ed8012ab0</span></p><p class=""><span class=""> do_sleep = <optimized out></span></p><p class=""><span class=""> mlen = 0</span></p><p class=""><span class=""> bytes = 0</span></p><p class=""><span class=""> mbuf = 0x7f8ecc1ebfc0 ""</span></p><p class=""><span class=""> buf = "Content-Type: log/data\nContent-Length: 88\nLog-Level: 7\nText-Channel: 3\nLog-File: param_hps_strategy.cpp\nLog-Func: retrieve\nLog-Line: 115\nUser-Data: \347@\247\a\n\n\000\n\n\000\065-418f-a6d1-9dc8f48e0cf9\n\n\000\000\071\n\n\000c8f48e0cf9"...</span></p><p class=""><span class=""> len = 88</span></p><p class=""><span class=""> status = SWITCH_STATUS_BREAK</span></p><p class=""><span class=""> count = 0</span></p><p class=""><span class=""> elapsed = <optimized out></span></p><p class=""><span class=""> start = 1457966137</span></p><p class=""><span class=""> pop = 0x7f8ed8012ab0</span></p><p class=""><span class=""> ptr = 0x7f8ecc1ebfc0 ""</span></p><p class=""><span class=""> crcount = 0 '\000'</span></p><p class=""><span class=""> buf_len = 2048</span></p><p class=""><span class=""> channel = 0x0</span></p><p class=""><span class=""> clen = 0</span></p><p class=""><span class=""> __PRETTY_FUNCTION__ = "read_packet"</span></p><p class=""><span class=""> __func__ = "read_packet"</span></p><p class=""><span class="">#7 0x00007f8eeb1988a0 in listener_run (thread=<optimized out>, obj=0x7f8ebc027898) at mod_event_socket.c:2719</span></p><p class=""><span class=""> listener = 0x7f8ebc027898</span></p><p class=""><span class=""> buf = '\000' <repeats 1023 times></span></p><p class=""><span class=""> len = 1024</span></p><p class=""><span class=""> status = <optimized out></span></p><p class=""><span class=""> event = 0x0</span></p><p class=""><span class=""> reply = "\000OK log level [7]", '\000' <repeats 493 times></span></p><p class=""><span class=""> session = 0x0</span></p><p class=""><span class=""> channel = 0x0</span></p><p class=""><span class=""> revent = 0x0</span></p><p class=""><span class=""> var = <optimized out></span></p><p class=""><span class=""> locked = 1</span></p><p class=""><span class=""> __PRETTY_FUNCTION__ = "listener_run"</span></p><p class=""><span class=""> __func__ = "listener_run"</span></p><p class=""><span class="">#8 0x00007f8f01544430 in dummy_worker (opaque=0x7f8eb2be4868) at threadproc/unix/thread.c:151</span></p><p class=""><span class=""> thread = 0x7f8eb2be4868</span></p><p class=""><span class="">#9 0x00007f8f00ff0182 in start_thread (arg=0x7f8eb2b20700) at pthread_create.c:312</span></p><p class=""><span class=""> __res = <optimized out></span></p><p class=""><span class=""> pd = 0x7f8eb2b20700</span></p><p class=""><span class=""> now = <optimized out></span></p><p class=""><span class=""> unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140250860095232, -640791540281233069, 0, 0, 140250860095936, 140250860095232, 578173923610734931, 577994035108262227}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}</span></p><p class=""><span class=""> not_first_call = <optimized out></span></p><p class=""><span class=""> pagesize_m1 = <optimized out></span></p><p class=""><span class=""> sp = <optimized out></span></p><p class=""><span class=""> freesize = <optimized out></span></p><p class=""><span class=""> __PRETTY_FUNCTION__ = "start_thread"</span></p><p class=""><span class="">#10 0x00007f8f00d1d47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111</span></p><p class=""><span class="">No locals</span></p></div></div></div></blockquote><br class=""></blockquote></blockquote></div></blockquote></div><br class=""></div></body></html>