Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
d0307c48
Commit
d0307c48
authored
Nov 20, 2015
by
Eric Cano
Browse files
Fixed memory leak in case of exception.
parent
b77af9a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
tapeserver/castor/tape/tapeserver/daemon/RecallTaskInjector.cpp
View file @
d0307c48
...
...
@@ -85,7 +85,7 @@ void RecallTaskInjector::startThreads() {
//------------------------------------------------------------------------------
//injectBulkRecalls
//------------------------------------------------------------------------------
void
RecallTaskInjector
::
injectBulkRecalls
(
const
std
::
vector
<
cta
::
RetrieveJob
*
>&
jobs
)
{
void
RecallTaskInjector
::
injectBulkRecalls
(
std
::
vector
<
std
::
unique_ptr
<
cta
::
RetrieveJob
>
>&
jobs
)
{
for
(
auto
it
=
jobs
.
begin
();
it
!=
jobs
.
end
();
++
it
)
{
(
*
it
)
->
positioningMethod
=
cta
::
PositioningMethod
::
ByBlock
;
...
...
@@ -101,8 +101,9 @@ void RecallTaskInjector::injectBulkRecalls(const std::vector<cta::RetrieveJob *>
m_lc
.
log
(
LOG_INFO
,
"Recall task created"
);
DiskWriteTask
*
dwt
=
new
DiskWriteTask
(
*
it
,
m_memManager
);
TapeReadTask
*
trt
=
new
TapeReadTask
(
*
it
,
*
dwt
,
m_memManager
);
cta
::
RetrieveJob
*
job
=
it
->
get
();
DiskWriteTask
*
dwt
=
new
DiskWriteTask
(
it
->
release
(),
m_memManager
);
TapeReadTask
*
trt
=
new
TapeReadTask
(
job
,
*
dwt
,
m_memManager
);
m_diskWriter
.
push
(
dwt
);
m_tapeReader
.
push
(
trt
);
...
...
@@ -116,7 +117,7 @@ void RecallTaskInjector::injectBulkRecalls(const std::vector<cta::RetrieveJob *>
//------------------------------------------------------------------------------
bool
RecallTaskInjector
::
synchronousInjection
()
{
std
::
vector
<
cta
::
RetrieveJob
*
>
jobs
;
std
::
vector
<
std
::
unique_ptr
<
cta
::
RetrieveJob
>
>
jobs
;
try
{
uint64_t
files
=
0
;
...
...
@@ -126,7 +127,7 @@ bool RecallTaskInjector::synchronousInjection()
if
(
!
job
.
get
())
break
;
files
++
;
bytes
+=
job
->
archiveFile
.
size
;
jobs
.
push
_back
(
job
.
release
());
jobs
.
emplace
_back
(
job
.
release
());
}
}
catch
(
castor
::
exception
::
Exception
&
ex
)
{
castor
::
log
::
ScopedParamContainer
scoped
(
m_lc
);
...
...
@@ -185,7 +186,7 @@ void RecallTaskInjector::WorkerThread::run()
break
;
}
m_parent
.
m_lc
.
log
(
LOG_DEBUG
,
"RecallJobInjector:run: about to call client interface"
);
std
::
vector
<
cta
::
RetrieveJob
*
>
jobs
;
std
::
vector
<
std
::
unique_ptr
<
cta
::
RetrieveJob
>
>
jobs
;
uint64_t
files
=
0
;
uint64_t
bytes
=
0
;
...
...
@@ -194,7 +195,7 @@ void RecallTaskInjector::WorkerThread::run()
if
(
!
job
.
get
())
break
;
files
++
;
bytes
+=
job
->
archiveFile
.
size
;
jobs
.
push
_back
(
job
.
release
());
jobs
.
emplace
_back
(
job
.
release
());
}
LogContext
::
ScopedParam
sp01
(
m_parent
.
m_lc
,
Param
(
"transactionId"
,
m_parent
.
m_retrieveMount
.
getMountTransactionId
()));
...
...
tapeserver/castor/tape/tapeserver/daemon/RecallTaskInjector.hpp
View file @
d0307c48
...
...
@@ -126,7 +126,7 @@ private:
* Create all the tape-read and write-disk tasks for set of files to retrieve
* @param jobs
*/
void
injectBulkRecalls
(
const
std
::
vector
<
cta
::
RetrieveJob
*
>&
jobs
);
void
injectBulkRecalls
(
std
::
vector
<
std
::
unique_ptr
<
cta
::
RetrieveJob
>
>&
jobs
);
/**
* A request of files to recall. We request EITHER
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment