Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
ca7b8322
Commit
ca7b8322
authored
Apr 07, 2018
by
Tianqi Chen
Committed by
GitHub
Apr 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RPC] safe destructor when remote server get killed (#1086)
parent
d949c742
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
src/runtime/rpc/rpc_device_api.cc
+6
-2
src/runtime/rpc/rpc_module.cc
+10
-2
No files found.
src/runtime/rpc/rpc_device_api.cc
View file @
ca7b8322
...
...
@@ -34,8 +34,12 @@ class RPCDeviceAPI final : public DeviceAPI {
}
void
FreeDataSpace
(
TVMContext
ctx
,
void
*
ptr
)
final
{
RemoteSpace
*
space
=
static_cast
<
RemoteSpace
*>
(
ptr
);
GetSess
(
ctx
)
->
CallRemote
(
RPCCode
::
kDevFreeData
,
ctx
,
space
->
data
);
try
{
GetSess
(
ctx
)
->
CallRemote
(
RPCCode
::
kDevFreeData
,
ctx
,
space
->
data
);
}
catch
(
const
dmlc
::
Error
&
e
)
{
// fault tolerance to remote close.
}
delete
space
;
}
void
CopyDataFromTo
(
const
void
*
from
,
...
...
src/runtime/rpc/rpc_module.cc
View file @
ca7b8322
...
...
@@ -26,7 +26,11 @@ struct RPCWrappedFunc {
sess_
->
CallFunc
(
handle_
,
args
,
rv
,
&
fwrap_
);
}
~
RPCWrappedFunc
()
{
sess_
->
CallRemote
(
RPCCode
::
kFreeFunc
,
handle_
);
try
{
sess_
->
CallRemote
(
RPCCode
::
kFreeFunc
,
handle_
);
}
catch
(
const
dmlc
::
Error
&
e
)
{
// fault tolerance to remote close
}
}
static
void
WrapRemote
(
std
::
shared_ptr
<
RPCSession
>
sess
,
...
...
@@ -48,7 +52,11 @@ class RPCModuleNode final : public ModuleNode {
}
~
RPCModuleNode
()
{
if
(
module_handle_
!=
nullptr
)
{
sess_
->
CallRemote
(
RPCCode
::
kModuleFree
,
module_handle_
);
try
{
sess_
->
CallRemote
(
RPCCode
::
kModuleFree
,
module_handle_
);
}
catch
(
const
dmlc
::
Error
&
e
)
{
// fault tolerance to remote close
}
module_handle_
=
nullptr
;
}
}
...
...
Write
Preview
Markdown
is supported
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