Via one of the exposed interfaces like api interface etc.<div>Why do you need mod_curl and native curl at the same time?<span></span><br><br>On Wednesday, March 16, 2016, Chris Mandra &lt;<a href="mailto:mandra@gmail.com">mandra@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for the responses guys. I have another question: I need to call mod_curl api from my module. What&#39;s the proper way to call a module from a module?<div>thanks, chris</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 16, 2016 at 4:54 PM, Anthony Minessale <span dir="ltr">&lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;anthony.minessale@gmail.com&#39;);" target="_blank">anthony.minessale@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you use more threads you just need to make sure the objects are properly scoped.  For instance, if you want to use a session from the other thread you need to read lock it for the life of the thread.  Objects shared need to be dynamically allocated and properly mutexed etc.<span></span><div><br></div><div>Whatever thread you call curl from will be used for the whole curl operation.<div><div><br><br>On Wednesday, March 16, 2016, Michael Jerris &lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;mike@jerris.com&#39;);" target="_blank">mike@jerris.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">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><br><div><blockquote type="cite"><div>On Mar 16, 2016, at 5:00 AM, Chris Mandra &lt;<a>mandra@gmail.com</a>&gt; wrote:</div><br><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font size="2" style="font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="background-color:rgba(255,255,255,0)">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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">On Tuesday, March 15, 2016, Chris Mandra &lt;</span><a style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">mandra@gmail.com</a><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">&gt; wrote:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing: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>Should curl calls be done in separate thread or is it ok to do them in the main thread of modules?<span></span><br>On Tuesday, March 15, 2016, Anthony Minessale &lt;<a>anthony.minessale@gmail.com</a>&gt; wrote:<br><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></span><br><br>On Tuesday, March 15, 2016, Chris Mandra &lt;<a>mandra@gmail.com</a>&gt; wrote:<br><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"><div>Hey guys, I&#39;m working on a simple media bug module using FS 1.6. When a call comes in I&#39;m calling switch_curl doing an http get. </div><div><p><span>In switch_standard_app I use switch_curl and invoke switch_curl_easy_perform </span>and exit after that.</p><p>Calling switch_curl seems very unstable. It&#39;s crashing free switch most of the time.  Are there any things I should be looking for related to this? I&#39;m wondering if maybe this is a threading issue? Any ideas?</p></div><div><div>I&#39;ve included some backtraces</div><div><br></div><div><div>Thanks, chris</div></div><div><br></div><div><br></div><div><p><span>(gdb) bt</span></p><p><span>#0  0x00007f8f00c59cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56</span></p><p><span>#1  0x00007f8f00c5d0d8 in __GI_abort () at abort.c:89</span></p><p><span>#2  0x00007f8f00c96394 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7f8f00da4b28 &quot;*** Error in `%s&#39;: %s: 0x%s ***\n&quot;) at ../sysdeps/posix/libc_fatal.c:175</span></p><p><span>#3  0x00007f8f00ca266e in malloc_printerr (ptr=&lt;optimized out&gt;, str=0x7f8f00da0c19 &quot;free(): invalid pointer&quot;, action=1) at malloc.c:4996</span></p><p><span>#4  _int_free (av=&lt;optimized out&gt;, p=&lt;optimized out&gt;, have_lock=0) at malloc.c:3840</span></p><p><span>#5  0x00007f8f01334567 in switch_log_node_free (pnode=pnode@entry=0x7f8eb2b1f158) at src/switch_log.c:136</span></p><p><span>#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><span>#7  0x00007f8eeb1988a0 in listener_run (thread=&lt;optimized out&gt;, obj=0x7f8ebc027898) at mod_event_socket.c:2719</span></p><p><span>#8  0x00007f8f01544430 in dummy_worker (opaque=0x7f8eb2be4868) at threadproc/unix/thread.c:151</span></p><p><span>#9  0x00007f8f00ff0182 in start_thread (arg=0x7f8eb2b20700) at pthread_create.c:312</span></p><p><span>#10 0x00007f8f00d1d47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111</span></p><p><span><i></i></span><br></p><p><span><a href="https://soniccloud.slack.com/archives/D02UEC39S/p1458078254000027" target="_blank"><i>[</i><span><i></i></span></a></span></p><p><span><a href="https://soniccloud.slack.com/archives/D02UEC39S/p1458078254000027" target="_blank">5:44<span></span></a></span></p><p><span><a href="https://soniccloud.slack.com/archives/D02UEC39S/p1458078254000027" target="_blank"><i>]</i><span><i></i></span></a></span></p><p><span>(gdb) bt full</span></p><p><span>#0  0x00007f8f00c59cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56</span></p><p><span>       resultvar = 0</span></p><p><span>       pid = 18329</span></p><p><span>       selftid = 18421</span></p><p><span>#1  0x00007f8f00c5d0d8 in __GI_abort () at abort.c:89</span></p><p><span>       save_stage = 2</span></p><p><span>       act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {0 &lt;repeats 16 times&gt;}}, sa_flags = 0, sa_restorer = 0x0}</span></p><p><span>       sigs = {__val = {32, 0 &lt;repeats 15 times&gt;}}</span></p><p><span>#2  0x00007f8f00c96394 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7f8f00da4b28 &quot;*** Error in `%s&#39;: %s: 0x%s ***\n&quot;) at ../sysdeps/posix/libc_fatal.c:175</span></p><p><span>       ap = {{gp_offset = 40, fp_offset = 32654, overflow_arg_area = 0x7f8eb2b1f010, reg_save_area = 0x7f8eb2b1efa0}}</span></p><p><span>       fd = 2</span></p><p><span>       on_2 = &lt;optimized out&gt;</span></p><p><span>       list = &lt;optimized out&gt;</span></p><p><span>       nlist = &lt;optimized out&gt;</span></p><p><span>       cp = &lt;optimized out&gt;</span></p><p><span>       written = &lt;optimized out&gt;</span></p><p><span>#3  0x00007f8f00ca266e in malloc_printerr (ptr=&lt;optimized out&gt;, str=0x7f8f00da0c19 &quot;free(): invalid pointer&quot;, action=1) at malloc.c:4996</span></p><p><span>       buf = &quot;00007f8ed0036700&quot;</span></p><p><span>       cp = &lt;optimized out&gt;</span></p><p><span>#4  _int_free (av=&lt;optimized out&gt;, p=&lt;optimized out&gt;, have_lock=0) at malloc.c:3840</span></p><p><span>       size = &lt;optimized out&gt;</span></p><p><span>       fb = &lt;optimized out&gt;</span></p><p><span>       nextchunk = &lt;optimized out&gt;</span></p><p><span>       nextsize = &lt;optimized out&gt;</span></p><p><span>       nextinuse = &lt;optimized out&gt;</span></p><p><span>       prevsize = &lt;optimized out&gt;</span></p><p><span>       bck = &lt;optimized out&gt;</span></p><p><span>       fwd = &lt;optimized out&gt;</span></p><p><span>       errstr = &lt;optimized out&gt;</span></p><p><span>       locked = &lt;optimized out&gt;</span></p><p><span>#5  0x00007f8f01334567 in switch_log_node_free (pnode=pnode@entry=0x7f8eb2b1f158) at src/switch_log.c:136</span></p><p><span>       node = 0x7f8ed8012ab0</span></p><p><span>#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><span>       dnode = 0x7f8ed8012ab0</span></p><p><span>       do_sleep = &lt;optimized out&gt;</span></p><p><span>       mlen = 0</span></p><p><span>       bytes = 0</span></p><p><span>       mbuf = 0x7f8ecc1ebfc0 &quot;&quot;</span></p><p><span>       buf = &quot;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&quot;...</span></p><p><span>       len = 88</span></p><p><span>       status = SWITCH_STATUS_BREAK</span></p><p><span>       count = 0</span></p><p><span>       elapsed = &lt;optimized out&gt;</span></p><p><span>       start = 1457966137</span></p><p><span>       pop = 0x7f8ed8012ab0</span></p><p><span>       ptr = 0x7f8ecc1ebfc0 &quot;&quot;</span></p><p><span>       crcount = 0 &#39;\000&#39;</span></p><p><span>       buf_len = 2048</span></p><p><span>       channel = 0x0</span></p><p><span>       clen = 0</span></p><p><span>       __PRETTY_FUNCTION__ = &quot;read_packet&quot;</span></p><p><span>       __func__ = &quot;read_packet&quot;</span></p><p><span>#7  0x00007f8eeb1988a0 in listener_run (thread=&lt;optimized out&gt;, obj=0x7f8ebc027898) at mod_event_socket.c:2719</span></p><p><span>       listener = 0x7f8ebc027898</span></p><p><span>       buf = &#39;\000&#39; &lt;repeats 1023 times&gt;</span></p><p><span>       len = 1024</span></p><p><span>       status = &lt;optimized out&gt;</span></p><p><span>       event = 0x0</span></p><p><span>       reply = &quot;\000OK log level  [7]&quot;, &#39;\000&#39; &lt;repeats 493 times&gt;</span></p><p><span>       session = 0x0</span></p><p><span>       channel = 0x0</span></p><p><span>       revent = 0x0</span></p><p><span>       var = &lt;optimized out&gt;</span></p><p><span>       locked = 1</span></p><p><span>       __PRETTY_FUNCTION__ = &quot;listener_run&quot;</span></p><p><span>       __func__ = &quot;listener_run&quot;</span></p><p><span>#8  0x00007f8f01544430 in dummy_worker (opaque=0x7f8eb2be4868) at threadproc/unix/thread.c:151</span></p><p><span>       thread = 0x7f8eb2be4868</span></p><p><span>#9  0x00007f8f00ff0182 in start_thread (arg=0x7f8eb2b20700) at pthread_create.c:312</span></p><p><span>       __res = &lt;optimized out&gt;</span></p><p><span>       pd = 0x7f8eb2b20700</span></p><p><span>       now = &lt;optimized out&gt;</span></p><p><span>       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><span>       not_first_call = &lt;optimized out&gt;</span></p><p><span>       pagesize_m1 = &lt;optimized out&gt;</span></p><p><span>       sp = &lt;optimized out&gt;</span></p><p><span>       freesize = &lt;optimized out&gt;</span></p><p><span>       __PRETTY_FUNCTION__ = &quot;start_thread&quot;</span></p><p><span>#10 0x00007f8f00d1d47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111</span></p><p><span>No locals</span></p></div></div></div></blockquote><br></blockquote></blockquote></div></blockquote></div><br></div></div></blockquote></div></div></div><br><div><div><br>-- <br><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Anthony Minessale II       ♬ @anthmfs  ♬ @FreeSWITCH  ♬<div><br><div>☞ <a href="http://freeswitch.org/" target="_blank">http://freeswitch.org/</a>  ☞ <a href="http://cluecon.com/" target="_blank">http://cluecon.com/</a>  ☞ <a href="http://twitter.com/FreeSWITCH" target="_blank">http://twitter.com/FreeSWITCH</a></div><div><div>☞ <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch ☞ <u><a href="http://freeswitch.org/g+" target="_blank">http://freeswitch.org/g+</a></u><br><br></div><div>ClueCon Weekly Development Call <br></div><div>☎ <a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;sip:888@conference.freeswitch.org&#39;);" target="_blank">sip:888@conference.freeswitch.org</a>  ☎ <a href="tel:%2B19193869900" value="+19193869900" target="_blank">+19193869900</a> </div><div><br></div></div></div><div><a href="https://www.youtube.com/watch?v=9XXgW34t40s" style="color:rgb(17,85,204);font-size:12.8000001907349px" target="_blank">https://www.youtube.com/watch?v=9XXgW34t40s</a></div><div><a href="https://www.youtube.com/watch?v=NLaDpGQuZDA" target="_blank">https://www.youtube.com/watch?v=NLaDpGQuZDA</a><br></div></div></div></div></div></div><br>
</div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;consulting@freeswitch.org&#39;);" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;FreeSWITCH-users@lists.freeswitch.org&#39;);" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>mandra<br>c:410.258.5281</div>
</div>
</blockquote></div><br><br>-- <br><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Anthony Minessale II       ♬ @anthmfs  ♬ @FreeSWITCH  ♬<div><br><div>☞ <a href="http://freeswitch.org/" target="_blank">http://freeswitch.org/</a>  ☞ <a href="http://cluecon.com/" target="_blank">http://cluecon.com/</a>  ☞ <a href="http://twitter.com/FreeSWITCH" target="_blank">http://twitter.com/FreeSWITCH</a></div><div><div>☞ <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch ☞ <u><a href="http://freeswitch.org/g+" target="_blank">http://freeswitch.org/g+</a></u><br><br></div><div>ClueCon Weekly Development Call <br></div><div>☎ <a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a>  ☎ +19193869900 </div><div><br></div></div></div><div><a href="https://www.youtube.com/watch?v=9XXgW34t40s" style="color:rgb(17,85,204);font-size:12.8000001907349px" target="_blank">https://www.youtube.com/watch?v=9XXgW34t40s</a></div><div><a href="https://www.youtube.com/watch?v=NLaDpGQuZDA" target="_blank">https://www.youtube.com/watch?v=NLaDpGQuZDA</a><br></div></div></div></div></div></div><br>