apache/shardingsphere · error · SQLException
1105
1105
Error message
Parameter of prepared statement which is set through mysql_send_long_data() is longer than 'max_allowed_packet' bytes
What it means
Error "Parameter of prepared statement which is set through mysql_send_long_data() is longer than 'max_allowed_packet' bytes" thrown in apache/shardingsphere.
Source
Thrown at proxy/frontend/dialect/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/MySQLServerPreparedStatement.java:103
longData.put(paramIndex, parameterLongData);
}
if (parameterLongData.append(data)) {
longDataTooLarge = false;
} else {
longData.clear();
longDataTooLarge = true;
}
}
/**
* Get indexes of parameters set through COM_STMT_SEND_LONG_DATA.
*
* @return indexes of parameters set through COM_STMT_SEND_LONG_DATA; the returned set must not be modified
* @throws SQLException SQL exception when accumulated long data is too large
*/
public Set<Integer> getLongDataIndexes() throws SQLException {
if (longDataTooLarge) {
throw new SQLException(LONG_DATA_TOO_LARGE_MESSAGE, XOpenSQLState.GENERAL_ERROR.getValue(), ER_UNKNOWN_ERROR);
}
return longData.isEmpty() ? Collections.emptySet() : longData.keySet();
}
/**
* Apply accumulated long data to parameters.
*
* @param params parameters
* @param charset character set
*/
public void applyLongData(final List<Object> params, final Charset charset) {
for (Entry<Integer, LongData> entry : longData.entrySet()) {
byte[] value = entry.getValue().getValue();
params.set(entry.getKey(), isCharacterParameter(entry.getKey()) ? new String(value, charset) : value);
}
}
private boolean isCharacterParameter(final int paramIndex) {View on GitHub (pinned to e952770a21)
Solutions
- Reduce the size of data sent via mysql_send_long_data() per parameter.
- Increase max_allowed_packet on both the proxy and the backend MySQL server.
- Split very large parameter values into smaller chunks or use a different loading mechanism.
When it happens
Trigger: A COM_STMT_SEND_LONG_DATA parameter exceeds the max_allowed_packet limit.
Common situations: Inserting very large BLOB/TEXT values through prepared statements with streaming parameters.
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/4025eb6ad5ae315d.
Report an issue: GitHub.