Skip to content

Commit 09c00b6

Browse files
authored
Handle failures in initialization of filtered-out async slice tracks (#143)
The initial bounds-change handling of an async slice track performs multiple queries asynchronously, in sequence, awaiting the results of each in turn. During one of those waits, a host application embedding Perfetto can filter that track out so that it is no longer in the tracks table in global state and then accessing that state to formulate the next SQL query throws an exception. Trap that exception and bail the initialization of the track controller. For android-graphics/soktatoa#2949 Signed-off-by: Christian W. Damus <cdamus.ext@eclipsesource.com>
1 parent c8f27f0 commit 09c00b6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ui/src/controller/track_controller.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,17 @@ export abstract class TrackController<
362362
this.publish(data);
363363
}
364364
})
365+
.catch((error) => {
366+
if (!globals.state.tracks[this.trackId]) {
367+
// The host application filtered this track out, so assume that
368+
// the error was an assertion failure in asynchronous
369+
// on-bounds-change processing that interleaved with the
370+
// removal of the track from global state
371+
this.queuedRequest = false;
372+
return;
373+
}
374+
throw error;
375+
})
365376
.finally(() => {
366377
this.requestingData = false;
367378
if (this.queuedRequest) {

0 commit comments

Comments
 (0)