Compare commits

...

5 Commits

Author SHA1 Message Date
Asterisk Development Team
c92e2bb09f Update for 16.8.0-rc2 2020-01-30 11:36:41 -05:00
Kevin Harwell
1627e8eddc res_stasis: trigger cleanup after update
The cleanup code in stasis shuts down applications if they are in a deactivated
state, and no longer have explicit subscriptions. When registering an app the
cleanup code was running before calling 'update'. When it should be executed
after 'update' since a call to register may re-activate the app. We don't want
it to shutdown before the 'update' otherwise the app won't be re-activated,
or registered.

This patch makes it so the cleanup code is executed post 'update'.

ASTERISK-28679 #close

Change-Id: I8f2c0b17e33bb8128441567b97fd4c7bf74a327b
(cherry picked from commit dc9875815c)
2020-01-30 10:21:26 -06:00
Kevin Harwell
42c51263b9 stasis/app: don't lock an app before a call to send
Calling 'app_send' eventually calls the app's message handler. It's possible
for a handler to obtain a lock on another object, and then need/want to lock
the app object. If the caller of 'app_send' locks the app object prior to
calling then there's a potential for a deadlock, if another thread calls
'app_send' without locking.

This patch makes it so 'app_send' is not called with the app object locked in
the section of code doing such.

ASTERISK-28423 #close

Change-Id: I6767c6d0933c7db1b984018966eefca4c0638a27
(cherry picked from commit e103339f02)
2020-01-30 09:41:59 -06:00
Joshua C. Colp
939e18d63e res_pjsip_pubsub: Increment persistence data ref when recreating.
Each subscription needs to have a reference to the persisted data
for it, as well as the main JSON contained within the tree. When
recreating a subscription this did not occur and they both shared
the same reference.

ASTERISK-28714

Change-Id: I706abd49ea182ea367a4ac3feca2706460ae9f4a
(cherry picked from commit 4d32f5747c)
2020-01-30 09:37:07 -06:00
Asterisk Development Team
b7b813eb34 Update for 16.8.0-rc1 2020-01-23 11:40:43 -05:00
14 changed files with 90520 additions and 5 deletions

1
.lastclean Normal file
View File

@@ -0,0 +1 @@
40

1
.version Normal file
View File

@@ -0,0 +1 @@
16.8.0-rc2

