Skip to content
Snippets Groups Projects
  1. Nov 26, 2018
    • Joshua Colp's avatar
      stasis: Use an implementation specific channel snapshot cache. · d0ccbb33
      Joshua Colp authored
      Channels no longer use the Stasis cache for channel snapshots. Instead
      they are stored in a hash table in stasis_channels which reduces the
      number of Stasis messages created and allows better storage.
      
      As a result the following APIs are no longer available since the stasis
      cache is no longer used:
      ast_channel_topic_cached()
      ast_channel_topic_all_cached()
      
      The ast_channel_cache_all() and ast_channel_cache_by_name() functions
      now return an ao2_container of ast_channel_snapshots rather than
      a container of stasis_messages therefore you can't (and don't need
      to) call stasis_cache functions on it.
      
      The ast_channel_topic_all() function now returns a normal topic not
      a cached one so you can't use stasis cache functions on it either.
      
      The ast_channel_snapshot_type() stasis message now has the
      ast_channel_snapshot_update structure as it's data. It contains the
      last snapshot and the new one.
      
      ast_channel_snapshot_get_latest() still returns the latest snapshot.
      
      The latest snapshot is now stored on the channel itself to eliminate
      cache hits when Stasis messages that have the snapshot as a payload
      are created.
      
      ASTERISK-28102
      
      Change-Id: I9334febff60a82d7c39703e49059fa3a68825786
      d0ccbb33
  2. Nov 21, 2018
  3. Nov 19, 2018
    • George Joseph's avatar
      backtrace: Refactor ast_bt_get_symbols so it doesn't crash · ece5f801
      George Joseph authored
      We've been seeing crashes in libbfd when we attempt to generate
      a stack trace from multiple threads.  It turns out that libbfd
      is NOT thread-safe.  It can cache the bfd structure and give it to
      multiple threads without protecting itself.  To get around this,
      we've added a global mutex around the bfd functions and also have
      refactored the use of those functions to be more efficient and
      to provide more information about inlined functions.
      
      Also added a few more tests to test_pbx.c.  One just calls
      ast_assert() and the other calls ast_log_backtrace().  Neither are
      run by default.
      
      WARNING:  This change necessitated changing the return value of
      ast_bt_get_symbols() from an array of strings to a VECTOR of
      strings.  However, the use of this function outside Asterisk is not
      likely.
      
      ASTERISK-28140
      
      Change-Id: I79d02862ddaa2423a0809caa4b3b85c128131621
      ece5f801
  4. Nov 18, 2018
    • Joshua C. Colp's avatar
      stasis: Remove stringfields and lock from change message. · 56eb18f3
      Joshua C. Colp authored
      When a subscribe or unsubscribe occurs a message is published
      containing this information. This change makes it so that the
      message no longer uses stringfields or a lock, as both are not
      really needed for the message.
      
      Change-Id: I3f4831931d79f94fd979baf48048738df5dc1632
      56eb18f3
    • Joshua Colp's avatar
      stasis: Add internal filtering of messages. · 3077ad0c
      Joshua Colp authored
      This change adds the ability for subscriptions to indicate
      which message types they are interested in accepting. By
      doing so the filtering is done before being dispatched
      to the subscriber, reducing the amount of work that has
      to be done.
      
      This is optional and if a subscriber does not add
      message types they wish to accept and set the subscription
      to selective filtering the previous behavior is preserved
      and they receive all messages.
      
      There is also the ability to explicitly force the reception
      of all messages for cases such as AMI or ARI where a large
      number of messages are expected that are then generically
      converted into a different format.
      
      ASTERISK-28103
      
      Change-Id: I99bee23895baa0a117985d51683f7963b77aa190
      3077ad0c
  5. Nov 16, 2018
    • Corey Farrell's avatar
      taskprocessor: Prevent race creating new taskprocessor. · 9abd5e10
      Corey Farrell authored
      Task processors are retrieved using a 'get or create' pattern.  The
      singleton container was unlocked between the get and create steps so
      it's possible that two threads could create task processors with the
      same name at the same time.
      
      Change-Id: Id64fae94a6a1e940ddf38fde622dcd4391635382
      Unverified
      9abd5e10
  6. Nov 15, 2018
  7. Nov 14, 2018
    • George Joseph's avatar
      AST-2018-010: Fix length of buffer needed for SRV and NAPTR results · eb5b83b8
      George Joseph authored
      When dn_expand was being called on SRV and NAPTR results, the
      return value was being used to calculate the size of the buffer
      needed to store the host names.  Since dn_expand returns the
      length of the COMPRESSED name the buffer could be too short
      to hold the EXPANDED name.  The expanded name is NULL terminated
      so using strlen() is the correct way to determine the length
      actually needed for the buffer.
      
      ASTERISK-28127
      Reported by: Jan Hoffmann
      
      patches:
        patch.diff submitted by janhoffmann (license 6986)
      
      Change-Id: I4d35d6c431c6c6836cb61d37b1378cc47f0b414d
      eb5b83b8
  8. Nov 12, 2018
  9. Nov 11, 2018
  10. Oct 24, 2018
    • Richard Mudgett's avatar
      logger.c: Fix default console logging when no logger.conf available. · 1b397ebd
      Richard Mudgett authored
      Default logging was not setup correctly when there was no logger.conf.
      This resulted in many expected log messages not actually getting out to
      the console.
      
      Change-Id: I542e61c03b2f630ff5327f9de5641d776c6fa70c
      1b397ebd
    • George Joseph's avatar
      bridge_softmix: Add SDP "label" attribute to streams · 8d1c6bb6
      George Joseph authored
      Adding the "label" attribute used for participant info correlation
      was previously done in app_confbridge but it wasn't working
      correctly because it didn't have knowledge about which video
      streams belonged to which channel.  Only bridge_softmix has that
      data so now it's set when the bridge topology is changed.
      
      ASTERISK-28107
      
      Change-Id: Ieddeca5799d710cad083af3fcc3e677fa2a2a499
      8d1c6bb6
  11. Oct 23, 2018
  12. Oct 19, 2018
    • Corey Farrell's avatar
      astobj2: Eliminate legacy container allocation macros. · 687ab7ae
      Corey Farrell authored
      These macros have been documented as legacy for a long time but are
      still used in new code because they exist.  Remove all references to:
      * ao2_container_alloc_options
      * ao2_t_container_alloc_options
      * ao2_t_container_alloc
      
      These macro's are also removed.  Only ao2_container_alloc remains due to
      it's use in over 100 places.
      
      Change-Id: I1a26258b5bf3deb081aaeed11a0baa175c933c7a
      Unverified
      687ab7ae
    • Corey Farrell's avatar
      lock: Replace __ast_mutex_logger with private log_mutex_error. · 4c19b949
      Corey Farrell authored
      __ast_mutex_logger used the variable `canlog` without accepting it as a
      argument.  Replace with internal macro `log_mutex_error` which takes
      canlog as the first arguement.  This will prevent confusion when working
      with lock.c code, many of the function declare the canlog variable and
      in some cases it previously appeared to be unused.
      
      Change-Id: I83b372cb0654c5c18eadc512f65a57fa6c2e9853
      Unverified
      4c19b949
  13. Oct 18, 2018
  14. Oct 17, 2018
  15. Oct 15, 2018
    • Corey Farrell's avatar
      refdebug: Create refstats.py script. · 79677ead
      Corey Farrell authored
      This allows us to process AO2 statistics for total objects, memory
      usage, memory overhead and lock usage.
      
      * Install refstats.py and reflocks.py into the Asterisk scripts folder.
      * Enable support for reflocks.py without DEBUG_THREADS.
      
      Steal a bit from the ao2 magic to flag when an object lock is used.
      Remove 'lockobj' from reflocks.py since we can now record 'used' or
      'unused' for those objects.
      
      Add comments to explain thread safety of the 'struct __priv_data'
      bitfields.
      
      Change-Id: I84e9d679cc86d772cc97c888d9d856a17e0d3a4a
      79677ead
  16. Oct 13, 2018
    • Corey Farrell's avatar
      threadpool: Eliminate pointless AO2 usage. · f06de690
      Corey Farrell authored
      thread_worker_pair, set_size_data and task_pushed_data structures are
      allocated with AO2 objects, passed to a taskprocessor, then released.
      They never have multiple owners or use locking so AO2 only adds
      overhead.
      
      Change-Id: I2204d2615d9d952670fcb48e0a9c0dd1a6ba5036
      f06de690
  17. Oct 12, 2018
    • Corey Farrell's avatar
      main/astfd: Fix GCC8 format-truncation warning. · 675d8a46
      Corey Farrell authored
      The field used to store call arguments was not large enough to hold the
      arguments string that can be constructed for 'open'.  Expand it to
      prevent this warning/error.
      
      Change-Id: I514927f256481bc84df10a51b19d5b5fb1bc387e
      675d8a46
  18. Oct 05, 2018
    • neutrino88's avatar
      core/frame: generate correct T.140 payload in ast_sendtext_data() · 17f4e6ad
      neutrino88 authored
      ast_sendtext_data() would create an incorrect T.140 text frame which
      length include the null terminator byte. It causes ultimately RTP
      packets to be send with this trailing 0. The proposed fix just set the
      correct length to the text frame
      
      ASTERISK-28089
      Reported by: Emmanuel BUU
      Tested by: Emmanuel BUU
      
      Change-Id: I7ab1b9ed1e21683b2b667ea0a59d9aba3c77dd96
      17f4e6ad
  19. Oct 04, 2018
    • Corey Farrell's avatar
      loader: Flag module as declined in all cases where it fails to load. · c8ee1a18
      Corey Farrell authored
      This has no effect on startup since AST_MODULE_LOAD_FAILURE aborts
      startup, but it's possible for this code to be returned on manual load
      of a module after startup.
      
      It is an error for a module to not have a load callback but this is not
      a fatal system error.  In this case flag the module as declined, return
      AST_MODULE_LOAD_FAILURE only if a required module is broken.
      
      Expand doxygen documentation for AST_MODULE_LOAD_*.
      
      Change-Id: I3c030bb917f6e5a0dfd9d91491a4661b348cabf8
      Unverified
      c8ee1a18
  20. Oct 03, 2018
    • Corey Farrell's avatar
      astobj2: Comment on OBJ_NOLOCK in ao2_container_clone. · 932d0a40
      Corey Farrell authored
      The test for OBJ_NOLOCK looks wrong but it isn't.  Add comments to
      prevent confusion.
      
      Change-Id: I9662b82eb39e7627a1f1944fd18f967a2b987344
      932d0a40
    • Sean Bright's avatar
      http.c: Reload TLS even if http.conf hasn't changed · 286339aa
      Sean Bright authored
      There is currently no way to indicate to Asterisk that TLS certificates
      and/or keys have been updated other than by modifying http.conf or
      restarting Asterisk.
      
      There is already code in main/tcptls.c that determines if a reload is
      actually necessary based on the hashes of the certicate and dependent
      files, so this change merely gives us a way to request a reload without
      explicitly modifying http.conf.
      
      Change-Id: Ie795420dcc7eb3d91336820688a29adbcc321276
      286339aa
  21. Oct 02, 2018
    • Corey Farrell's avatar
      core: Disable astobj2 locking for some common objects. · cacbe325
      Corey Farrell authored
      * ACO options
      * Indications
      * Module loader ref_debug object
      * Media index info and variants
      * xmldoc items
      
      These allocation locations were identified using reflocks.py on the
      master branch.
      
      Change-Id: Ie999b9941760be3d1946cdb6e30cb85fd97504d8
      Unverified
      cacbe325
    • Corey Farrell's avatar
      loader: Fix result of module reload error. · b25a261a
      Corey Farrell authored
      When a module reload fails we never set AST_MODULE_RELOAD_ERROR.  This
      caused reload failures to incorrectly report 'No module found'.
      
      Change-Id: I5f3953e0f7d135e53ec797f24c97ee3f73f232e7
      Unverified
      b25a261a
    • Corey Farrell's avatar
      loader: Improve error handling. · e4cf513f
      Corey Farrell authored
      * Display list of unavailable dependencies when they cause another
        module to fail loading.
      * When a module declines to load find all modules which depend on it so
        they can be declined and listed together.
      * Prevent retry of declined modules during startup.
      * When a module fails to dlopen try loading it with RTLD_LAZY so we can
        attempt to display the list of missing dependencies.
      
      These changes are meant to reduce logger spam that is caused when a
      module has many dependencies and declines to load.  This also fixes some
      error paths which failed to recognize required modules.
      
      Module load/start errors are delayed until the end of loader startup.
      
      Change-Id: I046052c71331c556c09d39f47a3b92975f3e1758
      Unverified
      e4cf513f
    • neutrino88's avatar
      core/frame: Fix ast_frdup() and ast_frisolate() for empty text frames · 24cece66
      neutrino88 authored
      If a channel creates an AST_TEXT_FRAME with datalen == 0, the ast_frdup()
      and ast_frisolate() functions could create a clone frame with an invalid
      data.ptr which would cause a crash.  The proposed fix is to make sure that
      for such empty text frames, ast_frdup() and ast_frisolate() return cloned
      text frames with a valid data.ptr.
      
      ASTERISK-28076
      Reported by: Emmanuel BUU
      Tested by: Emmanuel BUU
      
      Change-Id: Ib882dd028598f13c4c233edbfdd7e54ad44a68e9
      24cece66
    • Corey Farrell's avatar
      astobj2: Record lock usage to refs log when DEBUG_THREADS is enabled. · 13df7452
      Corey Farrell authored
      When DEBUG_THREADS is enabled we can know if the astobj2 mutex / rwlock
      was ever used, so it can be recorded in the REF_DEBUG destructor entry.
      
      Create contrib/scripts/reflocks.py to process locking used by
      allocator.  This can be used to identify places where
      AO2_ALLOC_OPT_LOCK_NOLOCK should be used to reduce memory usage.
      
      Change-Id: I2e3cd23336a97df2692b545f548fd79b14b53bf4
      Unverified
      13df7452
  22. Sep 28, 2018
    • Corey Farrell's avatar
      lock: Improve performance of DEBUG_THREADS. · 205c6be8
      Corey Farrell authored
      Add a volatile flag to lock tracking structures so we only need to use
      the global lock when first initializing tracking.
      
      Additionally add support for DEBUG_THREADS_LOOSE_ABI.  This is used by
      astobj2.c to eliminate storage for tracking fields when DEBUG_THREADS is
      not defined.
      
      Change-Id: Iabd650908901843e9fff47ef1c539f0e1b8cb13b
      Unverified
      205c6be8
  23. Sep 27, 2018
    • Corey Farrell's avatar
      astobj2: Reduce memory overhead. · 62a0db2d
      Corey Farrell authored
      Reduce options to 2-bit field, magic to 30 bit field.  Move ref_counter
      next to options and explicitly use int32_t so the fields will pack.
      
      This reduces memory overhead for every ao2 object by 8 bytes on x86_64.
      
      Change-Id: Idc1baabb35ec3b3d8de463c4fa3011eaf7fcafb5
      Unverified
      62a0db2d
    • Sean Bright's avatar
      config.c: Cleanup AST_INCLUDE_GLOB · ac23e5ad
      Sean Bright authored
      * In main/config.c, AST_INCLUDE_GLOB is fixed to '1' making the #ifdefs
        pointless.
      
      * In utils/extconf.c, AST_INCLUDE_GLOB is never defined so there is a
        lot of dead code.
      
      Change-Id: I1bad1a46d7466ddf90d52cc724e997195495226c
      ac23e5ad
    • Corey Farrell's avatar
      astobj2: Fix shutdown order. · 39bf9881
      Corey Farrell authored
      When REF_DEBUG and AO2_DEBUG are both enabled we closed the refs log
      before we shutdown astobj2_container.  This caused the AO2_DEBUG
      container registration container to be reported as a leak.
      
      Change-Id: If9111c4c21c68064b22c546d5d7a41fac430430e
      Unverified
      39bf9881
  24. Sep 24, 2018
    • Corey Farrell's avatar
      jansson: Backport fixes to bundled, use json_vsprintf if available. · adf539b2
      Corey Farrell authored
      Use json_vsprintf from versions which contain fix for va_copy leak.
      
      Apply fixes from jansson master:
      * va_copy leak fix.
      * Avoid potential invalid memory read in json_pack.
      * Rename variable that shadowed another.
      
      Change-Id: I7522e462d2a52f53010ffa1e7d705c666ec35539
      adf539b2
    • Corey Farrell's avatar
      json: Take advantage of new API's. · 93777faf
      Corey Farrell authored
      * Use "o*" format specifier for optional fields in ast_json_party_id.
      * Stop using ast_json_deep_copy on immutable objects, it is now thread
        safe to just use ast_json_ref.
      
      Additional changes to ast_json_pack calls in the vicinity:
      * Use "O" when an object needs to be bumped.  This was previously
        avoided as it was not thread safe.
      * Use "o?" and "O?" to replace NULL with ast_json_null().  The
        "?" is a new feature of ast_json_pack starting with Asterisk 16.
      
      Change-Id: I8382d28d7d83ee0ce13334e51ae45dbc0bdaef48
      Unverified
      93777faf
    • George Joseph's avatar
      app_voicemail: Cleanup mailbox topic and cache · 06c0676d
      George Joseph authored
      app_voicemail wasn't properly cleaning up the stasis cache or the
      mwi topic pool when the module was unloaded or when a user was
      deleted as a result of a reload.  This resulted in leaks in both
      areas.
      
      * app_voicemail now calls ast_delete_mwi_state_full when it frees
        a user structure and ast_delete_mwi_state_full in turn now calls
        the new stasis_topic_pool_delete_topic function to clear the topic
        from the pool.
      
      Change-Id: Ide23144a4a810e7e0faad5a8e988d15947965df8
      06c0676d
  25. Sep 21, 2018
    • Kevin Harwell's avatar
      rtp_engine: rtcp_report_to_json can overflow the ssrc integer value · 31fba4e8
      Kevin Harwell authored
      When writing an RTCP report to json the code attempts to pack the "ssrc" and
      "source_ssrc" unsigned integer values as a signed int value type. This of course
      means if the ssrc's unsigned value is greater than that which can fit into a
      signed integer value it gets converted to a negative number. Subsequently, the
      negative value goes out in the json report.
      
      This patch now packs the value as a json_int_t, which is the widest integer type
      available on a given system. This should make it so the value no longer
      overflows.
      
      Note, this was caught by two failing tests hep/rtcp-receiver/ and
      hep/rtcp-sender.
      
      Change-Id: I2af275286ee5e795b79f0c3d450d9e4b28e958b0
      Unverified
      31fba4e8
    • George Joseph's avatar
      channel.c: Address stack overflow in does_id_conflict() · 4d51a8e0
      George Joseph authored
      does_id_conflict() was passing a pointer to an int to a callback
      that expected a pointer to a size_t.
      
      Found by the Address Sanitizer.
      
      Change-Id: I0ff542067eef63a14a60301654d65d34fe2ad503
      4d51a8e0
  26. Sep 20, 2018
    • George Joseph's avatar
      stasis: Add function to delete topic from pool · d277db4a
      George Joseph authored
      There's been a long standing leak when using topic pools.  The
      topics in the pool get cleaned up when the last pool reference is
      released but you can't remove a topic specifically.  If you reloaded
      app_voicemail for instance, and mailboxes went away, their topics
      were left in the pool.
      
      * Added stasis_topic_pool_delete_topic() so modules can clean up
        topics from pools.
      * Registered the topic pool containers so it can be examined from
        the CLI when AO2_DEBUG is enabled.  They'll be named
        "<topic_pool_name>-pool".
      
      Change-Id: Ib7957951ee5c9b9b4482af7b9b4349112d62bc25
      d277db4a
Loading