db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kurt Huwig (JIRA)" <j...@apache.org>
Subject [jira] Created: (DERBY-2748) TimeSlice and Socket-Timeout bounds checking wrong
Date Sat, 02 Jun 2007 19:51:15 GMT
TimeSlice and Socket-Timeout bounds checking wrong

                 Key: DERBY-2748
                 URL: https://issues.apache.org/jira/browse/DERBY-2748
             Project: Derby
          Issue Type: Bug
          Components: Network Client
    Affects Versions:
            Reporter: Kurt Huwig

ClientThread sets the Socket timeout based upon the timeslice value:

	//set time out					
	//this looks highly suspect.  Why does timeSlice setSoTimeout?		
	if (timeSlice != 0)

it gets the timeSlice from NetworkServerControlImpl which sets it like this:

	 * Set the current value of  time slice
	 * @param value time slice value
	 * @exception Exception if value is < 0
	private void setTimeSlice(int value)
		throws Exception
		if (value < MIN_TIMESLICE)
			consolePropertyMessage("DRDA_InvalidValue.U", new String [] 
				{new Integer(value).toString(), "timeslice"});
		if (value == USE_DEFAULT)
		synchronized(timeSliceSync) {
			timeSlice = value;


	private final static int MIN_TIMESLICE = -1;

therefore a value of -1 is accepted by setTimeSlice, due to "!= 0" used for Socket.setSoTimeout
which will bail out with an Exception:

	if (timeout < 0)
	  throw new IllegalArgumentException("timeout can't be negative");

According to the comments, the proper fix would be

-	private final static int MIN_TIMESLICE = -1;
+	private final static int MIN_TIMESLICE = 0;

but I do not understand the timeslice at all, so this is just my guess.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message