87619
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><title>Release Summary - asterisk-16.8.0-rc2</title><h1 align="center"><a name="top">Release Summary</a></h1><h3 align="center">asterisk-16.8.0-rc2</h3><h3 align="center">Date: 2020-01-30</h3><h3 align="center">&lt;asteriskteam@digium.com&gt;</h3><hr><h2 align="center">Table of Contents</h2><ol>
<li><a href="#summary">Summary</a></li>
<li><a href="#contributors">Contributors</a></li>
<li><a href="#closed_issues">Closed Issues</a></li>
<li><a href="#diffstat">Diffstat</a></li>
</ol><hr><a name="summary"><h2 align="center">Summary</h2></a><center><a href="#top">[Back to Top]</a></center><p>This release is a point release of an existing major version. The changes included were made to address problems that have been identified in this release series, or are minor, backwards compatible new features or improvements. Users should be able to safely upgrade to this version if this release series is already in use. Users considering upgrading from a previous version are strongly encouraged to review the UPGRADE.txt document as well as the CHANGES document for information about upgrading to this release series.</p><p>The data in this summary reflects changes that have been made since the previous release, asterisk-16.8.0-rc1.</p><hr><a name="contributors"><h2 align="center">Contributors</h2></a><center><a href="#top">[Back to Top]</a></center><p>This table lists the people who have submitted code, those that have tested patches, as well as those that reported issues on the issue tracker that were resolved in this release. For coders, the number is how many of their patches (of any size) were committed into this release. For testers, the number is the number of times their name was listed as assisting with testing a patch. Finally, for reporters, the number is the number of issues that they reported that were affected by commits that went into this release.</p><table width="100%" border="0">
<tr><th width="33%">Coders</th><th width="33%">Testers</th><th width="33%">Reporters</th></tr>
<tr valign="top"><td width="33%">2 Kevin Harwell <kharwell@digium.com><br/>1 Joshua C. Colp <jcolp@sangoma.com><br/></td><td width="33%"><td width="33%">2 Ross Beer <ross.beer@voicehost.co.uk><br/>1 Francois Blackburn <fblackburn@wazo.io><br/></td></tr>
</table><hr><a name="closed_issues"><h2 align="center">Closed Issues</h2></a><center><a href="#top">[Back to Top]</a></center><p>This is a list of all issues from the issue tracker that were closed by changes that went into this release.</p><h3>Bug</h3><h4>Category: Resources/res_ari</h4><a href="https://issues.asterisk.org/jira/browse/ASTERISK-28679">ASTERISK-28679</a>: stasis application is destroyed after its creation<br/>Reported by: Francois Blackburn<ul>
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=1627e8eddc378b7df54f298ca0f4a89294a10864">[1627e8eddc]</a> Kevin Harwell -- res_stasis: trigger cleanup after update</li>
</ul><br><h4>Category: Resources/res_pjsip_pubsub</h4><a href="https://issues.asterisk.org/jira/browse/ASTERISK-28714">ASTERISK-28714</a>: REGRESSION: Feature subscription_persistence_recreate (ASTERISK-27759) Causes Segfaults<br/>Reported by: Ross Beer<ul>
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=939e18d63eee6c228446c4b14021ba8940761574">[939e18d63e]</a> Joshua C. Colp -- res_pjsip_pubsub: Increment persistence data ref when recreating.</li>
</ul><br><h4>Category: Resources/res_stasis</h4><a href="https://issues.asterisk.org/jira/browse/ASTERISK-28423">ASTERISK-28423</a>: ARI causes STASIS Deadlock<br/>Reported by: Ross Beer<ul>
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=42c51263b9ec8a0bb349af39e28ff51ed3d682ee">[42c51263b9]</a> Kevin Harwell -- stasis/app: don't lock an app before a call to send</li>
</ul><br><hr><a name="diffstat"><h2 align="center">Diffstat Results</h2></a><center><a href="#top">[Back to Top]</a></center><p>This is a summary of the changes to the source code that went into this release that was generated using the diffstat utility.</p><pre>0 files changed</pre><br></html>

View File

@@ -0,0 +1,96 @@
Release Summary
asterisk-16.8.0-rc2
Date: 2020-01-30
<asteriskteam@digium.com>
----------------------------------------------------------------------
Table of Contents
1. Summary
2. Contributors
3. Closed Issues
4. Diffstat
----------------------------------------------------------------------
Summary
[Back to Top]
This release is a point release of an existing major version. The changes
included were made to address problems that have been identified in this
release series, or are minor, backwards compatible new features or
improvements. Users should be able to safely upgrade to this version if
this release series is already in use. Users considering upgrading from a
previous version are strongly encouraged to review the UPGRADE.txt
document as well as the CHANGES document for information about upgrading
to this release series.
The data in this summary reflects changes that have been made since the
previous release, asterisk-16.8.0-rc1.
----------------------------------------------------------------------
Contributors
[Back to Top]
This table lists the people who have submitted code, those that have
tested patches, as well as those that reported issues on the issue tracker
that were resolved in this release. For coders, the number is how many of
their patches (of any size) were committed into this release. For testers,
the number is the number of times their name was listed as assisting with
testing a patch. Finally, for reporters, the number is the number of
issues that they reported that were affected by commits that went into
this release.
Coders Testers Reporters
2 Kevin Harwell 2 Ross Beer
1 Joshua C. Colp 1 Francois Blackburn
----------------------------------------------------------------------
Closed Issues
[Back to Top]
This is a list of all issues from the issue tracker that were closed by
changes that went into this release.
Bug
Category: Resources/res_ari
ASTERISK-28679: stasis application is destroyed after its creation
Reported by: Francois Blackburn
* [1627e8eddc] Kevin Harwell -- res_stasis: trigger cleanup after update
Category: Resources/res_pjsip_pubsub
ASTERISK-28714: REGRESSION: Feature subscription_persistence_recreate
(ASTERISK-27759) Causes Segfaults
Reported by: Ross Beer
* [939e18d63e] Joshua C. Colp -- res_pjsip_pubsub: Increment persistence
data ref when recreating.
Category: Resources/res_stasis
ASTERISK-28423: ARI causes STASIS Deadlock
Reported by: Ross Beer
* [42c51263b9] Kevin Harwell -- stasis/app: don't lock an app before a
call to send
----------------------------------------------------------------------
Diffstat Results
[Back to Top]
This is a summary of the changes to the source code that went into this
release that was generated using the diffstat utility.
0 files changed

