Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
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
abdullh.alsoleman
Front-End
Commits
92427f26
Unverified
Commit
92427f26
authored
Jan 25, 2021
by
Ben Konyi
Committed by
GitHub
Jan 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle 'Existing VM service clients' error from old VM service instances (#74665)
parent
30cf0d4a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
5 deletions
+51
-5
dds.dart
packages/flutter_tools/lib/src/base/dds.dart
+8
-5
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+2
-0
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+41
-0
No files found.
packages/flutter_tools/lib/src/base/dds.dart
View file @
92427f26
...
@@ -72,14 +72,17 @@ class DartDevelopmentService {
...
@@ -72,14 +72,17 @@ class DartDevelopmentService {
e
.
message
.
split
(
' '
).
firstWhere
((
String
e
)
=>
e
.
startsWith
(
'http'
))
e
.
message
.
split
(
' '
).
firstWhere
((
String
e
)
=>
e
.
startsWith
(
'http'
))
);
);
}
on
StateError
{
}
on
StateError
{
if
(
e
.
message
.
contains
(
'Existing VM service clients prevent DDS from taking control.'
))
{
throwToolExit
(
'
${e.message}
. Please rebuild your application with a newer version of Flutter.'
);
return
;
}
logger
.
printError
(
logger
.
printError
(
'DDS has failed to start and there is not an existing DDS instance '
'DDS has failed to start and there is not an existing DDS instance '
'available to connect to. Please comment on '
'available to connect to. Please file an issue at https://github.com/flutter/flutter/issues '
'https://github.com/flutter/flutter/issues/72385 with output from '
'with the following error message:
\n\n
${e.message}
.'
'"flutter doctor -v" and the following error message:
\n\n
${e.message}
.'
);
);
//
Wrap the DDS error message in a StateError so it can be collected
//
DDS was unable to start for an unknown reason. Raise a StateError
//
by the crash handl
er.
//
so it can be reported by the crash report
er.
throw
StateError
(
e
.
message
);
throw
StateError
(
e
.
message
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
92427f26
...
@@ -274,6 +274,8 @@ class FlutterDevice {
...
@@ -274,6 +274,8 @@ class FlutterDevice {
}
else
{
}
else
{
existingDds
=
true
;
existingDds
=
true
;
}
}
}
on
ToolExit
{
rethrow
;
}
on
Exception
catch
(
e
,
st
)
{
}
on
Exception
catch
(
e
,
st
)
{
handleError
(
e
,
st
);
handleError
(
e
,
st
);
return
;
return
;
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
92427f26
...
@@ -2953,6 +2953,47 @@ void main() {
...
@@ -2953,6 +2953,47 @@ void main() {
})
async
=>
mockVMService
,
})
async
=>
mockVMService
,
}));
}));
testUsingContext
(
'Handle existing VM service clients DDS error'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
final
MockDevice
mockDevice
=
MockDevice
();
when
(
mockDevice
.
dds
).
thenReturn
(
DartDevelopmentService
(
logger:
testLogger
));
ddsLauncherCallback
=
(
Uri
uri
,
{
bool
enableAuthCodes
,
bool
ipv6
,
Uri
serviceUri
})
{
throw
FakeDartDevelopmentServiceException
(
message:
'Existing VM service clients prevent DDS from taking control.'
,
);
};
final
TestFlutterDevice
flutterDevice
=
TestFlutterDevice
(
mockDevice
,
observatoryUris:
Stream
<
Uri
>.
value
(
testUri
),
);
bool
caught
=
false
;
final
Completer
<
void
>
done
=
Completer
<
void
>();
runZonedGuarded
(()
{
flutterDevice
.
connect
(
allowExistingDdsInstance:
true
).
then
((
_
)
=>
done
.
complete
());
},
(
Object
e
,
StackTrace
st
)
{
expect
(
e
is
ToolExit
,
true
);
expect
((
e
as
ToolExit
).
message
,
contains
(
'Existing VM service clients prevent DDS from taking control.'
,
));
done
.
complete
();
caught
=
true
;
});
await
done
.
future
;
if
(!
caught
)
{
fail
(
'Expected ToolExit to be thrown.'
);
}
},
overrides:
<
Type
,
Generator
>{
VMServiceConnector:
()
=>
(
Uri
httpUri
,
{
ReloadSources
reloadSources
,
Restart
restart
,
CompileExpression
compileExpression
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
io
.
CompressionOptions
compression
,
Device
device
,
})
async
=>
mockVMService
,
}));
testUsingContext
(
'Failed DDS start outputs error message'
,
()
=>
testbed
.
run
(()
async
{
testUsingContext
(
'Failed DDS start outputs error message'
,
()
=>
testbed
.
run
(()
async
{
// See https://github.com/flutter/flutter/issues/72385 for context.
// See https://github.com/flutter/flutter/issues/72385 for context.
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
...
...
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