Skip to content

Commit

Permalink
Fix bug in VReadProcessBlocks -- removing vector while iterating.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and osschar committed Mar 9, 2016
1 parent 60267b5 commit cc78ca0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/XrdFileCache/XrdFileCacheVRead.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace XrdFileCache {
// first element is block index, the following vector elements are chunk readv indicies
struct ReadVChunkListDisk {
ReadVChunkListDisk(int i) : block_idx(i) {};
std::vector <int> arr;
int block_idx;
std::vector <int> arr;
};

struct ReadVChunkListRAM {
Expand Down Expand Up @@ -173,7 +173,7 @@ bool File::VReadPreProcess(const XrdOucIOVec *readV, int n, ReadVBlockListRAM& b
for (int block_idx = blck_idx_first; block_idx <= blck_idx_last; ++block_idx)
{

clLog()->Debug(XrdCl::AppMsg, "VReadPreProcess chunk %lld@lld", readV[iov_idx].size, readV[iov_idx].offset);
clLog()->Debug(XrdCl::AppMsg, "VReadPreProcess chunk %lld@%lld", readV[iov_idx].size, readV[iov_idx].offset);
BlockMap_i bi = m_block_map.find(block_idx);
if (bi != m_block_map.end())
{
Expand All @@ -192,6 +192,7 @@ bool File::VReadPreProcess(const XrdOucIOVec *readV, int n, ReadVBlockListRAM& b
Block *b = RequestBlock(block_idx, false);
if (!b) return false;
blocks_to_process.AddEntry(b, iov_idx);
clLog()->Debug(XrdCl::AppMsg, "VReadPreProcess requst block %d", block_idx);
inc_ref_count(b);
}
else {
Expand Down Expand Up @@ -262,8 +263,8 @@ int File::VReadProcessBlocks(const XrdOucIOVec *readV, int n,
if (bi->block->is_finished())
{
finished.push_back(ReadVChunkListRAM(bi->block, bi->arr));
std::vector<ReadVChunkListRAM>::iterator bj = bi++;
blocks_to_process.erase(bj);
// std::vector<ReadVChunkListRAM>::iterator bj = bi++;
blocks_to_process.erase(bi);
}
else
{
Expand Down

0 comments on commit cc78ca0

Please sign in to comment.