Bug 4224 - Deadtime parameter bug on 3.0.23c, OK on 3.0.22
Deadtime parameter bug on 3.0.23c, OK on 3.0.22
Status: RESOLVED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: File Services
3.0.23c
x86 Linux
: P3 normal
: none
Assigned To: Samba Bugzilla Account
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-14 10:50 UTC by Alain GORLIER
Modified: 2006-11-14 19:07 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alain GORLIER 2006-11-14 10:50:58 UTC
Deadtime paramter does not work with samba 3.0.23c.
Idle connections are not detected correctly.
There is a change in 3.0.23 that leads to this bug.

For 3.0.23 the new lastused_count variable appears.
The code in conn.c is :

for (conn=Connections;conn;conn=next) {
		next=conn->next;

		/* Update if connection wasn't idle. */
		if (conn->lastused != conn->lastused_count) {
			conn->lastused = t; /****** Problem is HERE **********/
		}

		/* close dirptrs on connections that are idle */
		if ((t-conn->lastused) > DPTR_IDLE_TIMEOUT) {
			dptr_idlecnum(conn);
		}

		if (conn->num_files_open > 0 || (t-conn->lastused)<deadtime) {
			allidle = False;
		}
	}

As conn->lastused_count is different a few increments above conn->lastused that has been done by service.c ), the conn->lastused is then set to actual time.
If there is no activity for this connection, each time we run this code, each time conn->lastused is set to new actual time.
Then t-conn->lastused is always 0. So, deadtime is not a condition to go in "Idle" state.
Modifying the code:
		/* Update if connection wasn't idle. */
		if (conn->lastused != conn->lastused_count) {
			conn->lastused = t; /****** Problem is HERE **********/
		}

With:
		/* Update if connection wasn't idle. */
		if (conn->lastused != conn->lastused_count) {
			conn->lastused = t; 
                        conn->lastused_count = t;  /* FIX is HERE */
		}
Then it works (we have compiled and tested this fix)

In version 3.0.22 the conn.c, there is no use of lastused_count then deadtime works :
3.0.22 conn.c :
for (conn=Connections;conn;conn=next) {
		next=conn->next;
		/* close dirptrs on connections that are idle */
		if ((t-conn->lastused) > DPTR_IDLE_TIMEOUT)
			dptr_idlecnum(conn);

		if (conn->num_files_open > 0 || (t-conn->lastused)<deadtime)
			allidle = False;
	}

Do you agree ?

Thanks,
Comment 1 Jeremy Allison 2006-11-14 19:07:04 UTC
Yes - completely correct ! Thanks for the fix.
Fixed in SVN (Jerry this probably needs to be in 3.0.23d).
Jeremy.