[asterisk-bugs] [JIRA] (ASTERISK-23111) astdb entries added just before shutdown are not saved

Matt Jordan (JIRA) noreply at issues.asterisk.org
Wed Jan 8 13:43:04 CST 2014


    [ https://issues.asterisk.org/jira/browse/ASTERISK-23111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=213774#comment-213774 ] 

Matt Jordan commented on ASTERISK-23111:
----------------------------------------

I would say this is a bug. We already have the opportunity on shutdown to clean up and sync with the database.

In fact, it looks like we're trying to do this right now:

{noformat}
/*! \internal \brief Clean up resources on Asterisk shutdown */
static void astdb_atexit(void)
{
        ...

	/* Set doexit to 1 to kill thread. db_sync must be called with
	 * mutex held. */
	doexit = 1;
	ast_mutex_lock(&dblock);
	db_sync();
	ast_mutex_unlock(&dblock);

	pthread_join(syncthread, NULL);
	ast_mutex_lock(&dblock);
	clean_statements();
	if (sqlite3_close(astdb) == SQLITE_OK) {
		astdb = NULL;
	}
	ast_mutex_unlock(&dblock);
}
{noformat}

I have to wonder if we're not giving the {{db_sync_thread}} enough time to commit the transaction before closing the SQLite connection. We may want to actually inform the thread that we're terminating and join on it before closing the SQLite connection - that would ensure that we don't close the database connection until we're actually sure that everything has been written to it.
                
> astdb entries added just before shutdown are not saved
> ------------------------------------------------------
>
>                 Key: ASTERISK-23111
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23111
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>    Affects Versions: SVN, 11.2.0, 11.7.0
>            Reporter: Tzafrir Cohen
>            Severity: Minor
>         Attachments: test_ast_add_exit.sh
>
>
> If I add a large number of entries to astdb and then stop asterisk, all or most of the entries will not be saved into the sqlite database on disk.
> Attached a script that demonstrates the issue. Use the option 'clean' to delete the entries. Unrem the line with 'sleep 5' to work around the issue.
> Tested currently on branch 11: both 11.7.0 and SVN (branch 11 rev. 404888  - before and after recent astdb fix and trunk rev. 371521) as well as with 11.2.0 and 10.12.1 .
> Attached a script that tests the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list