connect to DDS without relying on a redirect.
Some WebSocket implementations (particularly dart:html's) don't follow
redirects and don't provide the user with the message returned by the
server.
This CL adds 'getWebSocketTarget' as an RPC which returns the
URI that should be used by the client to connect directly to the proper
web socket target. In addition, the "implicit-redirect" forwarding has
been removed.
Change-Id: Iaf88c965f6fedfa6f63c28a08860a3c80388797c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156485
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This reverts commit 65e3c9d3b1.
Reason for revert: package:logging, package:stack_trace and package:usage need to be migrated first.
Original change's description:
> [vm, service, observatory] Bang Bang (My Type System Shot Me Down).
>
> Port the service tests and Observatory to Dart 3.
>
> Changes from the original landing:
>
> - The old tests are copied to observatory_2 / service_2 so the service can still be tested when running a legacy mode program
> - The test harness is taught about 'service_2'
> - Observatory's package is added to front end's opt-in list
> - Fixed some places in the bot configuration matrix so ensure 'service' runs on legacy bots and 'service_2' on weak-mode bots
>
> The ported tests themselves are not changed.
>
> Change-Id: I1d7e5cc61cdc044e1985e851bea7fd8a18f7d810
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149720
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>
TBR=bkonyi@google.com,rmacnak@google.com
Change-Id: I43b72f149d8d7e9fe06006cdd8593fed1726aa3a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152004
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
Port the service tests and Observatory to Dart 3.
Changes from the original landing:
- The old tests are copied to observatory_2 / service_2 so the service can still be tested when running a legacy mode program
- The test harness is taught about 'service_2'
- Observatory's package is added to front end's opt-in list
- Fixed some places in the bot configuration matrix so ensure 'service' runs on legacy bots and 'service_2' on weak-mode bots
The ported tests themselves are not changed.
Change-Id: I1d7e5cc61cdc044e1985e851bea7fd8a18f7d810
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149720
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Added a private RPC, _yieldControlToDDS, which DDS invokes once
connected to the VM service. Once this method is called, the following
happens:
- The VM service stops accepting new web socket requests.
- The VM service enters single client mode, where DDS is the single
client.
DDS can only place the VM service in single client mode when it is the only
VM service client. If other clients are connected, DDS will fail to start and
throw an exception.
The purpose of this change is to simplify state management between the
VM service and DDS. The plan is to delegate the following features to
DDS:
- Service extension management
- Custom client name support
- Isolate resume coordination for multiple clients
Change-Id: I0b3143710d94ee9444a4894e24555f7ed1caf5ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142564
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This reverts commit 6b2419ddaf.
Reason for revert: Failures on bots. Reverting.
Original change's description:
> [ Service / package:dds ] Add stream support to package:dds and enable DDS for VM service tests
>
> This change adds stream forwarding to the Dart Development Service,
> allowing for clients to subscribe to service protocol streams with DDS
> instead of the VM service directly. DDS will maintain a single
> subscription for each stream as long as at least one client is listening
> to that stream. A DDS stream subscription will be closed when the last
> client listening to that stream either disconnects or calls
> streamCancel.
>
> This change also enables DDS for most of the Observatory services tests,
> excluding thoses which utilize:
>
> - Service extensions
> - Client naming
> - Client isolate resume synchronization
>
> Change-Id: I5641e879a7626fcd5e4d28434ed480dd72fc7659
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142083
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>
TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com
Change-Id: I185e63eabca54a3dff49d4f5a8a126795cadfa80
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142820
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This change adds stream forwarding to the Dart Development Service,
allowing for clients to subscribe to service protocol streams with DDS
instead of the VM service directly. DDS will maintain a single
subscription for each stream as long as at least one client is listening
to that stream. A DDS stream subscription will be closed when the last
client listening to that stream either disconnects or calls
streamCancel.
This change also enables DDS for most of the Observatory services tests,
excluding thoses which utilize:
- Service extensions
- Client naming
- Client isolate resume synchronization
Change-Id: I5641e879a7626fcd5e4d28434ed480dd72fc7659
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142083
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This improves the time to deserialize a snapshot. It also doubles the memory needed to receive the snapshot buffer, but the memory high water mark is still computing the dominators.
Change-Id: Ib93015cd6cb366dd2ff750da09ddaa3b37159f68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115010
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This replaces _requestHeapSnapshot and _getObjectByAddresses, which relied on the invalid assumption that objects don't move and the heap hasn't mutated since the initial snapshot.
Updates Observatory to the new format. Adds treemap visualization of the dominator tree. Adds the ability to save and load heap snapshots to files. Removes analysis grouping references by source and target class. Removes ability to navigate from a pixel in the fragmentation view to inspector. Removes ability to query the top retaining instance from an ordinary class browser.
Change-Id: Ia7781c05d43bf3ec149f8b4ecab803b37c3ee981
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112181
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
The method ObservatoryApplication._switchVM calls newVM.onDisconnect
and requires the resulting future to be completed with a String. In
normal operation, this is satisfied and we just need to change a few
static types to enforce it. But when FakeVM was in use, the future
was completed with `this`. Since ObservatoryApplication._switchVM is
the only call site that cares what the future is completed with, it
makes sense to just change all the types to Future<String> and modify
FakeVM accordingly.
Change-Id: Id94d27ac6a42f31ab19ccc9ad8dd270ecf4042b4
Reviewed-on: https://dart-review.googlesource.com/57400
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This includes Fasta, tools and observatory, so the checked-in SDK must
have the lower-case constants.
Change-Id: I8380ad041ad058f7d02ae19caccfecd434d13d75
Reviewed-on: https://dart-review.googlesource.com/50201
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
- [x] Don't show "(Connected)" next to a VM we aren't connected to.
- [x] Navigate to the vm-connect page if we get an initial connection error.
- [x] Fix regression of the 'vm disconnected' notification bubble not appearing.
- [x] Use the Uris helper class instead of hard coded paths
- [x] Improve user inputted URI normalization
- [x] Ignore network errors on stream subscription requests
- [x] On first launch, attempt to connect to the default target and not the last target connected to.
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/2340973002 .
We currently support 5 streams: Isolate, Debug, GC, _Echo, and _Graph.
Only generate events when at least one client is listening to the
corresponding event stream.
Only send events to the clients that actually request them.
Implement this all as Dart streams in the service lib.
Update tests. Fix a race in async_generator_..._test that was biting me.
Review URL: https://codereview.chromium.org//1143783003
In JSON RPC, error results and regular results are distinguished structurally. We now do this in the service protocol instead of returning a regular result with the "Error" type.
VM:
- Add PrintError method to JSONStream. Use this to generate all errors in the service protocol.
- Fix some bugs with "limit" parameter handling.
- Change return value for heap rpcs when they find a collected/expired reference.
- Update tests.
Observatory:
- Add app.handleExceptions -- this is a widely-used exception handler that puts up a notification when there is an uncaught/unexpected exception. Added a top-level zone catch that uses this handler, as well as explicit uses of this handler at various points in the code. Most pages use this implicitly or explictly, except for the debugger page, which displays exceptions in the console.
[ General rule, when a function returns a Future, generally let the error pass through. If a function does async work but doesn't return the Future, then it should handle errors explicitly by calling app.handleExceptions, etc. ]
- Fixed notifications. They were generally broken. Some hard-coded type names needed to be fixed, some hacks needed to be removed.
- Add a new class RpcException and a variety of subclasses which capture the error cases when making an rpc.
- Redo refresh buttons so their callbacks return Futures instead of taking a "done" closure. Cleaner. Allows us to move error handling outside of the callback.
- Drop ServiceError, ServiceException and the associated views.
- Redo notifications so that event and exception notifications are supported.
- No longer null out the vm when it is disconnected.
- Remove notifications when we visit the vm-connect page. Only show the "Proceeding will lose current page" dialog when we aren't on the vm-connect page already.
- Improve error message on cpu profile page when profiling is disabled on the VM.
- Allow variables to wrap on debugger page.
- Make eval-box and eval-link tolerant of errors during rpc. Make the errors display nicely.
- When a breakpoint is marked "not possible", make sure it disappears. This got broken during script view refactor.
- Drop vm's errors and exceptions streams. No longer needed.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//1120133002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45792 260f80e4-7a28-3924-810f-c04153c831b5
- Log the parameters to RPCs
- Display messages like stack frames
- handler function and script visible
- message preview instead of local variables
- Expanded and previewed messages do not collapse when stepping within the existing message
- Mark patch classes as finalized to avoid ASSERT on class_finalizer.cc:2358 **
- Support iterating over message queues
- Support printing the message queue as JSON
- Inhibit OOB messages from being handled if we are iterating over the message queue
- avoids dead lock when looking up port handler (done in Dart code with message handler locked) and a stack overflow trigger to handle OOB messages
- make getObject understand message ids
- Fix dartbug.com/23355
** Need to discuss with Ivan and Matthias (reviewed code differs from committed code but matches my fix):
https://codereview.chromium.org//828353002https://code.google.com/p/dart/source/detail?r=42612R=turnidge@google.com
Review URL: https://codereview.chromium.org//1122503003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45505 260f80e4-7a28-3924-810f-c04153c831b5
Before a response looked like this...
{ result:<string> id:* }
...where result was always a json encoded string. This meant that
users of the service protocol had to json decode both the outer
message and the result, which was silly.
Now a response looks like this:
{ result:<map> id:* }
This means that users of the service protocol only need to decode once.
We have changed event formats as well. Previously, an event looked like this:
{ result:<string> }
(Essentially a result without an id.) The result was json encoded,
requiring the user to double-decode.
Now an event looks like this:
{ event:<map> }
This allows us to distinguish events from rpc results and avoids
double-decoding. It also avoids having an id-less rpc result mistaken
for an event.
------------
Some details and associated changes:
- Unify GCEvent and ServiceEvent in the VM.
- Move sequence number handling out of dart code and into JSONStream
in the VM. Plumbing. I needed to do this to avoid double-encoding.
Some of the dart code gets a bit simpler.
- Update C++ tests to have a sequence number.
- Change format of method/params used in Error responses to be more json-y.
- Strip out double decoding in the service lib.
- Improvements to tests. I was running into some races and other issues.
- Fail fast when we run into a message decoding problem. Instead of
returning a service exception, we now disconnect from the vm.
- VMDisconnected => ConnectionClosed.
- Add some support for a reason string when disconnecting from the vm
in the service library.
Review URL: https://codereview.chromium.org//1093043004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45378 260f80e4-7a28-3924-810f-c04153c831b5
Implement in-frame evaluation in the vm service.
Add a notion of 'current frame' and use it across the debugger,
particularly in source-location based commands (break, clear).
Change the expansion logic for frames, so that by default only the
current frame is shown. When a user expands a frame it is now pinned.
Change command line parsing so that internal whitespace is preserved. We need this to properly evaluate expressions with internal whitespace.
Fix a deadlock in the debugger message loop.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//993613002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44353 260f80e4-7a28-3924-810f-c04153c831b5
- Use IsolateCreated and IsolateShutdown events to edit the VM's isolate cache directly.
- IsolateCreated and IsolateShutdown events are owned by the VM.
- When eagerly loading a new isolate, consume any errors rather than letting them bubble up to the application level.
- When reloading the VM perform an edit the isolate cache instead of replacing it.
- When reloading the VM do not reload all isolates.
- Fix flaky coverage_test fail by delaying setting the breakpoint.
- Add isolate lifecycle unit test.
- Make the isolate cache observable and send an observable notification that the 'isolates' property has changed when editing the isolate cache.
R=rmacnak@google.com
Review URL: https://codereview.chromium.org//961483002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44056 260f80e4-7a28-3924-810f-c04153c831b5
Service
- Remove support for old-style service requests.
- Drop 'arguments' from JsonStream and ServiceRequestHandler.
- Json-rpc inspired renaming: command->method, options->params all over.
- Implement getFlagList, setFlag, getObjectByAddress.
- Add helpers PrintMissingParamError and PrintInvalidParamError
to make our error messages more regular.
- Update tests.
- Service_SetSource removed for now. John will resurrect.
Observatory
- Drop all Deprecated 'get' functions. We now use json rpc for everything.
- Drop 'link' and 'relativeLink' from ServiceObject -- they were
ui-specific and they are no longer meaningful anyways. Use 'id' instead.
- New pages: VMPage, FlagsPage, InspectPage, ErrorPage. All urls
used by Observatory are now 'new school' and have a proper
prefix. ErrorPage is the new catch-all.
- Pages now use a Uri instead of a url String. This lets them
grab query parameters more easily.
- SimplePage replaces IsolateSuffixPage.
- We now use gotoLink() or makeLink() to make our navigation
links. gotoLink gets some optional parameters to make it
easier to construct links to ServiceObjects.
- Rework mouse clicks on the heap map to use getObjectByAddress.
- Remove the breakpoint_list. It wasn't working. I'll add it back later.
- Silence logging of getIsolateMetric/getVMMetric.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//897193002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43514 260f80e4-7a28-3924-810f-c04153c831b5
2) Move observatory from runtime/bin/vmservice/observatory to runtime/observatory
3) Add two tools scripts:
- tools/run_pub.py (runs pub before SDK is built)
- tools/obs_tool.py (helper for get, build, and deploy stages)
4) Build Observatory with runtime:
- pub get --offline
- pub build
- deploy
5) Build artifacts are now in standard output directory, for example, out/DebugIA32/observatory.
6) Add a new 'dart_boostrap' host target (no snapshot, no observatory) that can be used as the Dart executable to run pub when building Observatory. This is behind a build.py flag --use-bootstrap-for-observatory because:
- It is only necessary on older Linux distributions that are incompatible with the prebuilt Dart testing executable.
- running pub build with the boostrap Debug build is significantly slower.
7) Detect if the prebuilt executable doesn't work and automatically switch to the 'dart_bootstrap' executable. Also, warn the user and provide a Wiki link with more information.
R=turnidge@google.com
Review URL: https://codereview.chromium.org//810623005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42614 260f80e4-7a28-3924-810f-c04153c831b5