View File

@@ -0,0 +1,41 @@
CREATE TABLE alembic_version (
version_num VARCHAR(32) NOT NULL,
CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num)
);
-- Running upgrade -> 210693f3123d
CREATE TABLE cdr (
accountcode VARCHAR(20),
src VARCHAR(80),
dst VARCHAR(80),
dcontext VARCHAR(80),
clid VARCHAR(80),
channel VARCHAR(80),
dstchannel VARCHAR(80),
lastapp VARCHAR(80),
lastdata VARCHAR(80),
start DATETIME,
answer DATETIME,
end DATETIME,
duration INTEGER,
billsec INTEGER,
disposition VARCHAR(45),
amaflags VARCHAR(45),
userfield VARCHAR(256),
uniqueid VARCHAR(150),
linkedid VARCHAR(150),
peeraccount VARCHAR(20),
sequence INTEGER
);
INSERT INTO alembic_version (version_num) VALUES ('210693f3123d');
-- Running upgrade 210693f3123d -> 54cde9847798
ALTER TABLE cdr MODIFY accountcode VARCHAR(80) NULL;
ALTER TABLE cdr MODIFY peeraccount VARCHAR(80) NULL;
UPDATE alembic_version SET version_num='54cde9847798' WHERE alembic_version.version_num = '210693f3123d';

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,35 @@
CREATE TABLE alembic_version (
version_num VARCHAR(32) NOT NULL,
CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num)
);
-- Running upgrade -> a2e9769475e
CREATE TABLE voicemail_messages (
dir VARCHAR(255) NOT NULL,
msgnum INTEGER NOT NULL,
context VARCHAR(80),
macrocontext VARCHAR(80),
callerid VARCHAR(80),
origtime INTEGER,
duration INTEGER,
recording BLOB,
flag VARCHAR(30),
category VARCHAR(30),
mailboxuser VARCHAR(30),
mailboxcontext VARCHAR(30),
msg_id VARCHAR(40)
);
ALTER TABLE voicemail_messages ADD CONSTRAINT voicemail_messages_dir_msgnum PRIMARY KEY (dir, msgnum);
CREATE INDEX voicemail_messages_dir ON voicemail_messages (dir);
INSERT INTO alembic_version (version_num) VALUES ('a2e9769475e');
-- Running upgrade a2e9769475e -> 39428242f7f5
ALTER TABLE voicemail_messages MODIFY recording BLOB(4294967295) NULL;
UPDATE alembic_version SET version_num='39428242f7f5' WHERE alembic_version.version_num = 'a2e9769475e';

View File

