You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Pavel Moravec (JIRA)" <ji...@apache.org> on 2014/05/16 13:24:54 UTC

[jira] [Created] (QPID-5767) [C++ broker][linearstore] broker segfaults when recovering journal file with damaged header

Pavel Moravec created QPID-5767:
-----------------------------------

             Summary: [C++ broker][linearstore] broker segfaults when recovering journal file with damaged header
                 Key: QPID-5767
                 URL: https://issues.apache.org/jira/browse/QPID-5767
             Project: Qpid
          Issue Type: Bug
          Components: C++ Broker
    Affects Versions: 0.26
            Reporter: Pavel Moravec
            Assignee: Pavel Moravec
            Priority: Minor


Description of problem:
If journal file has corrupted header (example below), especially if EFP identity is invalid, broker segfaults.

The reason is:

EmptyFilePool* EmptyFilePoolManager::getEmptyFilePool(const efpPartitionNumber_t partitionNumber,
                                                      const efpDataSize_kib_t efpDataSize_kib) {
    EmptyFilePoolPartition* efppp = getEfpPartition(partitionNumber);
    if (efppp != 0)
        return efppp->getEmptyFilePool(efpDataSize_kib);
    return 0;
}

returns null pointer that is taken in:

void RecoveryManager::analyzeJournals(const std::vector<std::string>* preparedTransactionListPtr,
                                      EmptyFilePoolManager* emptyFilePoolManager,
                                      EmptyFilePool** emptyFilePoolPtrPtr) {
    // Analyze file headers of existing journal files
    efpIdentity_t efpIdentity;
    analyzeJournalFileHeaders(efpIdentity);
    *emptyFilePoolPtrPtr = emptyFilePoolManager->getEmptyFilePool(efpIdentity);
    efpFileSize_kib_ = (*emptyFilePoolPtrPtr)->fileSize_kib();


One real world example to get damaged journal (header): disk gets out of free space just when generating a new journal file, such that the file is created as truncated and contains just zeroes.


Version-Release number of selected component (if applicable):
qpid-cpp 0.22-38


How reproducible:
100%


Steps to Reproduce:
0. Start broker with empty provisioning

1. Create a durable queue:
qpid-config add queue q --durable

2. Create an empty "damaged" journal file and set its permissions:
dd if=/dev/zero of=/var/lib/qpidd/qls/jrnl/q/$(uuidgen).jrnl bs=1024 count=2052
chown qpidd:qpidd /var/lib/qpidd/qls/jrnl/q/*
(To have the reproducer really reliable, remove the journal file that linearstore created. Just to have there only the "damaged" file with 0s.)

3. Restart broker


Actual results:
Broker segfaults, logging:
2014-05-15 12:42:00.421721427 [Store] warning Linear Store: Journal "q": Journal file /var/lib/qpidd/qls/jrnl/q/d09e7bfb-5efa-4d96-9071-ad1053377d36.jrnl is uninitialized
2014-05-15 12:42:00.616301329 [System] debug Exception constructed: Cannot read from child process.
2014-05-15 12:42:00.616558206 [Broker] critical Unexpected error: Cannot read from child process.


Expected results:
Broker raises critical exception (stopping its kick-off) with a message like "Journal file .. has unknown EFP identity (pn=0,ds=0), please fix it".


Additional info:



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org