Skip to content

Commit 04319fb

Browse files
committed
Fixed bug when a break occurs in the middle of processing a lengthy database response
1 parent 5214dd4 commit 04319fb

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

doc/src/release_notes.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Thin Mode Changes
1313

1414
#) Fixed bug to handle errors while waiting for writes to drain on the network.
1515

16+
#) Fixed bug when a break occurs in the middle of processing a database
17+
response that spans multiple packets. This break could occur due to a
18+
server error, the session being killed or a call to `breakExecution()`.
19+
1620
node-oracledb `v6.0.2 <https://github.com/oracle/node-oracledb/compare/v6.0.1...v6.0.2>`__ (27 Jun 2023)
1721
--------------------------------------------------------------------------------------------------------
1822

@@ -47,8 +51,8 @@ Thin Mode Changes
4751
credentials.
4852

4953
#) Added support for connecting with multiple network aliases for a single
50-
connect string entry in the tnsnames.ora file.
51-
for example, alias1, alias2, alias3=(description=...)
54+
connect string entry in the tnsnames.ora file.
55+
For example, alias1, alias2, alias3=(description=...).
5256

5357
#) Minor internal code cleanup.
5458

lib/thin/protocol/packet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class ReadPacket extends BaseBuffer {
256256
receivePacket() {
257257
if (this.savedBufferPos === this.savedBuffers.length) {
258258
const packet = this.nsi.syncRecvPacket();
259-
if (!packet)
259+
if (!packet || this.nsi.isBreak)
260260
throw new utils.OutOfPacketsError();
261261
this.savedBuffers.push(packet.buf);
262262
}

lib/thin/protocol/protocol.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,18 @@ class Protocol {
7171
while (true) { // eslint-disable-line
7272
if (this.nsi.isBreak) {
7373
await this.resetMessage();
74+
delete this.readBuf.savedBuffers;
7475
await this.readBuf.waitForPackets();
7576
}
7677
try {
7778
message.decode(this.readBuf);
7879
break;
7980
} catch (err) {
8081
if (err instanceof utils.OutOfPacketsError) {
81-
await this.readBuf.waitForPackets();
82-
this.readBuf.restorePoint();
82+
if (!this.nsi.isBreak) {
83+
await this.readBuf.waitForPackets();
84+
this.readBuf.restorePoint();
85+
}
8386
continue;
8487
}
8588
throw (err);

0 commit comments

Comments
 (0)