Skip to content

Commit 0464745

Browse files
committed
Fix error when releasing a connection after a failed pool terminate()
1 parent 3434398 commit 0464745

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/njs/src/njsOracle.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,10 @@ typedef struct connectionBaton
167167
unsigned int maxRows;
168168
unsigned int outFormat;
169169
Persistent<Function> cb;
170-
dpi::Env* dpienv;
171-
dpi::Conn* dpiconn;
170+
dpi::Env* dpienv;
171+
dpi::Conn* dpiconn;
172172
dpi::SPool* dpipool;
173+
bool* isPoolValid;
173174

174175
Oracledb *oracledb;
175176

src/njs/src/njsPool.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,8 @@ Handle<Value> Pool::Terminate(const Arguments& args )
569569
terminateBaton->error = NJSMessages::getErrorMsg( errInvalidPool );
570570
goto exitTerminate;
571571
}
572-
terminateBaton->dpipool = njsPool->dpipool_;
573-
njsPool->isValid_ = false;
572+
terminateBaton->dpipool = njsPool->dpipool_;
573+
terminateBaton->isPoolValid = &(njsPool->isValid_);
574574

575575
exitTerminate:
576576
terminateBaton->req.data = (void *)terminateBaton;
@@ -627,9 +627,14 @@ void Pool::Async_AfterTerminate(uv_work_t *req)
627627
Handle<Value> argv[1];
628628

629629
if(!(terminateBaton->error).empty())
630+
{
630631
argv[0] = v8::Exception::Error(String::New((terminateBaton->error).c_str()));
632+
}
631633
else
634+
{
632635
argv[0] = Undefined();
636+
*(terminateBaton->isPoolValid) = false;
637+
}
633638

634639
node::MakeCallback( Context::GetCurrent()->Global(),
635640
terminateBaton->cb, 1, argv );

0 commit comments

Comments
 (0)