Skip to content

Commit c643ffd

Browse files
committed
Hack fix for release asserts in TS_LIFECYCLE_SSL_SECRET_HOOK handling.
A proper fix will require a lot of restructuring of the SSLSecret code.
1 parent d7c7d66 commit c643ffd

File tree

6 files changed

+43
-2
lines changed

6 files changed

+43
-2
lines changed

iocore/cache/test/stub.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ APIHook::invoke(int, void *) const
5151
return 0;
5252
}
5353

54+
int
55+
APIHook::blocking_invoke(int, void *) const
56+
{
57+
ink_assert(false);
58+
return 0;
59+
}
60+
5461
APIHook *
5562
APIHook::next() const
5663
{

iocore/net/SSLSecret.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ SSLSecret::loadSecret(const std::string &name1, const std::string &name2, std::s
3535
secret_name.key_name = name2.data();
3636
secret_name.key_name_len = name2.size();
3737
while (curHook) {
38-
curHook->invoke(TS_EVENT_SSL_SECRET, &secret_name);
38+
curHook->blocking_invoke(TS_EVENT_SSL_SECRET, &secret_name);
3939
curHook = curHook->next();
4040
}
4141

iocore/net/libinknet_stub.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ APIHook::invoke(int, void *) const
7979
return 0;
8080
}
8181

82+
int
83+
APIHook::blocking_invoke(int, void *) const
84+
{
85+
ink_assert(false);
86+
return 0;
87+
}
88+
8289
APIHook *
8390
APIHook::next() const
8491
{

proxy/InkAPIInternal.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ class APIHook
117117
APIHook *next() const;
118118
APIHook *prev() const;
119119
LINK(APIHook, m_link);
120+
121+
// This is like invoke(), but allows for blocking on continuation mutexes. It is a hack, calling it can block
122+
// the calling thread. It should be replaced with a version with a continuation parameter, providing a continuation
123+
// to be called when the hook handling is complete.
124+
//
125+
int blocking_invoke(int event, void *edata) const;
120126
};
121127

122128
/// A collection of API hooks.

src/traffic_quic/traffic_quic.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,13 @@ APIHook::invoke(int, void *) const
200200
return 0;
201201
}
202202

203+
int
204+
APIHook::blocking_invoke(int, void *) const
205+
{
206+
ink_assert(false);
207+
return 0;
208+
}
209+
203210
APIHook *
204211
APIHooks::head() const
205212
{

src/traffic_server/InkAPI.cc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ APIHook::prev() const
13601360
int
13611361
APIHook::invoke(int event, void *edata) const
13621362
{
1363-
if ((event == EVENT_IMMEDIATE) || (event == EVENT_INTERVAL) || event == TS_EVENT_HTTP_TXN_CLOSE) {
1363+
if (event == EVENT_IMMEDIATE || event == EVENT_INTERVAL || event == TS_EVENT_HTTP_TXN_CLOSE) {
13641364
if (ink_atomic_increment((int *)&m_cont->m_event_count, 1) < 0) {
13651365
ink_assert(!"not reached");
13661366
}
@@ -1373,6 +1373,20 @@ APIHook::invoke(int event, void *edata) const
13731373
return m_cont->handleEvent(event, edata);
13741374
}
13751375

1376+
int
1377+
APIHook::blocking_invoke(int event, void *edata) const
1378+
{
1379+
if (event == EVENT_IMMEDIATE || event == EVENT_INTERVAL || event == TS_EVENT_HTTP_TXN_CLOSE) {
1380+
if (ink_atomic_increment((int *)&m_cont->m_event_count, 1) < 0) {
1381+
ink_assert(!"not reached");
1382+
}
1383+
}
1384+
1385+
WEAK_SCOPED_MUTEX_LOCK(lock, m_cont->mutex, this_ethread());
1386+
1387+
return m_cont->handleEvent(event, edata);
1388+
}
1389+
13761390
APIHook *
13771391
APIHooks::head() const
13781392
{

0 commit comments

Comments
 (0)