Bug #97269 Possible bug in com.mysql.cj.xdevapi.StreamingDocResultBuilder
Submitted: 17 Oct 2019 10:52 Modified: 25 May 2021 16:50
Reporter: Vladimir Marinov Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:8.0.18 OS:Any
Assigned to: Alexander Soklakov CPU Architecture:Any
Tags: XDevAPI

[17 Oct 2019 10:52] Vladimir Marinov
Description:
The `addProtocolEntity` method of `com.mysql.cj.xdevapi.StreamingDocResultBuilder`
appears to be missing a `return` after handling ProtocolEntity of type Notice.
Other ResultBuilder subclasses do return `false`.

How to repeat:
null
[17 Oct 2019 13:08] MySQL Verification Team
Hello Vladimir Marinov,

Thank you for the bug report.
Discussed internally with Alex Soklakov (C/J Developer) and confirmed that it is not a bug as we add already consumed Notice to statementExecuteOkBuilder and then pass control over reading from wire to XProtocolRowInputStream.

Thank you for your interest in MySQL.

regards,
Umesh
[17 Oct 2019 15:52] Vladimir Marinov
Hi Umesh,

readQueryResult in XProtocol class has the following line:
`notices.stream().forEach(resultBuilder::addProtocolEntity)`

That means that for each notice the call to addProtocolEntity will result in reinitialization of XProtocolRowInputStream rowList field in StreamingDocResultBuilder.

Even if nothing breaks for now, it has potential to cause problems in the future.
[18 Oct 2019 9:31] Alexander Soklakov
Hi Vladimir,

You're probably right here, we need to check this. Thanks!
[25 May 2021 16:50] Daniel So
Posted by developer:
 
Added the following entry tot he Connector/J 8.0.26 changelog: 

"The streaming of DocResult failed if the rows are preceded by any Notice messages in the stream. This is because the addProtocolEntity() method of StreamingDocResultBuilder did not return "false" after adding Notice messages, and that has been fixed by this patch."