Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002103 [Quercus] minor always 10-21-07 00:21 10-21-07 15:15
Reporter koreth View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.4 Product Version 3.1.4
  Product Build
Summary 0002103: mysql_close() on a remotely-closed connection causes an attempted connection to localhost
Description Originally filed as bug 2074; now I have more detail.

When a connection is closed down by the remote side and then, later on, the PHP code calls mysql_close() on it, MysqlModule.getConnection(env) is called to check to see if this is the default connection for the PHP environment. When there isn't a default connection, that code ends up creating a new Mysqli object with "localhost" as the hostname, and Quercus dumps a "connection refused" exception to the log because there is no MySQL instance on localhost.
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0002373)
koreth
10-21-07 00:28

Stack trace, if it's useful:

[00:21:35.532] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
[00:21:35.532]
[00:21:35.532] Last packet sent to the server was 0 ms ago.
[00:21:35.532] at sun.reflect.GeneratedConstructorAccessor25.newInstance(Unknown Source)
[00:21:35.532] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[00:21:35.532] at java.lang.reflect.Constructor.newInstance(Constructor.java:506)
[00:21:35.532] at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
[00:21:35.532] at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
[00:21:35.532] at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2104)
[00:21:35.532] at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:729)
[00:21:35.532] at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
[00:21:35.532] at sun.reflect.GeneratedConstructorAccessor20.newInstance(Unknown Source)
[00:21:35.532] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[00:21:35.532] at java.lang.reflect.Constructor.newInstance(Constructor.java:506)
[00:21:35.532] at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
[00:21:35.532] at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
[00:21:35.532] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:283)
[00:21:35.532] at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:426)
[00:21:35.532] at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:141)
[00:21:35.532] at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:111)
[00:21:35.532] at com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource.getPooledConnection(MysqlConnectionPoolDataSource.java:58)
[00:21:35.532] at com.caucho.sql.DriverConfig.createPooledConnection(DriverConfig.java:584)
[00:21:35.532] at com.caucho.sql.ManagedConnectionImpl.initDriverConnection(ManagedConnectionImpl.java:243)
[00:21:35.532] at com.caucho.sql.ManagedConnectionImpl.<init>(ManagedConnectionImpl.java:139)
[00:21:35.532] at com.caucho.sql.ManagedFactoryImpl.createManagedConnection(ManagedFactoryImpl.java:129)
[00:21:35.532] at com.caucho.jca.ConnectionPool.create(ConnectionPool.java:910)
[00:21:35.532] at com.caucho.jca.ConnectionPool.allocatePool(ConnectionPool.java:779)
[00:21:35.532] at com.caucho.jca.ConnectionPool.allocate(ConnectionPool.java:740)
[00:21:35.532] at com.caucho.jca.ConnectionPool.allocateConnection(ConnectionPool.java:551)
[00:21:35.532] at com.caucho.sql.DataSourceImpl.getConnection(DataSourceImpl.java:65)
[00:21:35.532] at com.caucho.sql.DBPool.getConnection(DBPool.java:671)
[00:21:35.532] at com.caucho.quercus.env.Env.getConnection(Env.java:702)
[00:21:35.532] at com.caucho.quercus.lib.db.Mysqli.connectImpl(Mysqli.java:154)
[00:21:35.532] at com.caucho.quercus.lib.db.JdbcConnectionResource.connectInternal(JdbcConnectionResource.java:179)
[00:21:35.532] at com.caucho.quercus.lib.db.Mysqli.<init>(Mysqli.java:93)
[00:21:35.532] at com.caucho.quercus.lib.db.MysqlModule.getConnection(MysqlModule.java:910)
[00:21:35.532] at com.caucho.quercus.lib.db.MysqlModule.getConnection(MysqlModule.java:900)
[00:21:35.532] at com.caucho.quercus.lib.db.MysqlModule.mysql_close(MysqlModule.java:108)
 
(0002374)
ferg
10-21-07 15:15

php/1435

This fix only affects mysql_close(). If the connection was closed and the application calls mysql_query(), Quercus will attempt to connect to localhost:3306 (this appears to be the behavior of PHP.)
 

- Issue History
Date Modified Username Field Change
10-21-07 00:21 koreth New Issue
10-21-07 00:28 koreth Note Added: 0002373
10-21-07 15:15 ferg Note Added: 0002374
10-21-07 15:15 ferg Assigned To  => ferg
10-21-07 15:15 ferg Status new => closed
10-21-07 15:15 ferg Resolution open => fixed
10-21-07 15:15 ferg Fixed in Version  => 3.1.4


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker