mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:39:48 +00:00
[vm] Account for Out Of Memory during isolate message deserialization.
TEST=run test harness with low heap limit Change-Id: I75d3b2e8461bcf99cc41eb3ad76173bc1976bbd9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213538 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
5110d828d0
commit
790d0b601c
|
@ -16,11 +16,9 @@ class Error;
|
|||
|
||||
class LongJumpScope : public StackResource {
|
||||
public:
|
||||
LongJumpScope()
|
||||
: StackResource(ThreadState::Current()),
|
||||
top_(nullptr),
|
||||
base_(thread()->long_jump_base()) {
|
||||
thread()->set_long_jump_base(this);
|
||||
explicit LongJumpScope(ThreadState* thread = ThreadState::Current())
|
||||
: StackResource(thread), top_(nullptr), base_(thread->long_jump_base()) {
|
||||
thread->set_long_jump_base(this);
|
||||
}
|
||||
|
||||
~LongJumpScope() {
|
||||
|
|
|
@ -3745,7 +3745,7 @@ std::unique_ptr<Message> WriteMessage(bool can_send_any_object,
|
|||
|
||||
volatile bool has_exception = false;
|
||||
{
|
||||
LongJumpScope jump;
|
||||
LongJumpScope jump(thread);
|
||||
if (setjmp(*jump.Set()) == 0) {
|
||||
serializer.Serialize(obj);
|
||||
} else {
|
||||
|
@ -3820,8 +3820,13 @@ ObjectPtr ReadMessage(Thread* thread, Message* message) {
|
|||
return ReadObjectGraphCopyMessage(thread, message->persistent_handle());
|
||||
} else {
|
||||
RELEASE_ASSERT(message->IsSnapshot());
|
||||
LongJumpScope jump(thread);
|
||||
if (setjmp(*jump.Set()) == 0) {
|
||||
MessageDeserializer deserializer(thread, message);
|
||||
return deserializer.Deserialize();
|
||||
} else {
|
||||
return thread->StealStickyError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue