Bug #4259 minimum query_cache_size value required
Submitted: 23 Jun 2004 11:14 Modified: 27 May 2005 14:33
Reporter: Mickael Besson Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:3.0.14 & MySQL 5.0 & j2sdk1.4.2_04 OS:Windows (Windows NT4)
Assigned to: Alexey Botchkov CPU Architecture:Any

[23 Jun 2004 11:14] Mickael Besson
Description:
The server crash when I connect from java, and this only when query_cache_size value is too small.

Bug :
_______

query_cache_type = 1
query_cache_limit = 32M
query_cache_size = 300M

Error message from java :
_____________________________

Message: Unable to connect to any hosts due to exception: java.lang.NullPointerException

** BEGIN NESTED EXCEPTION ** 

java.lang.NullPointerException

STACKTRACE:

java.lang.NullPointerException
	at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3198)
	at com.mysql.jdbc.Connection.createNewIO(Connection.java:1788)
	at com.mysql.jdbc.Connection.<init>(Connection.java:440)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:400)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at charge.Bench$1.run(Bench.java:80)
	at java.lang.Thread.run(Unknown Source)

** END NESTED EXCEPTION **

Probleme SQL : 08S01
Code de l'erreur : 0

Solution :
___________

query_cache_type = 1
query_cache_limit = 32M
query_cache_size = 500M

Is there a link between query_cache_limit & query_cache_size ?
Is there a minimum value to run jdbc driver ?

Thank's

How to repeat:

- put 

  query_cache_type = 1
  query_cache_limit = 32M
  query_cache_size = 300M

  in my.ini

- test a connection from java. Example:

try {      Class.forName("com.mysql.jdbc.Driver");  	}
            catch (Exception E) {
            		System.err.println("Unable to load driver.");
            		E.printStackTrace();
            	}
try {
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root","secret");
} catch (SQLException e) {
while(e!=null)
{
System.err.println("Message: "+e.getMessage());
System.err.println("Probleme SQL : "+e.getSQLState());
System.err.println("Code de l'erreur : "+e.getErrorCode());
e=e.getNextException();
System.err.println("");
}
}

Suggested fix:
java or MySQL bug ?
[23 Jun 2004 12:29] Mickael Besson
The cause of this error is that in my.ini there was :
query_cache_size= 64M
query_cache_limit = 4M

instead of
query_cache_size= 64
query_cache_limit = 4M

Endeed query_cache_size should not contain 'M', and it isn't very logical.
You should ameliorate this (all or nothing).

Thank you.
[23 Jun 2004 21:53] Mark Matthews
This appears to be a server-side bug. You can crash MySQL-5.0 (even the latest from BitKeeper) from JDBC or the MySQL command-line client with the following sequence of queries (which is the sequence of queries the JDBC driver is doing as part of its initialization sequence):

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.1-alpha-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET character_set_results = NULL;
Query OK, 0 rows affected (0.00 sec)

mysql> select round('inf'), round('-inf'), round('nan');
ERROR 2013 (HY000): Lost connection to MySQL server during query
[27 May 2005 14:33] Alexey Botchkov
Tried with the last 5.0.7 on WinXP
both query cache settings and queries by Matthews worked ok