Summary:ASTERISK-17241: Format list should be copied before being iterated in ast_filehelper
Reporter:gnudialer gnudialer (gnudialer)Labels:
Date Opened:2011-01-13 14:55:09.000-0600Date Closed:2015-03-13 21:22:18
Versions:Frequency of
Description:If the disk is slow for whatever reason you get resource starvation if too many threads are making calls to this function because the list is locked the entire time.

It's bad enough for me that I'm going to have to put all the files in /var/lib/asterisk/sounds/en/ on a ramdisk.

Thanks for looking!

Comments:By: gnudialer gnudialer (gnudialer) 2011-01-18 16:57:50.000-0600

I'm used to just doing std::copy(blah blah) lol... Am I on the right track here?

  AST_LIST_HEAD(copy_of_formats, format) copy_of_formats;

  AST_RWLIST_TRAVERSE(&formats, f, list) {  
// ?????????
//    AST_LIST_INSERT_TAIL(&copy_of_formats, &f, wat do)                                      

   // Unlock here instead of after iteration

Edit: I need to create another format pointer to point to the end of the new list and that's the second arg, and then the last arg is the new element to be pushed back?

By: Sean Bright (seanbright) 2011-01-29 17:22:21.000-0600

It's just a read lock, not an exclusive lock.  You can have as many readers in that section as you wish, or am I missing something obvious?

By: gnudialer gnudialer (gnudialer) 2011-01-31 18:44:47.000-0600

It hangs at that lock, so maybe it is something else.

I'll get exact instructions for reproducing it soon.