Commit 4293a45
authored
Harden skip in Scanner (#21607)
After running metals for a while, I sometimes see a rogue java process
at 100% even after I closed down sbt and vscode. With jstack I got the
following stack trace:
java.lang.Thread.State: RUNNABLE
at
dotty.tools.dotc.parsing.Scanners$Scanner.handleNewLine(Scanners.scala:613)
at
dotty.tools.dotc.parsing.Scanners$Scanner.nextToken(Scanners.scala:396)
at dotty.tools.dotc.parsing.Scanners$Scanner.skip(Scanners.scala:312)
at dotty.tools.dotc.parsing.Parsers$Parser.skip(Parsers.scala:280)
at dotty.tools.dotc.parsing.Parsers$Parser.recur$2(Parsers.scala:376)
at
dotty.tools.dotc.parsing.Parsers$Parser.statSepOrEnd(Parsers.scala:380)
It could be that the loop in skip gives two alternate offsets that would
not bump the progress counter. I changed the loop so that it catches
infinite looping conditions more robustly.1 file changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
| 309 | + | |
| 310 | + | |
310 | 311 | | |
311 | | - | |
312 | 312 | | |
313 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
314 | 318 | | |
315 | 319 | | |
316 | 320 | | |
| |||
0 commit comments