@@ -0,0 +1,45 @@
BEGIN;
CREATE TABLE alembic_version (
version_num VARCHAR(32) NOT NULL,
CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num)
);
-- Running upgrade -> 210693f3123d
CREATE TABLE cdr (
accountcode VARCHAR(20),
src VARCHAR(80),
dst VARCHAR(80),
dcontext VARCHAR(80),
clid VARCHAR(80),
channel VARCHAR(80),
dstchannel VARCHAR(80),
lastapp VARCHAR(80),
lastdata VARCHAR(80),
start TIMESTAMP WITHOUT TIME ZONE,
answer TIMESTAMP WITHOUT TIME ZONE,
"end" TIMESTAMP WITHOUT TIME ZONE,
duration INTEGER,
billsec INTEGER,
disposition VARCHAR(45),
amaflags VARCHAR(45),
userfield VARCHAR(256),
uniqueid VARCHAR(150),
linkedid VARCHAR(150),
peeraccount VARCHAR(20),
sequence INTEGER
);
INSERT INTO alembic_version (version_num) VALUES ('210693f3123d');
-- Running upgrade 210693f3123d -> 54cde9847798
ALTER TABLE cdr ALTER COLUMN accountcode TYPE VARCHAR(80);
ALTER TABLE cdr ALTER COLUMN peeraccount TYPE VARCHAR(80);
UPDATE alembic_version SET version_num='54cde9847798' WHERE alembic_version.version_num = '210693f3123d';
COMMIT;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
BEGIN;
CREATE TABLE alembic_version (
version_num VARCHAR(32) NOT NULL,
CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num)
);
-- Running upgrade -> a2e9769475e
CREATE TABLE voicemail_messages (
dir VARCHAR(255) NOT NULL,
msgnum INTEGER NOT NULL,
context VARCHAR(80),
macrocontext VARCHAR(80),
callerid VARCHAR(80),
origtime INTEGER,
duration INTEGER,
recording BYTEA,
flag VARCHAR(30),
category VARCHAR(30),
mailboxuser VARCHAR(30),
mailboxcontext VARCHAR(30),
msg_id VARCHAR(40)
);
ALTER TABLE voicemail_messages ADD CONSTRAINT voicemail_messages_dir_msgnum PRIMARY KEY (dir, msgnum);
CREATE INDEX voicemail_messages_dir ON voicemail_messages (dir);
INSERT INTO alembic_version (version_num) VALUES ('a2e9769475e');
-- Running upgrade a2e9769475e -> 39428242f7f5
ALTER TABLE voicemail_messages ALTER COLUMN recording TYPE BYTEA;
UPDATE alembic_version SET version_num='39428242f7f5' WHERE alembic_version.version_num = 'a2e9769475e';
COMMIT;

View File

@@ -1264,7 +1264,7 @@ static struct ast_sip_subscription *allocate_subscription(const struct ast_sip_s
*/
if (tree->persistence && tree->persistence->generator_data) {
sub->persistence_data = ast_json_object_get(tree->persistence->generator_data, resource);
sub->persistence_data = ast_json_ref(ast_json_object_get(tree->persistence->generator_data, resource));
}
sub->handler = handler;

View File

@@ -1715,12 +1715,11 @@ static int __stasis_app_register(const char *app_name, stasis_app_cb handler, vo
if (app) {
/*
* We need to unlock the apps_registry before calling app_update to
* prevent the possibility of a deadlock with the session. We'll still
* run the lazy cleanup first though.
* prevent the possibility of a deadlock with the session.
*/
cleanup();
ao2_unlock(apps_registry);
app_update(app, handler, data);
cleanup();
return 0;
}
@@ -1745,11 +1744,12 @@ static int __stasis_app_register(const char *app_name, stasis_app_cb handler, vo
}
ao2_link_flags(apps_registry, app, OBJ_NOLOCK);
ao2_unlock(apps_registry);
/* We lazily clean up the apps_registry, because it's good enough to
* prevent memory leaks, and we're lazy.
*/
cleanup();
ao2_unlock(apps_registry);
return 0;
}

View File

@@ -1166,8 +1166,23 @@ void app_update(struct stasis_app *app, stasis_app_cb handler, void *data)
"timestamp", ast_json_timeval(ast_tvnow(), NULL),
"application", app->name);
if (msg) {
/*
* The app must be unlocked before calling 'send' since a handler may
* subsequently attempt to grab the app lock after first obtaining a
* lock for another object, thus causing a deadlock.
*/
ao2_unlock(app);
app_send(app, msg);
ao2_lock(app);
ast_json_unref(msg);
if (!app->handler) {
/*
* If the handler disappeared then the app was deactivated. In that
* case don't replace. Re-activation will reset the handler later.
*/
ao2_unlock(app);
return;
}
}
} else {
ast_verb(1, "Activating Stasis app '%s'\n", app->name);