File tree Expand file tree Collapse file tree 4 files changed +17
-10
lines changed Expand file tree Collapse file tree 4 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 8
8
intended. Now users can run ` npx sass ` for local installs or just ` sass ` when
9
9
` sass-embedded ` is installed globally.
10
10
11
+ * Fix an edge case where the Dart VM could hang when shutting down when requests
12
+ were in flight.
13
+
11
14
## 1.77.8
12
15
13
16
* No user-visible changes.
Original file line number Diff line number Diff line change @@ -64,8 +64,12 @@ final class CompilationDispatcher {
64
64
/// Listens for incoming `CompileRequests` and runs their compilations.
65
65
void listen () {
66
66
do {
67
- var packet = _mailbox.take ();
68
- if (packet.isEmpty) break ;
67
+ Uint8List packet;
68
+ try {
69
+ packet = _mailbox.take ();
70
+ } on StateError catch (_) {
71
+ break ;
72
+ }
69
73
70
74
try {
71
75
var (compilationId, messageBuffer) = parsePacket (packet);
@@ -322,12 +326,14 @@ final class CompilationDispatcher {
322
326
message.id = _outboundRequestId;
323
327
_send (message);
324
328
325
- var packet = _mailbox.take ();
326
- if (packet.isEmpty) {
329
+ Uint8List packet;
330
+ try {
331
+ packet = _mailbox.take ();
332
+ } on StateError catch (_) {
327
333
// Compiler is shutting down, throw without calling `_handleError` as we
328
334
// don't want to report this as an actual error.
329
335
_requestError = true ;
330
- throw StateError ( 'Compiler is shutting down.' ) ;
336
+ rethrow ;
331
337
}
332
338
333
339
try {
Original file line number Diff line number Diff line change @@ -122,10 +122,8 @@ class ReusableIsolate {
122
122
_receivePort.close ();
123
123
124
124
// If the isolate is blocking on [Mailbox.take], it won't even process a
125
- // kill event, so we send an empty message to make sure it wakes up.
126
- try {
127
- _mailbox.put (Uint8List (0 ));
128
- } on StateError catch (_) {}
125
+ // kill event, so we closed the mailbox to nofity and wake it up.
126
+ _mailbox.close ();
129
127
}
130
128
}
131
129
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ dependencies:
20
20
http : " ^1.1.0"
21
21
js : ^0.6.3
22
22
meta : ^1.3.0
23
- native_synchronization : ^0.2 .0
23
+ native_synchronization : ^0.3 .0
24
24
node_interop : ^2.1.0
25
25
package_config : ^2.0.0
26
26
path : ^1.8.0
You can’t perform that action at this time.
0 commit comments