Closed jonasfj closed 8 months ago
Probably we should report this as an error on the package results.
We do report it, when it happens, it also gets a score penalty.
Or maybe we should do something to limit how much code we analyze?
It is an issue of packages with a lot of files (e.g. when generating from API definitions): dartdoc
, dartfmt
, dartanalyzer
and in effect also pana
's internal checks take much longer time. At the same time, as long as we allow the upload, I think we should attempt to analyze the packages without limiting it to a subset of it.
So does this mean that if I want to earn these points back on pub.dev I need to break my package into smaller pieces? I can run dartdoc and dartfmt on my local machine just fine, although it does take a while. When I run pana, I get the following
INFO Running `/home/grey/dev/flutter/bin/cache/dart-sdk/bin/dartanalyzer --options /home/grey/.local/share/Trash/files/fhir.5/pana_analysis_options_1600959830439730.g.yaml --format machine lib`...
INFO Running `/home/grey/dev/flutter/bin/cache/dart-sdk/bin/dartfmt --dry-run --set-exit-if-changed /home/grey/.local/share/Trash/files/fhir.5/lib`...
SEVERE Killing `/home/grey/dev/flutter/bin/cache/dart-sdk/bin/dartfmt --dry-run --set-exit-if-changed /home/grey/.local/share/Trash/files/fhir.5/lib` Exceeded timeout of 0:05:00.000000
INFO killed `/home/grey/dev/flutter/bin/cache/dart-sdk/bin/dartfmt --dry-run --set-exit-if-changed /home/grey/.local/share/Trash/files/fhir.5/lib` - true
SEVERE `dartfmt` failed.
Exception: dartfmt on lib/ failed with exit code -15
Exception: dartfmt on lib/ failed with exit code -15
#0 ToolEnvironment.filesNeedingFormat (package:pana/src/sdk_env.dart:246:9)
<asynchronous suspension>
#1 _formatPackage (package:pana/src/create_report.dart:220:52)
#2 _staticAnalysis (package:pana/src/create_report.dart:102:15)
<asynchronous suspension>
#3 createReport (package:pana/src/create_report.dart:54:11)
<asynchronous suspension>
#4 PackageAnalyzer._inspect (package:pana/src/package_analyzer.dart:178:21)
<asynchronous suspension>
#5 PackageAnalyzer.inspectDir (package:pana/src/package_analyzer.dart:78:12)
#6 main (file:///home/grey/.pub-cache/hosted/pub.dartlang.org/pana-0.14.3/bin/pana.dart:163:34)
<asynchronous suspension>
#7 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#8 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
INFO Running `/home/grey/dev/flutter/bin/cache/dart-sdk/bin/pub get`...
INFO Running `/home/grey/dev/flutter/bin/cache/dart-sdk/bin/pub outdated --json --up-to-date --no-dev-dependencies --no-dependency-overrides`...
The package I'm working with does contain a lot of files.
I can run dartdoc and dartfmt on my local machine just fine, although it does take a while.
Can you give use some numbers on how much time it does take?
For dartdoc:
real 9m3.876s
user 10m44.561s
sys 0m23.764s
For dartfmt:
real 18m1.047s
user 18m37.268s
sys 0m13.370s
/cc @jonasfj: wdyt, will we be able to support that much with sandboxing? I think we could also consider to increase the time limit only for latest-stable versions.
We could consider adjusting these...
Or we could investigate if there is a way to build the package to avoid these issues? maybe splitting it, maybe doing something else? Breaking it, into smaller packages is an option, maybe reducing the public interface, if there is things there that don't need to be public -- without suggesting that it's a poorly written package, maybe there is a way to fix this by tweaking the package. The case where I sometimes run into this is https://pub.dev/packages/googleapis which is huge, auto-generated, and well, maybe it should have been split.
@Dokotela what package are you working on? I assume it's published on pub.dev
:)
Limiting this to stable versions makes some sense (and mine isn't, yet, so in that case it wouldn't apply).
I could split up the package, but there are a lot of times when someone may need the entire thing.
For me it is also certainly because of the amount of generated code. It is indeed published here: https://pub.dev/packages/fhir. It's for working with medical data using an international interoperability standard defined here: https://www.hl7.org/fhir/overview.html
Regardless of the decision, I appreciate the consideration.
Limiting this to stable versions makes some sense (and mine isn't, yet, so in that case it wouldn't apply).
From the pub site's point of view, you are releasing stable versions (as opposed to prerelease versions like 0.0.1-dev.0.1
).
Increasing the time limit for latest stable version may work, but only if we find a way to schedule the smaller packages with higher priorities. One obvious measure would be the archive size, but it doesn't have the ratio about the .dart
files vs other files like images or other assets.
There are many things that could be improved here:
I think we'll gradually see improvements on all these fronts over time...
But since this currently affects a very small number of packages, and it looks like fhir
has natural boundaries by which it could be split into smaller packages, splitting into smaller packages might make sense for now.
Another option is to generate the API docs and put it on github pages, and then point to it using the documentation: <url>
in pubspec.yaml
, see https://dart.dev/tools/pub/pubspec#documentation
Doing so will at-least put a documentation link on pub.dev, it won't fix the score -- and given the low number of packages affected I doubt we'll prioritize this anytime, hopefully we'll eventually see faster machines, faster analysis and longer runtimes as we continue to improve our tooling and infrastructure.
If you do this, make sure to put the version number in the URL, and retain documentation for older versions of your package -- at-least that's a nice thing to do :D
Closing as no longer relevant - we have implemented new worker, new scheduling and new timeout handling since this issue was raised.
Happens in
analyzer
. Probably we should report this as an error on the package results. Or maybe we should do something to limit how much code we analyze? Not sure...Stack trace looks like: