You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Adrian Tarau <ad...@daxtechnologies.com> on 2006/10/12 18:50:36 UTC

JournalPersistenceAdapter.recover hangs

I got recently into a problem with the journal, when the application 
starts it hangs. After some debug, I noticed that 

JournalPersistenceAdapter.recover() {
    ...
    while ((pos = journal.getNextRecordLocation(pos)) != null) {
     ...
    }
    ...
}

loops infinitely .

RecordLocation indicate that the position goes to the end of the journal 
and start again.

Anybody experienced something like that? It is a know bug in 4.0.1, I 
couldn't find something, but maybe I missed somehow.

Thanks.





Re: JournalPersistenceAdapter.recover hangs

Posted by Adrian Tarau <ad...@daxtechnologies.com>.
It says there that the last release is 4.0.1, even if there is 4.0.2 in 
the list, at the previous releases??!!!
And I read somewhere that is recommended 4.0.1, because 4.0.2 is not 
official???


    Latest Releases

You can find all the distributions for 4.x and above within the 
Distribution Area^ 
<http://people.apache.org/repository/incubator-activemq/>.


The latest release is ActiveMQ 4.0.1 Release 
<http://www.activemq.org/site/activemq-401-release.html>

Other releases are available

    * Current Maven 2 snapshot releases^
      <http://people.apache.org/maven-snapshot-repository/org/apache/activemq/apache-activemq/>
      or older Maven 2 snapshots^
      <http://people.apache.org/maven-snapshot-repository/incubator-activemq/incubator-activemq/>
    * Other development SNAPSHOT releases^
      <http://people.apache.org/repository/incubator-activemq/zips/>
    * Previous distributions^
      <http://people.apache.org/repository/incubator-activemq/distributions/>


    Previous Releases

    * ActiveMQ 1.0 Release
      <http://www.activemq.org/site/activemq-10-release.html>
    * ActiveMQ 1.1 Release
      <http://www.activemq.org/site/activemq-11-release.html>
    * ActiveMQ 1.2 Release
      <http://www.activemq.org/site/activemq-12-release.html>
    * ActiveMQ 1.3 Release
      <http://www.activemq.org/site/activemq-13-release.html>
    * ActiveMQ 1.4 Release
      <http://www.activemq.org/site/activemq-14-release.html>
    * ActiveMQ 1.5 Release
      <http://www.activemq.org/site/activemq-15-release.html>
    * ActiveMQ 2.0 Release
      <http://www.activemq.org/site/activemq-20-release.html>
    * ActiveMQ 2.1 Release
      <http://www.activemq.org/site/activemq-21-release.html>
    * ActiveMQ 3.0 Release
      <http://www.activemq.org/site/activemq-30-release.html>
    * ActiveMQ 3.1 Release
      <http://www.activemq.org/site/activemq-31-release.html>
    * ActiveMQ 3.2 Release
      <http://www.activemq.org/site/activemq-32-release.html>
    * ActiveMQ 3.2.1 Release
      <http://www.activemq.org/site/activemq-321-release.html>
    * ActiveMQ 3.2.2 Release
      <http://www.activemq.org/site/activemq-322-release.html>
    * ActiveMQ 4.0 M4 Release
      <http://www.activemq.org/site/activemq-40-m4-release.html>
    * ActiveMQ 4.0 RC2 Release
      <http://www.activemq.org/site/activemq-40-rc2-release.html>
    * ActiveMQ 4.0 Release
      <http://www.activemq.org/site/activemq-40-release.html>
    * ActiveMQ 4.0.1 Release
      <http://www.activemq.org/site/activemq-401-release.html>
    * ActiveMQ 4.0.2 Release
      <http://www.activemq.org/site/activemq-402-release.html>





