Skip to content

Commit ac1dddb

Browse files
committed
Mark CQN subscription as invalid before connection.unsubscribe() completes
1 parent 27ab1ef commit ac1dddb

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ This release is under development.
66

77
- Fixed a bug that caused random CQN crashes ([ODPI-C change](https://github.com/oracle/odpi/issues/96)).
88

9+
- Fixed a CQN race condition to prevent a crash when a multiple
10+
`conn.unsubscribe()` calls are made on the same subscription.
11+
912
- Improve validation of `executeMany()` arguments to prevent a crash.
1013

1114
- Use a relative URL for the ODPI-C submodule to make cloning from

src/njsConnection.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2752,7 +2752,8 @@ NAN_METHOD(njsConnection::Unsubscribe)
27522752
} else {
27532753
baton->error = njsMessages::Get(errInvalidSubscription);
27542754
}
2755-
baton->QueueWork("Unsubscribe", Async_Unsubscribe, NULL, 1);
2755+
baton->QueueWork("Unsubscribe", Async_Unsubscribe, Async_AfterUnsubscribe,
2756+
1);
27562757
}
27572758

27582759

@@ -2773,6 +2774,17 @@ void njsConnection::Async_Unsubscribe(njsBaton *baton)
27732774
}
27742775

27752776

2777+
//-----------------------------------------------------------------------------
2778+
// njsConnection::Async_AfterUnsubscribe()
2779+
// Returns result to JS by invoking JS callback.
2780+
//-----------------------------------------------------------------------------
2781+
void njsConnection::Async_AfterUnsubscribe(njsBaton *baton,
2782+
Local<Value> argv[])
2783+
{
2784+
njsOracledb::ClearSubscription(baton->name);
2785+
}
2786+
2787+
27762788
//-----------------------------------------------------------------------------
27772789
// njsConnection::GetSodaDatabase()
27782790
// Creates a top-level soda obect (pseudo) associated with the connection.

src/njsConnection.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class njsConnection: public njsCommon {
143143
// Unsubscribe Method on Connection class
144144
static NAN_METHOD(Unsubscribe);
145145
static void Async_Unsubscribe(njsBaton *baton);
146+
static void Async_AfterUnsubscribe(njsBaton *baton, Local<Value> argv[]);
146147

147148
// GetSodaDatabase Method on Connection class
148149
static NAN_METHOD(GetSodaDatabase);

0 commit comments

Comments
 (0)