activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: JournalPersistenceAdapter.recover hangs
Date Thu, 12 Oct 2006 20:12:59 GMT
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.
>>
>>
>>
>>
>


Mime
View raw message