Bug #44443 Waiting more than 600 seconds for on a query for streaming resultset
Submitted: 23 Apr 2009 17:05 Modified: 29 Apr 2015 12:27
Reporter: marcus eiras Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:5.1.7 OS:Windows (2000 server)
Assigned to: Alexander Soklakov CPU Architecture:Any
Tags: streaming resultset

[23 Apr 2009 17:05] marcus eiras
Description:
When running a slow query (ex: a select that takes more than 600 seconds to write result, "sending data" more than 600 seconds on show full processlist) on a streaming resultset the client doesnt read the answer properly from the server causing a timeout.

Note: I am using streaming resultset feature. Tried both "set net_write_timeout=99999;" on connector j 5.0 and also tried netTimoutForStreamingResults=99999 as url parameter on connector j 5.1.7

How to repeat:
1) create a streaming resultset on a connection using netTimoutForStreamingResults=99999

2) run a select query that takes more than 600 seconds to write a result to the client

Used code:

		        conn = ConnectionManager.getConexao(this.getStrIpServidor(), this.getNmeUsuario(), this.getStrSenha(), this.getPorta(), this.getDriver(), this.getPrefix(),"/?zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&interactiveClient=true&netTimeoutForStreamingResults=99999");
		        
		        
		        conn.setAutoCommit(true);                                                
		       	stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,java.sql.ResultSet.CONCUR_READ_ONLY);
		        stmt.setFetchSize(Integer.MIN_VALUE);                
		        stmt.setQueryTimeout(this.getInt_timeout());	
		        stmt.execute("SET net_read_timeout=999999;");
		        stmt.execute("SET net_write_timeout=999999;");
		        ResultSet rsbla = stmt.executeQuery("SELECT @@session.net_write_timeout,@@session.net_read_timeout");		       
		        if (rsbla.next())
		        	System.out.println(" =====> "+rsbla.getString(1)+" ++ "+rsbla.getString(2));
		        rsbla.close();
		        rsbla=null;	
		         
//SLOW QUERY THAT TAKES MORE THAN 600 SECONDS on EXECUTE BELLOW
		        if (stmt.execute(this.getComando())) { 
		            this.setRs(stmt.getResultSet());
		        }
[23 Apr 2009 20:28] marcus eiras
im trying to simulate and make a test case but it seems to not work if you simply lock a table at another database session. 

it seems on this case that if you lock a table at another session the connector j keeps on a loop trying over and over the same select that should be waiting for the lock to be released instead of keep waiting a response from mysql for that locked table
[23 Apr 2009 20:30] marcus eiras
stays on loop or sends some kind of signal telling server to notify when lock is release
[24 Apr 2009 6:45] Tonci Grgin
Hi Marcus and thanks for your report.

Can I please get a test case and a clear description on how to use it so I can test this?
[24 May 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[29 Apr 2015 12:27] Alexander Soklakov
Closed as Can't repeat because we have no feedback for 6 years and it's not clear how to reproduce the situation.