You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/09/23 09:49:21 UTC
[GitHub] [druid] coney opened a new issue, #13140: connection timeout properties for PGSQL is either useless or cause NPE
coney opened a new issue, #13140:
URL: https://github.com/apache/druid/issues/13140
Please provide a detailed title (e.g. "Broker crashes when using TopN query with Bound filter" instead of just "Broker crashes").
### Affected Version
Druid 1.2.12
### Description
DruidAbstractDataSource#createPhysicalConnection add `loginTimeout` and `socketTimeout` with integer value.
``` java
// com.alibaba.druid.pool.DruidAbstractDataSource#createPhysicalConnection()
// connectTimeout is primitive integer
protected volatile int connectTimeout;
public PhysicalConnectionInfo createPhysicalConnection() throws SQLException {
...
if (this.connectTimeout > 0) {
if (this.isMySql) {
physicalConnectProperties.put("connectTimeout", this.connectTimeout);
} else if (this.isOracle) {
physicalConnectProperties.put("oracle.net.CONNECT_TIMEOUT", this.connectTimeout);
} else if (this.driver != null && "org.postgresql.Driver".equals(this.driver.getClass().getName())) {
// add loginTimeout & socketTimeout,, the value is integer instead of string
physicalConnectProperties.put("loginTimeout", this.connectTimeout);
physicalConnectProperties.put("socketTimeout", this.connectTimeout);
}
}
```
but PosgresSQL Driver only read string properties makes the timeout configurations useless
```
// org.postgresql.Driver#connect from pgdriver:42.4.1
Properties props = new Properties(defaults);
if (info != null) {
// notice the line below
Set<String> e = info.stringPropertyNames();
for (String propName : e) {
String propValue = info.getProperty(propName);
if (propValue == null) {
throw new PSQLException(
GT.tr("Properties for the driver contains a non-string value for the key ")
+ propName,
PSQLState.UNEXPECTED_ERROR);
}
props.setProperty(propName, propValue);
}
}
```
and it cause the NPE in the old version of PG:
```
Properties props = new Properties(defaults);
Enumeration e = info.propertyNames();
while(e.hasMoreElements()) {
String propName = (String)e.nextElement();
// the line below cause NPE , getProperty traits non-string value as null
props.setProperty(propName, info.getProperty(propName));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] FrankChen021 commented on issue #13140: connection timeout properties for PGSQL is either useless or cause NPE
Posted by GitBox <gi...@apache.org>.
FrankChen021 commented on issue #13140:
URL: https://github.com/apache/druid/issues/13140#issuecomment-1256193751
Pls post the issue here: [github.com/alibaba/druid](https://github.com/alibaba/druid)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] FrankChen021 closed issue #13140: connection timeout properties for PGSQL is either useless or cause NPE
Posted by GitBox <gi...@apache.org>.
FrankChen021 closed issue #13140: connection timeout properties for PGSQL is either useless or cause NPE
URL: https://github.com/apache/druid/issues/13140
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org