Rob Davies wrote:
> Perhaps you'd be better to use 4.0.2 ?
>
> cheers,
>
> Rob
> On 12 Oct 2006, at 21:08, Adrian Tarau wrote:
>
>> More about this. I found where it is the problem. The problem is in 
>> LogFileManager. Look at the first source code, code from version 
>> 4.0.1, which should work fine and return null when the next data 
>> record belongs to a log with an id less or equal that the current one.
>> The second source code is a decompilation with JAD and the second 
>> test is not there.
>>
>> How could be possible? The code seems to be behind the source code !!!!!
>>
>> Thanks.
>>
>> *Source from 4.0.1*
>>
>> public Location getNextDataRecordLocation(Location lastLocation) 
>> throws IOException, InvalidRecordLocationException {
>>        RecordInfo ri = readRecordInfo(lastLocation);
>>        while (true) {
>>
>>            int logFileId = ri.getLocation().getLogFileId();
>>            int offset = ri.getNextLocation();
>>
>>            // Are we overflowing into next logFile?
>>            if (offset >= ri.getLogFileState().getAppendOffset()) {
>>                LogFileNode nextActive = 
>> ri.getLogFileState().getNextActive();
>>                *if (nextActive == null || nextActive.getId() <= 
>> ri.getLogFileState().getId() ) {*
>>                    return null;
>>                }
>>                logFileId = nextActive.getId();
>>                offset = 0;
>>            }
>>
>>            try {
>>                ri = readRecordInfo(new Location(logFileId, offset));
>>            } catch (InvalidRecordLocationException e) {
>>                return null;
>>            }
>>
>>            // Is the next record the right record type?
>>            if (ri.getHeader().getRecordType() == DATA_RECORD_TYPE) {
>>                return ri.getLocation();
>>            }
>>            // No? go onto the next record.
>>        }
>>    }
>>
>> *Decompiled class*
>>
>> public Location getNextDataRecordLocation(Location lastLocation) 
>> throws IOException, InvalidRecordLocationException {
>> /* 409*/        RecordInfo ri = readRecordInfo(lastLocation);
>> /* 412*/        do {
>> /* 412*/            int logFileId = ri.getLocation().getLogFileId();
>> /* 413*/            int offset = ri.getNextLocation();
>> /* 416*/            if(offset >= 
>> ri.getLogFileState().getAppendOffset()) {
>> /* 417*/                LogFileNode nextActive = 
>> ri.getLogFileState().getNextActive();
>> /* 418*/                *if(nextActive == null)*
>> /* 419*/                    return null;
>> /* 421*/                logFileId = nextActive.getId();
>> /* 422*/                offset = 0;
>>                    }
>> /* 426*/            try {
>> /* 426*/                ri = readRecordInfo(new Location(logFileId, 
>> offset));
>>                    }
>> /* 427*/            catch(InvalidRecordLocationException e) {
>> /* 428*/                return null;
>>                    }
>>                } while(ri.getHeader().getRecordType() != 1);
>> /* 433*/        return ri.getLocation();
>>            }
>>
>> Adrian Tarau wrote:
>>> I got recently into a problem with the journal, when the application 
>>> starts it hangs. After some debug, I noticed that
>>> JournalPersistenceAdapter.recover() {
>>>    ...
>>>    while ((pos = journal.getNextRecordLocation(pos)) != null) {
>>>     ...
>>>    }
>>>    ...
>>> }
>>>
>>> loops infinitely .
>>>
>>> RecordLocation indicate that the position goes to the end of the 
>>> journal and start again.
>>>
>>> Anybody experienced something like that? It is a know bug in 4.0.1, 
>>> I couldn't find something, but maybe I missed somehow.
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>
>


Re: JournalPersistenceAdapter.recover hangs

Posted by Rob Davies <ra...@gmail.com>.
Perhaps you'd be better to use 4.0.2 ?

cheers,

Rob
On 12 Oct 2006, at 21:08, Adrian Tarau wrote:

> More about this. I found where it is the problem. The problem is in  
> LogFileManager. Look at the first source code, code from version  
> 4.0.1, which should work fine and return null when the next data  
> record belongs to a log with an id less or equal that the current one.
> The second source code is a decompilation with JAD and the second  
> test is not there.
>
> How could be possible? The code seems to be behind the source  
> code !!!!!
>
> Thanks.
>
> *Source from 4.0.1*
>
> public Location getNextDataRecordLocation(Location lastLocation)  
> throws IOException, InvalidRecordLocationException {
>        RecordInfo ri = readRecordInfo(lastLocation);
>        while (true) {
>
>            int logFileId = ri.getLocation().getLogFileId();
>            int offset = ri.getNextLocation();
>
>            // Are we overflowing into next logFile?
>            if (offset >= ri.getLogFileState().getAppendOffset()) {
>                LogFileNode nextActive = ri.getLogFileState 
> ().getNextActive();
>                *if (nextActive == null || nextActive.getId() <=  
> ri.getLogFileState().getId() ) {*
>                    return null;
>                }
>                logFileId = nextActive.getId();
>                offset = 0;
>            }
>
>            try {
>                ri = readRecordInfo(new Location(logFileId, offset));
>            } catch (InvalidRecordLocationException e) {
>                return null;
>            }
>
>            // Is the next record the right record type?
>            if (ri.getHeader().getRecordType() == DATA_RECORD_TYPE) {
>                return ri.getLocation();
>            }
>            // No? go onto the next record.
>        }
>    }
>
> *Decompiled class*
>
> public Location getNextDataRecordLocation(Location lastLocation)  
> throws IOException, InvalidRecordLocationException {
> /* 409*/        RecordInfo ri = readRecordInfo(lastLocation);
> /* 412*/        do {
> /* 412*/            int logFileId = ri.getLocation().getLogFileId();
> /* 413*/            int offset = ri.getNextLocation();
> /* 416*/            if(offset >= ri.getLogFileState 
> ().getAppendOffset()) {
> /* 417*/                LogFileNode nextActive = ri.getLogFileState 
> ().getNextActive();
> /* 418*/                *if(nextActive == null)*
> /* 419*/                    return null;
> /* 421*/                logFileId = nextActive.getId();
> /* 422*/                offset = 0;
>                    }
> /* 426*/            try {
> /* 426*/                ri = readRecordInfo(new Location(logFileId,  
> offset));
>                    }
> /* 427*/            catch(InvalidRecordLocationException e) {
> /* 428*/                return null;
>                    }
>                } while(ri.getHeader().getRecordType() != 1);
> /* 433*/        return ri.getLocation();
>            }
>
> Adrian Tarau wrote:
>> I got recently into a problem with the journal, when the  
>> application starts it hangs. After some debug, I noticed that
>> JournalPersistenceAdapter.recover() {
>>    ...
>>    while ((pos = journal.getNextRecordLocation(pos)) != null) {
>>     ...
>>    }
>>    ...
>> }
>>
>> loops infinitely .
>>
>> RecordLocation indicate that the position goes to the end of the  
>> journal and start again.
>>
>> Anybody experienced something like that? It is a know bug in  
>> 4.0.1, I couldn't find something, but maybe I missed somehow.
>>
>> Thanks.
>>
>>
>>
>>
>


