Comments (6)
@derekxu16 can you take a look when you have a chance?
from sdk.
Possibly related to this (but if not I can file another issue), the call to DartDevelopmentService.startDartDevelopmentService
never completes when trying to connect to another instance of DDS when it's run in a zone (which is the only workaround I have for the above).
This code will never print 2
, 3
or 4
(when run in debug mode such that it already has a DDS instance) :
import 'dart:async';
import 'dart:developer';
import 'package:dds/dds.dart';
Future<void> main() async {
try {
final serviceInfo = await Service.getInfo();
// Try to connect DDS to an existing version in a zone to handle errors.
final dds = await runZonedGuarded(
() => DartDevelopmentService.startDartDevelopmentService(
serviceInfo.serverUri!),
(error, stack) {
print('1: Failed to start DDS: $error');
},
);
print('2: Done!');
} catch (e) {
print('3: Error: $e');
}
print('4: Done!');
}
This makes it a bit messy to spawn DDS in DAP, because we'd have to use a Zone, and then also a completer to continue when either an error occurs or startDartDevelopmentService
completes (and then we need to ensure that if two errors occur in the handler, or an error occurs and it returns, we don't try to complete the completer twice).
from sdk.
Possibly related to this (but if not I can file another issue)
This issue felt familiar, so I did some digging and found this: flutter/flutter#141821
Basically, this is just the behavior of zones, which is kind of gross.
from sdk.
Ah, thanks for the info, that explains what I see. I handled this by using a completer in https://dart-review.googlesource.com/c/sdk/+/366662 but that's also quite gross, so if we could eliminate the need for a zone (the original issue here) we can remove than and just have the original simple try/catch :-)
from sdk.
@bkonyi, so is our goal here to make exceptions thrown when starting DDS catchable? This webSocketBuilder
call currently doesn't run in a Zone
with an error handler:
sdk/pkg/dds/lib/src/dds_impl.dart
Line 83 in fe91f3e
So I think that if we want to make exceptions thrown when starting DDS catchable, we have to wrap that webSocketBuilder
call with a Completer
+ runZonedGuarded
similarly to what @DanTup did in his CL.
from sdk.
Yeah, basically we just don't want unhandled asynchronous exceptions to leak out of DDS. If it makes sense to throw (e.g., if remoteVmServiceWsUri
points to a VM service that doesn't exist) we should throw synchronously. If it makes sense to swallow an exception (e.g., the VM service connection disappears, which indicates we DDS should shutdown), we should do that and shutdown gracefully.
from sdk.
Related Issues (20)
- Building app for Linux musl? HOT 2
- MSAN use-of-uninitialized-value in FFI tests HOT 1
- Track macro dependencies at the library level for improved invalidation HOT 8
- The SDK configured in dart.flutterSdkPath is not a valid SDK folder. HOT 1
- [breaking change] Change `SecurityContext` to an `abstract final class` HOT 4
- Unhandled Exception: type '_Type' is not a subtype of type 'IBaseModel' in type cast HOT 2
- `Thread 1 is not paused` error at the end of a web test HOT 7
- textDocument/completion payload sizes can be very large because of documentation of in-scope items HOT 7
- Dart cannot open a socket on Android device, not simulator HOT 6
- stdin stream closes unexpectedly when Dart program is spawned from a bat file (which is spawned by a NodeJS process) and an msys2 program has been run earlier in the bat file HOT 1
- vm/cc/DartAPI_BreakpointLockRace flaky -> Timeout on vm-linux-debug-x64c HOT 1
- Crash on new ffi/msan_test on ARM64 MSAN configurations
- Set-Cookie path should not be case-insensitive
- Provide a compatible method to conditionally import between WASM and regular Web with also backward compatibility HOT 5
- [resource_identifiers] closures out of static functions
- pkg/json breaks when a field name contains $ HOT 2
- [vm/ffi] `Pointer.asTypedList` shared across isolates causes use after free
- WASM incorrectly advertises dart.library.js HOT 2
- CFE fails to notice record field name differences when performing subtype matches HOT 1
- extension type on a Function named call HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.