tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 47234] New: serviceStartTime is different in MemberImpl from McastServiceImpl
Date Thu, 21 May 2009 14:32:57 GMT

           Summary: serviceStartTime is different in MemberImpl from
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Cluster

I'm using the tribes cluster module in my own application (which has nothing to
do with tomcat) and I'm using the member alive time value to sort all the
cluster members.
This bug produces the following:
I have 2 nodes that were started almost at the same time and both nodes claim
that the other node was started before them

Remote members: (- ready=true suspect=false failing=false
Local member: (- ready=true suspect=false failing=false

Remote members: (- ready=true suspect=false failing=false
Local member: (- ready=true suspect=false failing=false

My code do the following:
Member[] members = groupChannel.getMembers();
Member localMember = groupChannel.getLocalMember(true);

In that code (due to timing issues) it should possible the other way around
(that every node claim to be started before the other) but not that case.

The issue occurs because when the McastService is started, it assigns a start 
time to the local member. 
public class McastService .... {
public void start(int level) {
    impl = new McastServiceImpl(localMember, ....);
But, then it creates and starts a McastServiceImpl which also stores a new
serviceStartTime :-(

public class McastServiceImpl {
protected long serviceStartTime;
public void start(int level) {
    serviceStartTime = System.currentTimeMillis();

So, we have 2 different start times. Unfortunately both times are used:
To get the local member, the impl.getServiceStartTime() is used:

public class McastService .... {
public Member getLocalMember(boolean alive) {
  if ( alive && localMember != null && impl != null)
    return localMember;

But, when the member is transmited throw the network, the
MemberImpl.getServiceStartTime() is used.
public class MemberImpl .... {
    public byte[] getData(boolean getalive, boolean reset)  {
        if ( reset ) dataPkg = null;
        //look in cache first
        if ( dataPkg!=null ) {
            if ( getalive ) {
                //you'd be surprised, but System.currentTimeMillis
                //shows up on the profiler
                long alive=System.currentTimeMillis()-getServiceStartTime();
                XByteBuffer.toBytes( (long) alive, dataPkg,
            return dataPkg;

That produces that weird behaviour.
IMHO, the fix should be setting the same "serviceStartTime" to both components.

This issue is affecting seriously my code. I would appreciate if you could fix
it asap.
I've verified that the same code is present in trunk repository.


Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message