Re: JournalPersistenceAdapter.recover hangs

Posted by Adrian Tarau <ad...@daxtechnologies.com>.
More about this. I found where it is the problem. The problem is in 
LogFileManager. Look at the first source code, code from version 4.0.1, 
which should work fine and return null when the next data record belongs 
to a log with an id less or equal that the current one.
The second source code is a decompilation with JAD and the second test 
is not there.

How could be possible? The code seems to be behind the source code !!!!!

Thanks.

*Source from 4.0.1*

public Location getNextDataRecordLocation(Location lastLocation) throws 
IOException, InvalidRecordLocationException {
        RecordInfo ri = readRecordInfo(lastLocation);
        while (true) {

            int logFileId = ri.getLocation().getLogFileId();
            int offset = ri.getNextLocation();

            // Are we overflowing into next logFile?
            if (offset >= ri.getLogFileState().getAppendOffset()) {
                LogFileNode nextActive = 
ri.getLogFileState().getNextActive();
                *if (nextActive == null || nextActive.getId() <= 
ri.getLogFileState().getId() ) {*
                    return null;
                }
                logFileId = nextActive.getId();
                offset = 0;
            }

            try {
                ri = readRecordInfo(new Location(logFileId, offset));
            } catch (InvalidRecordLocationException e) {
                return null;
            }

            // Is the next record the right record type?
            if (ri.getHeader().getRecordType() == DATA_RECORD_TYPE) {
                return ri.getLocation();
            }
            // No? go onto the next record.
        }
    }

*Decompiled class*

public Location getNextDataRecordLocation(Location lastLocation) throws 
IOException, InvalidRecordLocationException {
/* 409*/        RecordInfo ri = readRecordInfo(lastLocation);
/* 412*/        do {
/* 412*/            int logFileId = ri.getLocation().getLogFileId();
/* 413*/            int offset = ri.getNextLocation();
/* 416*/            if(offset >= ri.getLogFileState().getAppendOffset()) {
/* 417*/                LogFileNode nextActive = 
ri.getLogFileState().getNextActive();
/* 418*/                *if(nextActive == null)*
/* 419*/                    return null;
/* 421*/                logFileId = nextActive.getId();
/* 422*/                offset = 0;
                    }
/* 426*/            try {
/* 426*/                ri = readRecordInfo(new Location(logFileId, 
offset));
                    }
/* 427*/            catch(InvalidRecordLocationException e) {
/* 428*/                return null;
                    }
                } while(ri.getHeader().getRecordType() != 1);
/* 433*/        return ri.getLocation();
            }

Adrian Tarau wrote:
> I got recently into a problem with the journal, when the application 
> starts it hangs. After some debug, I noticed that
> JournalPersistenceAdapter.recover() {
>    ...
>    while ((pos = journal.getNextRecordLocation(pos)) != null) {
>     ...
>    }
>    ...
> }
>
> loops infinitely .
>
> RecordLocation indicate that the position goes to the end of the 
> journal and start again.
>
> Anybody experienced something like that? It is a know bug in 4.0.1, I 
> couldn't find something, but maybe I missed somehow.
>
> Thanks.
>
>
>
>